diff options
author | Thomas Lively <tlively@google.com> | 2022-11-15 08:39:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-15 08:39:03 -0800 |
commit | b2054b72b7daa89b7ad161c0693befad06a20c90 (patch) | |
tree | 3f2691dadc7af9ee6c86d701ebfebcb8e525c843 /test/lit/passes/optimize-instructions-call_ref.wast | |
parent | 8225e485a24c5fa6fffb0c9f0a3ee8615bcfa0d9 (diff) | |
download | binaryen-b2054b72b7daa89b7ad161c0693befad06a20c90.tar.gz binaryen-b2054b72b7daa89b7ad161c0693befad06a20c90.tar.bz2 binaryen-b2054b72b7daa89b7ad161c0693befad06a20c90.zip |
Make `call_ref` type annotations mandatory (#5246)
They were optional for a while to allow users to gracefully transition to using
them, but now make them mandatory to match the upstream WasmGC spec.
Diffstat (limited to 'test/lit/passes/optimize-instructions-call_ref.wast')
-rw-r--r-- | test/lit/passes/optimize-instructions-call_ref.wast | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast index a82b15542..66e0ee7d8 100644 --- a/test/lit/passes/optimize-instructions-call_ref.wast +++ b/test/lit/passes/optimize-instructions-call_ref.wast @@ -51,7 +51,7 @@ ;; CHECK-NEXT: ) (func $call_ref-to-direct (param $x i32) (param $y i32) ;; This call_ref should become a direct call. - (call_ref + (call_ref $i32_i32_=>_none (local.get $x) (local.get $y) (ref.func $foo) @@ -84,7 +84,7 @@ ;; This call_ref should become a direct call, even though it doesn't have a ;; simple ref.func as the target - we need to look into the fallthrough, and ;; handle things with locals. - (call_ref + (call_ref $i32_i32_=>_none ;; Write to $x before the block, and write to it in the block; we should not ;; reorder these things as the side effects could alter what value appears ;; in the get of $x. (There is a risk of reordering here if we naively moved @@ -116,7 +116,7 @@ (func $fallthrough-no-params (result i32) ;; A fallthrough appears here, but there are no operands so this is easier to ;; optimize: we can just drop the call_ref's target before the call. - (call_ref + (call_ref $none_=>_i32 (block (result (ref $none_=>_i32)) (nop) (ref.func $fallthrough-no-params) @@ -148,7 +148,7 @@ ;; nullable, which means we must be careful when we create a temp local for ;; it: the local should be nullable, and gets of it should use a ;; ref.as_non_null so that we validate. - (call_ref + (call_ref $data_=>_none (local.get $x) (block (result (ref $data_=>_none)) (nop) @@ -174,7 +174,7 @@ ;; emit non-validating code here, which would happen if we replace the ;; call_ref that returns nothing with a call that returns an i32. In fact, we ;; end up optimizing the cast into an unreachable. - (call_ref + (call_ref $none_=>_i32 (ref.cast_static $none_=>_i32 (ref.func $return-nothing) ) @@ -199,7 +199,7 @@ ;; CHECK-NEXT: ) (func $fallthrough-unreachable ;; If the call is not reached, do not optimize it. - (call_ref + (call_ref $i32_i32_=>_none (unreachable) (unreachable) (block (result (ref $i32_i32_=>_none)) @@ -210,14 +210,16 @@ ) ;; CHECK: (func $ignore-unreachable - ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block ;; (replaces something unreachable we can't emit) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $ignore-unreachable ;; Ignore an unreachable call_ref target entirely. - (call_ref + (call_ref $i32_i32_=>_none (unreachable) ) ) @@ -230,7 +232,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $call-table-get (param $x i32) - (call_ref + (call_ref $i32_i32_=>_none (i32.const 1) (i32.const 2) (table.get $table-1 @@ -273,7 +275,7 @@ ;; CHECK-NEXT: ) (func $call_ref-to-select (param $x i32) (param $y i32) (param $z i32) (param $f (ref $i32_i32_=>_none)) ;; This call_ref should become an if over two direct calls. - (call_ref + (call_ref $i32_i32_=>_none (local.get $x) (local.get $y) (select @@ -284,7 +286,7 @@ ) ;; But here one arm is not constant, so we do not optimize. - (call_ref + (call_ref $i32_i32_=>_none (local.get $x) (local.get $y) (select |