summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-01-10 13:53:12 -0600
committerGitHub <noreply@github.com>2023-01-10 11:53:12 -0800
commit36e2abbcdd22b2b1707757b49fb4ac8844f28e5d (patch)
treef869cebf2c8d772f8f85db83f39aadfd6ac6f7cb /test
parente6efd7b991a9c55115771ea121b0eff2bace7d3e (diff)
downloadbinaryen-36e2abbcdd22b2b1707757b49fb4ac8844f28e5d.tar.gz
binaryen-36e2abbcdd22b2b1707757b49fb4ac8844f28e5d.tar.bz2
binaryen-36e2abbcdd22b2b1707757b49fb4ac8844f28e5d.zip
Represent ref.as_{func,data,i31} with RefCast (#5413)
These operations are deprecated and directly representable as casts, so remove their opcodes in the internal IR and parse them as casts instead. For now, add logic to the printing and binary writing of RefCast to continue emitting the legacy instructions to minimize test changes. The few test changes necessary are because it is no longer valid to perform a ref.as_func on values outside the func type hierarchy now that ref.as_func is subject to the ref.cast validation rules. RefAsExternInternalize, RefAsExternExternalize, and RefAsNonNull are left unmodified. A future PR may remove RefAsNonNull as well, since it is also expressible with casts.
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/expressions.js21
-rw-r--r--test/example/c-api-kitchen-sink.c9
-rw-r--r--test/example/c-api-kitchen-sink.txt15
-rw-r--r--test/heap-types.wast4
-rw-r--r--test/heap-types.wast.from-wast7
-rw-r--r--test/heap-types.wast.fromBinary7
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo7
-rw-r--r--test/lit/binary/bad-ref-as.test5
-rw-r--r--test/lit/passes/gufa-extern.wast9
-rw-r--r--test/lit/passes/optimize-instructions-gc-tnh.wast18
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast109
-rw-r--r--test/lit/passes/vacuum-gc.wast10
-rw-r--r--test/lit/passes/vacuum-tnh.wast10
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.txt38
-rw-r--r--test/passes/Oz_fuzz-exec_all-features.wast8
15 files changed, 63 insertions, 214 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index ee55ee90b..c9111c9b4 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -1450,6 +1450,7 @@ console.log("# RefAs");
var op = binaryen.Operations.RefAsNonNull;
var value = module.local.get(1, binaryen.anyref);
+ var externref = module.local.get(3, binaryen.externref);
const theRefAs = binaryen.RefAs(module.ref.as_non_null(value));
assert(theRefAs instanceof binaryen.RefAs);
assert(theRefAs instanceof binaryen.Expression);
@@ -1457,9 +1458,9 @@ console.log("# RefAs");
assert(theRefAs.value === value);
assert(theRefAs.type !== binaryen.i32); // TODO: === (ref any)
- theRefAs.op = op = binaryen.Operations.RefAsFunc;
+ theRefAs.op = op = binaryen.Operations.RefAsExternExternalize;
assert(theRefAs.op === op);
- theRefAs.op = op = binaryen.Operations.RefAsNull;
+ theRefAs.op = op = binaryen.Operations.RefAsNonNull;
theRefAs.value = value = module.local.get(2, binaryen.anyref);
assert(theRefAs.value === value);
theRefAs.type = binaryen.f64;
@@ -1473,21 +1474,7 @@ console.log("# RefAs");
"(ref.as_non_null\n (local.get $2)\n)\n"
);
- assert(
- binaryen.RefAs(module.ref.as_func(value)).toText()
- ==
- "(ref.as_func\n (local.get $2)\n)\n"
- );
- assert(
- binaryen.RefAs(module.ref.as_data(value)).toText()
- ==
- "(ref.as_data\n (local.get $2)\n)\n"
- );
- assert(
- binaryen.RefAs(module.ref.as_i31(value)).toText()
- ==
- "(ref.as_i31\n (local.get $2)\n)\n"
- );
+ // TODO: extern.externalize and extern.internalize
module.dispose();
})();
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index cc2c96538..45af52e21 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -1018,15 +1018,6 @@ void test_core() {
BinaryenRefAsNonNull(),
BinaryenRefNull(module, BinaryenTypeNullref())),
BinaryenRefAs(module,
- BinaryenRefAsFunc(),
- BinaryenRefNull(module, BinaryenTypeNullref())),
- BinaryenRefAs(module,
- BinaryenRefAsData(),
- BinaryenRefNull(module, BinaryenTypeNullref())),
- BinaryenRefAs(module,
- BinaryenRefAsI31(),
- BinaryenRefNull(module, BinaryenTypeNullref())),
- BinaryenRefAs(module,
BinaryenRefAsExternInternalize(),
BinaryenRefNull(module, BinaryenTypeNullExternref())),
BinaryenRefAs(module,
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 51298d1a2..6e4af6cf0 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -2009,21 +2009,6 @@ BinaryenFeatureAll: 126975
)
)
(drop
- (ref.as_func
- (ref.null none)
- )
- )
- (drop
- (ref.as_data
- (ref.null none)
- )
- )
- (drop
- (ref.as_i31
- (ref.null none)
- )
- )
- (drop
(extern.internalize
(ref.null noextern)
)
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 5171d5a66..f64dd8814 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -185,9 +185,9 @@
(if (ref.is_data (local.get $x)) (unreachable))
(if (ref.is_i31 (local.get $x)) (unreachable))
)
- (func $ref.as_X (param $x anyref)
+ (func $ref.as_X (param $x anyref) (param $f funcref)
(drop (ref.as_non_null (local.get $x)))
- (drop (ref.as_func (local.get $x)))
+ (drop (ref.as_func (local.get $f)))
(drop (ref.as_data (local.get $x)))
(drop (ref.as_i31 (local.get $x)))
)
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index b551a9073..703759720 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -9,13 +9,14 @@
(type $parent (struct ))
(type $child (struct_subtype (field i32) $parent))
(type $grandchild (struct_subtype (field i32) (field i64) $child))
- (type $anyref_=>_none (func (param anyref)))
(type $ref?|$vector|_=>_none (func (param (ref null $vector))))
(type $nested-child-struct (struct (field (mut (ref $child)))))
(type $words (array (mut i32)))
(type $nested-child-array (array (mut (ref $child))))
+ (type $anyref_=>_none (func (param anyref)))
(type $ref|$struct.A|_ref?|$struct.A|_ref?|$grandchild|_ref?|$struct.C|_ref?|$nested-child-struct|_=>_ref|$struct.B| (func (param (ref $struct.A) (ref null $struct.A) (ref null $grandchild) (ref null $struct.C) (ref null $nested-child-struct)) (result (ref $struct.B))))
(type $ref|$vector|_ref?|$nested-child-array|_ref?|$grandchild|_=>_ref|$matrix| (func (param (ref $vector) (ref null $nested-child-array) (ref null $grandchild)) (result (ref $matrix))))
+ (type $anyref_funcref_=>_none (func (param anyref funcref)))
(type $ref?|$struct.C|_=>_none (func (param (ref null $struct.C))))
(type $ref|$vector|_ref?|$vector|_=>_none (func (param (ref $vector) (ref null $vector))))
(type $none_=>_ref|$vector| (func (result (ref $vector))))
@@ -189,7 +190,7 @@
(unreachable)
)
)
- (func $ref.as_X (type $anyref_=>_none) (param $x anyref)
+ (func $ref.as_X (type $anyref_funcref_=>_none) (param $x anyref) (param $f funcref)
(drop
(ref.as_non_null
(local.get $x)
@@ -197,7 +198,7 @@
)
(drop
(ref.as_func
- (local.get $x)
+ (local.get $f)
)
)
(drop
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 485611fef..8e42051bc 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -9,13 +9,14 @@
(type $parent (struct ))
(type $child (struct_subtype (field i32) $parent))
(type $grandchild (struct_subtype (field i32) (field i64) $child))
- (type $anyref_=>_none (func (param anyref)))
(type $ref?|$vector|_=>_none (func (param (ref null $vector))))
(type $nested-child-struct (struct (field (mut (ref $child)))))
(type $words (array (mut i32)))
(type $nested-child-array (array (mut (ref $child))))
+ (type $anyref_=>_none (func (param anyref)))
(type $ref|$struct.A|_ref?|$struct.A|_ref?|$grandchild|_ref?|$struct.C|_ref?|$nested-child-struct|_=>_ref|$struct.B| (func (param (ref $struct.A) (ref null $struct.A) (ref null $grandchild) (ref null $struct.C) (ref null $nested-child-struct)) (result (ref $struct.B))))
(type $ref|$vector|_ref?|$nested-child-array|_ref?|$grandchild|_=>_ref|$matrix| (func (param (ref $vector) (ref null $nested-child-array) (ref null $grandchild)) (result (ref $matrix))))
+ (type $anyref_funcref_=>_none (func (param anyref funcref)))
(type $ref?|$struct.C|_=>_none (func (param (ref null $struct.C))))
(type $ref|$vector|_ref?|$vector|_=>_none (func (param (ref $vector) (ref null $vector))))
(type $none_=>_ref|$vector| (func (result (ref $vector))))
@@ -187,7 +188,7 @@
(unreachable)
)
)
- (func $ref.as_X (type $anyref_=>_none) (param $x anyref)
+ (func $ref.as_X (type $anyref_funcref_=>_none) (param $x anyref) (param $f funcref)
(drop
(ref.as_non_null
(local.get $x)
@@ -195,7 +196,7 @@
)
(drop
(ref.as_func
- (local.get $x)
+ (local.get $f)
)
)
(drop
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 03047def7..3c7203066 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -9,13 +9,14 @@
(type ${} (struct ))
(type ${i32} (struct_subtype (field i32) ${}))
(type ${i32_i64} (struct_subtype (field i32) (field i64) ${i32}))
- (type $anyref_=>_none (func (param anyref)))
(type $ref?|[mut:f64]|_=>_none (func (param (ref null $[mut:f64]))))
(type ${mut:ref|{i32}|} (struct (field (mut (ref ${i32})))))
(type $[mut:i32] (array (mut i32)))
(type $[mut:ref|{i32}|] (array (mut (ref ${i32}))))
+ (type $anyref_=>_none (func (param anyref)))
(type $ref|{i32_f32_f64}|_ref?|{i32_f32_f64}|_ref?|{i32_i64}|_ref?|{mut:f32}|_ref?|{mut:ref|{i32}|}|_=>_ref|{i8_mut:i16_ref|{i32_f32_f64}|_mut:ref|{i32_f32_f64}|}| (func (param (ref ${i32_f32_f64}) (ref null ${i32_f32_f64}) (ref null ${i32_i64}) (ref null ${mut:f32}) (ref null ${mut:ref|{i32}|})) (result (ref ${i8_mut:i16_ref|{i32_f32_f64}|_mut:ref|{i32_f32_f64}|}))))
(type $ref|[mut:f64]|_ref?|[mut:ref|{i32}|]|_ref?|{i32_i64}|_=>_ref|[mut:ref?|[mut:f64]|]| (func (param (ref $[mut:f64]) (ref null $[mut:ref|{i32}|]) (ref null ${i32_i64})) (result (ref $[mut:ref?|[mut:f64]|]))))
+ (type $anyref_funcref_=>_none (func (param anyref funcref)))
(type $ref?|{mut:f32}|_=>_none (func (param (ref null ${mut:f32}))))
(type $ref|[mut:f64]|_ref?|[mut:f64]|_=>_none (func (param (ref $[mut:f64]) (ref null $[mut:f64]))))
(type $none_=>_ref|[mut:f64]| (func (result (ref $[mut:f64]))))
@@ -187,7 +188,7 @@
(unreachable)
)
)
- (func $3 (type $anyref_=>_none) (param $0 anyref)
+ (func $3 (type $anyref_funcref_=>_none) (param $0 anyref) (param $1 funcref)
(drop
(ref.as_non_null
(local.get $0)
@@ -195,7 +196,7 @@
)
(drop
(ref.as_func
- (local.get $0)
+ (local.get $1)
)
)
(drop
diff --git a/test/lit/binary/bad-ref-as.test b/test/lit/binary/bad-ref-as.test
index 2afa19904..3accdd553 100644
--- a/test/lit/binary/bad-ref-as.test
+++ b/test/lit/binary/bad-ref-as.test
@@ -1,6 +1,5 @@
;; Test that we error properly on a file with a ref.as of a non-ref type.
-;; RUN: not wasm-opt %s.wasm 2>&1 | filecheck %s
-
-;; CHECK: parse exception: bad input type for ref.as: i32
+;; RUN: not wasm-opt -all %s.wasm 2>&1 | filecheck %s
+;; CHECK: ref.cast ref must have ref type
diff --git a/test/lit/passes/gufa-extern.wast b/test/lit/passes/gufa-extern.wast
index 2c38a0118..9d71357aa 100644
--- a/test/lit/passes/gufa-extern.wast
+++ b/test/lit/passes/gufa-extern.wast
@@ -39,10 +39,13 @@
;; CHECK: (func $non-exported (type $externref_anyref_=>_none) (param $ext externref) (param $any anyref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.as_data
- ;; CHECK-NEXT: (extern.internalize
- ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: (block ;; (replaces something unreachable we can't emit)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (extern.internalize
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
diff --git a/test/lit/passes/optimize-instructions-gc-tnh.wast b/test/lit/passes/optimize-instructions-gc-tnh.wast
index 948e03296..502590cde 100644
--- a/test/lit/passes/optimize-instructions-gc-tnh.wast
+++ b/test/lit/passes/optimize-instructions-gc-tnh.wast
@@ -86,9 +86,7 @@
;; TNH: (func $ref.is (type $eqref_=>_i32) (param $a eqref) (result i32)
;; TNH-NEXT: (drop
;; TNH-NEXT: (ref.cast $struct
- ;; TNH-NEXT: (ref.as_data
- ;; TNH-NEXT: (local.get $a)
- ;; TNH-NEXT: )
+ ;; TNH-NEXT: (local.get $a)
;; TNH-NEXT: )
;; TNH-NEXT: )
;; TNH-NEXT: (i32.const 0)
@@ -96,9 +94,7 @@
;; NO_TNH: (func $ref.is (type $eqref_=>_i32) (param $a eqref) (result i32)
;; NO_TNH-NEXT: (drop
;; NO_TNH-NEXT: (ref.cast $struct
- ;; NO_TNH-NEXT: (ref.as_data
- ;; NO_TNH-NEXT: (local.get $a)
- ;; NO_TNH-NEXT: )
+ ;; NO_TNH-NEXT: (local.get $a)
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: (i32.const 0)
@@ -140,23 +136,23 @@
)
)
- ;; TNH: (func $ref.is_func (type $anyref_=>_i32) (param $a anyref) (result i32)
+ ;; TNH: (func $ref.is_func (type $funcref_=>_i32) (param $a funcref) (result i32)
;; TNH-NEXT: (drop
- ;; TNH-NEXT: (ref.as_func
+ ;; TNH-NEXT: (ref.as_non_null
;; TNH-NEXT: (local.get $a)
;; TNH-NEXT: )
;; TNH-NEXT: )
;; TNH-NEXT: (i32.const 1)
;; TNH-NEXT: )
- ;; NO_TNH: (func $ref.is_func (type $anyref_=>_i32) (param $a anyref) (result i32)
+ ;; NO_TNH: (func $ref.is_func (type $funcref_=>_i32) (param $a funcref) (result i32)
;; NO_TNH-NEXT: (drop
- ;; NO_TNH-NEXT: (ref.as_func
+ ;; NO_TNH-NEXT: (ref.as_non_null
;; NO_TNH-NEXT: (local.get $a)
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: (i32.const 1)
;; NO_TNH-NEXT: )
- (func $ref.is_func (param $a (ref null any)) (result i32)
+ (func $ref.is_func (param $a funcref) (result i32)
;; The check must succeed. We can return 1 here, and drop the rest, with or
;; without TNH (in particular, TNH should not just remove the cast but not
;; return a 1).
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index e6ee4784a..631697e27 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -366,95 +366,6 @@
)
)
- ;; similar to $unneeded_as, but the values are of mixed kind (as_func of
- ;; data, etc.), so we know we will trap
- ;; CHECK: (func $unneeded_as_bad_kinds (type $funcref_dataref_i31ref_=>_none) (param $func funcref) (param $struct dataref) (param $i31 i31ref)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref func))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref i31))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $func)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref func))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $struct)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (block (result (ref i31))
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (local.get $func)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (unreachable)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; NOMNL: (func $unneeded_as_bad_kinds (type $funcref_dataref_i31ref_=>_none) (param $func funcref) (param $struct dataref) (param $i31 i31ref)
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref func))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $struct)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref i31))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $func)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref func))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $struct)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (block (result (ref i31))
- ;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (local.get $func)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: (unreachable)
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- ;; NOMNL-NEXT: )
- (func $unneeded_as_bad_kinds
- (param $func (ref null func))
- (param $struct (ref null struct))
- (param $i31 (ref null i31))
- (drop
- (ref.as_func (local.get $struct))
- )
- (drop
- (ref.as_i31 (local.get $func))
- )
- ;; also check non-nullable types as inputs
- (drop
- (ref.as_func (ref.as_non_null (local.get $struct)))
- )
- (drop
- (ref.as_i31 (ref.as_non_null (local.get $func)))
- )
- )
-
;; CHECK: (func $unneeded_unreachability (type $void)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.is_func
@@ -462,7 +373,10 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.as_func
+ ;; 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: )
@@ -474,7 +388,10 @@
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
;; NOMNL-NEXT: (drop
- ;; NOMNL-NEXT: (ref.as_func
+ ;; NOMNL-NEXT: (block ;; (replaces something unreachable we can't emit)
+ ;; NOMNL-NEXT: (drop
+ ;; NOMNL-NEXT: (unreachable)
+ ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
@@ -3129,12 +3046,18 @@
)
;; CHECK: (func $as_of_unreachable (type $none_=>_ref|data|) (result (ref data))
- ;; CHECK-NEXT: (ref.as_data
+ ;; 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: )
;; NOMNL: (func $as_of_unreachable (type $none_=>_ref|data|) (result (ref data))
- ;; NOMNL-NEXT: (ref.as_data
+ ;; NOMNL-NEXT: (block ;; (replaces something unreachable we can't emit)
+ ;; NOMNL-NEXT: (drop
+ ;; NOMNL-NEXT: (unreachable)
+ ;; NOMNL-NEXT: )
;; NOMNL-NEXT: (unreachable)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
diff --git a/test/lit/passes/vacuum-gc.wast b/test/lit/passes/vacuum-gc.wast
index c7ff5a37f..c131bef20 100644
--- a/test/lit/passes/vacuum-gc.wast
+++ b/test/lit/passes/vacuum-gc.wast
@@ -12,11 +12,6 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (ref.as_func
- ;; CHECK-NEXT: (local.get $x)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (drop
;; CHECK-NEXT: (ref.as_data
;; CHECK-NEXT: (local.get $x)
;; CHECK-NEXT: )
@@ -36,11 +31,6 @@
)
)
(drop
- (ref.as_func
- (local.get $x)
- )
- )
- (drop
(ref.as_data
(local.get $x)
)
diff --git a/test/lit/passes/vacuum-tnh.wast b/test/lit/passes/vacuum-tnh.wast
index c1e8c2059..40aac16c1 100644
--- a/test/lit/passes/vacuum-tnh.wast
+++ b/test/lit/passes/vacuum-tnh.wast
@@ -27,11 +27,6 @@
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: )
;; NO_TNH-NEXT: (drop
- ;; NO_TNH-NEXT: (ref.as_func
- ;; NO_TNH-NEXT: (local.get $y)
- ;; NO_TNH-NEXT: )
- ;; NO_TNH-NEXT: )
- ;; NO_TNH-NEXT: (drop
;; NO_TNH-NEXT: (ref.as_data
;; NO_TNH-NEXT: (local.get $y)
;; NO_TNH-NEXT: )
@@ -61,11 +56,6 @@
;; Other ref.as* as well.
(drop
- (ref.as_func
- (local.get $y)
- )
- )
- (drop
(ref.as_data
(local.get $y)
)
diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt
index 30949def4..2ff239257 100644
--- a/test/passes/Oz_fuzz-exec_all-features.txt
+++ b/test/passes/Oz_fuzz-exec_all-features.txt
@@ -22,8 +22,6 @@
[fuzz-exec] calling br-on_non_null-2
[LoggingExternalInterface logging 1]
[trap unreachable]
-[fuzz-exec] calling ref-as-func-of-data
-[trap not a func]
[fuzz-exec] calling ref-as-func-of-func
[fuzz-exec] calling cast-on-func
[LoggingExternalInterface logging 0]
@@ -73,17 +71,16 @@
(export "cast-null-anyref-to-gc" (func $5))
(export "br-on_non_null" (func $7))
(export "br-on_non_null-2" (func $8))
- (export "ref-as-func-of-data" (func $9))
(export "ref-as-func-of-func" (func $7))
- (export "cast-on-func" (func $12))
+ (export "cast-on-func" (func $11))
(export "array-alloc-failure" (func $7))
- (export "init-array-packed" (func $14))
- (export "array-copy" (func $16))
- (export "array.init_static" (func $17))
- (export "array.init_static-packed" (func $18))
- (export "static-casts" (func $19))
+ (export "init-array-packed" (func $13))
+ (export "array-copy" (func $15))
+ (export "array.init_static" (func $16))
+ (export "array.init_static-packed" (func $17))
+ (export "static-casts" (func $18))
(export "static-br_on_cast" (func $2))
- (export "static-br_on_cast_fail" (func $21))
+ (export "static-br_on_cast_fail" (func $20))
(func $0 (type $void_func) (; has Stack IR ;)
(local $0 i32)
(call $log
@@ -196,12 +193,7 @@
)
)
)
- (func $9 (type $void_func) (; has Stack IR ;)
- (drop
- (unreachable)
- )
- )
- (func $12 (type $void_func) (; has Stack IR ;)
+ (func $11 (type $void_func) (; has Stack IR ;)
(call $log
(i32.const 0)
)
@@ -213,7 +205,7 @@
)
(unreachable)
)
- (func $14 (type $int_func) (; has Stack IR ;) (result i32)
+ (func $13 (type $int_func) (; has Stack IR ;) (result i32)
(array.get_u $bytes
(array.new $bytes
(i32.const -43)
@@ -222,7 +214,7 @@
(i32.const 10)
)
)
- (func $16 (type $void_func) (; has Stack IR ;)
+ (func $15 (type $void_func) (; has Stack IR ;)
(local $0 (ref $bytes))
(local $1 (ref $bytes))
(array.set $bytes
@@ -277,7 +269,7 @@
)
)
)
- (func $17 (type $void_func) (; has Stack IR ;)
+ (func $16 (type $void_func) (; has Stack IR ;)
(local $0 (ref $bytes))
(call $log
(array.len
@@ -302,7 +294,7 @@
)
)
)
- (func $18 (type $void_func) (; has Stack IR ;)
+ (func $17 (type $void_func) (; has Stack IR ;)
(call $log
(array.get_u $bytes
(array.init_static $bytes
@@ -312,7 +304,7 @@
)
)
)
- (func $19 (type $void_func) (; has Stack IR ;)
+ (func $18 (type $void_func) (; has Stack IR ;)
(call $log
(i32.const 1)
)
@@ -332,7 +324,7 @@
(i32.const 1)
)
)
- (func $21 (type $void_func) (; has Stack IR ;)
+ (func $20 (type $void_func) (; has Stack IR ;)
(call $log
(i32.const -2)
)
@@ -362,8 +354,6 @@
[fuzz-exec] calling br-on_non_null-2
[LoggingExternalInterface logging 1]
[trap unreachable]
-[fuzz-exec] calling ref-as-func-of-data
-[trap unreachable]
[fuzz-exec] calling ref-as-func-of-func
[fuzz-exec] calling cast-on-func
[LoggingExternalInterface logging 0]
diff --git a/test/passes/Oz_fuzz-exec_all-features.wast b/test/passes/Oz_fuzz-exec_all-features.wast
index 0ce79aa4b..9828d7022 100644
--- a/test/passes/Oz_fuzz-exec_all-features.wast
+++ b/test/passes/Oz_fuzz-exec_all-features.wast
@@ -177,14 +177,6 @@
)
)
)
- (func "ref-as-func-of-data"
- (drop
- ;; This should trap.
- (ref.as_func
- (struct.new_default $struct)
- )
- )
- )
(func "ref-as-func-of-func"
(drop
(ref.as_func