summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm/wasm-ir-builder.cpp2
-rw-r--r--test/lit/basic/multi-table.wast5
-rw-r--r--test/lit/basic/reference-types.wast27
-rw-r--r--test/lit/basic/tags.wast6
-rw-r--r--test/lit/exec/strings.wast1
-rw-r--r--test/lit/merge/fusing.wat.second7
-rw-r--r--test/lit/merge/memory_data.wat.second6
-rw-r--r--test/lit/merge/renamings.wat.second6
-rw-r--r--test/lit/passes/asyncify-wasm64.wast4
-rw-r--r--test/lit/passes/asyncify-wasm64_pass-arg=in-secondary-memory.wast4
-rw-r--r--test/lit/passes/asyncify.wast10
-rw-r--r--test/lit/passes/asyncify_enable-multivalue.wast6
-rw-r--r--test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind.wast4
-rw-r--r--test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast5
-rw-r--r--test/lit/passes/asyncify_mod-asyncify-never-unwind.wast4
-rw-r--r--test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast4
-rw-r--r--test/lit/passes/asyncify_optimize-level=1.wast4
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast4
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast8
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.wast4
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.wast3
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast4
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast4
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast8
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-onlylist@foo,bar.wast3
-rw-r--r--test/lit/passes/asyncify_pass-arg=asyncify-verbose.wast4
-rw-r--r--test/lit/passes/asyncify_pass-arg=in-secondary-memory.wast4
-rw-r--r--test/lit/passes/cfp.wast1
-rw-r--r--test/lit/passes/coalesce-locals-learning.wast5
-rw-r--r--test/lit/passes/coalesce-locals.wast4
-rw-r--r--test/lit/passes/directize_all-features.wast8
-rw-r--r--test/lit/passes/flatten_i64-to-i32-lowering.wast3
-rw-r--r--test/lit/passes/global-effects.wast9
-rw-r--r--test/lit/passes/gto-removals.wast2
-rw-r--r--test/lit/passes/memory-packing_all-features.wast16
-rw-r--r--test/lit/passes/monomorphize.wast6
-rw-r--r--test/lit/passes/optimize-instructions-ignore-traps.wast3
-rw-r--r--test/lit/passes/optimize-instructions-mvp.wast3
-rw-r--r--test/lit/passes/remove-unused-module-elements-eh-old.wast3
39 files changed, 129 insertions, 85 deletions
diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp
index bf3c38c1e..dadda0f25 100644
--- a/src/wasm/wasm-ir-builder.cpp
+++ b/src/wasm/wasm-ir-builder.cpp
@@ -1323,7 +1323,7 @@ Result<> IRBuilder::makePop(Type type) {
"pop instructions may only appear at the beginning of catch blocks"};
}
auto expectedType = scope.exprStack[0]->type;
- if (type != expectedType) {
+ if (!Type::isSubType(expectedType, type)) {
return Err{std::string("Expected pop of type ") + expectedType.toString()};
}
return Ok{};
diff --git a/test/lit/basic/multi-table.wast b/test/lit/basic/multi-table.wast
index 3a464dca1..64de79df0 100644
--- a/test/lit/basic/multi-table.wast
+++ b/test/lit/basic/multi-table.wast
@@ -15,17 +15,16 @@
(type $none_=>_none (func))
(type $A (struct))
;; CHECK-TEXT: (import "a" "b" (table $t1 1 10 funcref))
-
- ;; CHECK-TEXT: (global $g1 (ref null $none_=>_none) (ref.func $f))
;; CHECK-BIN: (import "a" "b" (table $t1 1 10 funcref))
+ (import "a" "b" (table $t1 1 10 funcref))
+ ;; CHECK-TEXT: (global $g1 (ref null $none_=>_none) (ref.func $f))
;; CHECK-BIN: (global $g1 (ref null $none_=>_none) (ref.func $f))
(global $g1 (ref null $none_=>_none) (ref.func $f))
;; CHECK-TEXT: (global $g2 i32 (i32.const 0))
;; CHECK-BIN: (global $g2 i32 (i32.const 0))
(global $g2 i32 (i32.const 0))
- (import "a" "b" (table $t1 1 10 funcref))
;; CHECK-TEXT: (table $t2 3 3 funcref)
;; CHECK-BIN: (table $t2 3 3 funcref)
(table $t2 3 3 funcref)
diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast
index 75d5f313f..212230ca3 100644
--- a/test/lit/basic/reference-types.wast
+++ b/test/lit/basic/reference-types.wast
@@ -43,6 +43,19 @@
;; CHECK-TEXT: (import "env" "import_global" (global $import_global eqref))
;; CHECK-TEXT: (import "env" "import_func" (func $import_func (type $8) (param eqref) (result funcref)))
+ ;; CHECK-BIN: (type $5 (func))
+
+ ;; CHECK-BIN: (type $6 (func (result eqref)))
+
+ ;; CHECK-BIN: (type $7 (func (param i32)))
+
+ ;; CHECK-BIN: (type $8 (func (param eqref) (result funcref)))
+
+ ;; CHECK-BIN: (import "env" "import_global" (global $import_global eqref))
+
+ ;; CHECK-BIN: (import "env" "import_func" (func $import_func (type $8) (param eqref) (result funcref)))
+ (import "env" "import_func" (func $import_func (param eqref) (result funcref)))
+ (import "env" "import_global" (global $import_global eqref))
;; CHECK-TEXT: (global $global_eqref (mut eqref) (ref.null none))
@@ -69,18 +82,6 @@
;; CHECK-TEXT: (func $take_eqref (type $sig_eqref) (param $0 eqref)
;; CHECK-TEXT-NEXT: (nop)
;; CHECK-TEXT-NEXT: )
- ;; CHECK-BIN: (type $5 (func))
-
- ;; CHECK-BIN: (type $6 (func (result eqref)))
-
- ;; CHECK-BIN: (type $7 (func (param i32)))
-
- ;; CHECK-BIN: (type $8 (func (param eqref) (result funcref)))
-
- ;; CHECK-BIN: (import "env" "import_global" (global $import_global eqref))
-
- ;; CHECK-BIN: (import "env" "import_func" (func $import_func (type $8) (param eqref) (result funcref)))
-
;; CHECK-BIN: (global $global_eqref (mut eqref) (ref.null none))
;; CHECK-BIN: (global $global_funcref (mut funcref) (ref.null nofunc))
@@ -172,8 +173,6 @@
;; CHECK-BIN-NODEBUG: (elem declare func $23 $3)
(elem declare func $ref-taken-but-not-in-table)
- (import "env" "import_func" (func $import_func (param eqref) (result funcref)))
- (import "env" "import_global" (global $import_global eqref))
(export "export_func" (func $import_func))
(export "export_global" (global $import_global))
diff --git a/test/lit/basic/tags.wast b/test/lit/basic/tags.wast
index 5fbc0b811..8e314af0b 100644
--- a/test/lit/basic/tags.wast
+++ b/test/lit/basic/tags.wast
@@ -12,7 +12,11 @@
;; Test tags
(module
+ (tag $e-import (import "env" "im0") (param i32))
+ (import "env" "im1" (tag (param i32 f32)))
+
(tag (param i32))
+
;; CHECK-TEXT: (type $0 (func (param i32 f32)))
;; CHECK-TEXT: (type $1 (func (param i32)))
@@ -54,9 +58,7 @@
;; CHECK-TEXT: (tag $e-export (param i32))
;; CHECK-BIN: (tag $e-export (param i32))
(tag $e-export (export "ex0") (param i32))
- (tag $e-import (import "env" "im0") (param i32))
- (import "env" "im1" (tag (param i32 f32)))
;; CHECK-TEXT: (export "ex0" (tag $e-export))
;; CHECK-TEXT: (export "ex1" (tag $e))
diff --git a/test/lit/exec/strings.wast b/test/lit/exec/strings.wast
index 5460abd2a..e7e31392a 100644
--- a/test/lit/exec/strings.wast
+++ b/test/lit/exec/strings.wast
@@ -4,6 +4,7 @@
(module
(type $array16 (array (mut i16)))
+ (memory 1 1)
;; CHECK: [fuzz-exec] calling new_wtf16_array
;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello")
diff --git a/test/lit/merge/fusing.wat.second b/test/lit/merge/fusing.wat.second
index 7ab9cc3f3..4a3c8d14c 100644
--- a/test/lit/merge/fusing.wat.second
+++ b/test/lit/merge/fusing.wat.second
@@ -6,6 +6,10 @@
;; Use a different prefix than in first ($main instead of $other).
(import "first" "bar" (func $main.bar))
+ (import "first" "mem" (memory $other.mem 1))
+
+ (import "first" "exn" (tag $exn))
+
(memory $second.mem 2)
(export "mem" (memory $second.mem))
@@ -26,8 +30,6 @@
)
)
- (import "first" "mem" (memory $other.mem 1))
-
(func $keepalive2 (export "keepalive2") (result i32)
;; Load from the memory imported from the second module.
(i32.load $other.mem
@@ -35,6 +37,5 @@
)
)
- (import "first" "exn" (tag $exn))
(func $keepalive3 (export "keepalive3") (throw $exn))
)
diff --git a/test/lit/merge/memory_data.wat.second b/test/lit/merge/memory_data.wat.second
index 8af6ba36d..4a738877d 100644
--- a/test/lit/merge/memory_data.wat.second
+++ b/test/lit/merge/memory_data.wat.second
@@ -1,11 +1,11 @@
(module
+ ;; Test that the import remains
+ (import "import" "mem" (memory $imported 10000))
+
(memory $other 100)
(memory $bar 1000)
- ;; Test that the import remains
- (import "import" "mem" (memory $imported 10000))
-
(data $a (memory $other) (i32.const 0) "a2")
(data $b (memory $bar) (i32.const 0) "b2")
diff --git a/test/lit/merge/renamings.wat.second b/test/lit/merge/renamings.wat.second
index f3489e620..25d3d5e81 100644
--- a/test/lit/merge/renamings.wat.second
+++ b/test/lit/merge/renamings.wat.second
@@ -1,13 +1,13 @@
(module
(type $array (array (mut (ref null func))))
+ ;; Test that the import remains
+ (import "elsewhere" "some.tag" (tag $imported (param f64)))
+
(tag $foo (param f32))
(tag $other (param f64))
- ;; Test that the import remains
- (import "elsewhere" "some.tag" (tag $imported (param f64)))
-
(memory $foo 50 60)
(memory $other 70 80)
diff --git a/test/lit/passes/asyncify-wasm64.wast b/test/lit/passes/asyncify-wasm64.wast
index 07d1942e4..94cdf0347 100644
--- a/test/lit/passes/asyncify-wasm64.wast
+++ b/test/lit/passes/asyncify-wasm64.wast
@@ -7,7 +7,6 @@
;; CHECK: (type $f (func (param i32)))
(type $f (func (param i32)))
- (memory i64 1 2)
;; CHECK: (type $2 (func))
;; CHECK: (type $3 (func (param i64)))
@@ -18,6 +17,9 @@
(import "env" "import" (func $import))
;; CHECK: (import "env" "import2" (func $import2 (param i32)))
(import "env" "import2" (func $import2 (param i32)))
+
+ (memory i64 1 2)
+
(table funcref (elem $liveness2 $liveness2))
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify-wasm64_pass-arg=in-secondary-memory.wast b/test/lit/passes/asyncify-wasm64_pass-arg=in-secondary-memory.wast
index 1a8f6dfef..45af7b839 100644
--- a/test/lit/passes/asyncify-wasm64_pass-arg=in-secondary-memory.wast
+++ b/test/lit/passes/asyncify-wasm64_pass-arg=in-secondary-memory.wast
@@ -3,7 +3,6 @@
;; RUN: wasm-opt --enable-memory64 --enable-multimemory --asyncify --pass-arg=asyncify-in-secondary-memory %s -S -o - | filecheck %s
(module
- (memory i64 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -14,6 +13,9 @@
;; CHECK: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory i64 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify.wast b/test/lit/passes/asyncify.wast
index 968cc5716..71043f2e8 100644
--- a/test/lit/passes/asyncify.wast
+++ b/test/lit/passes/asyncify.wast
@@ -6,7 +6,6 @@
(module
;; CHECK: (type $f (func (param i32)))
(type $f (func (param i32)))
- (memory 1 2)
;; CHECK: (type $1 (func (param i32 i32)))
;; CHECK: (type $2 (func))
@@ -17,15 +16,16 @@
(import "env" "import" (func $import))
;; CHECK: (import "env" "import2" (func $import2 (param i32)))
(import "env" "import2" (func $import2 (param i32)))
- (table funcref (elem $liveness2 $liveness2))
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
- ;; CHECK: (memory $0 1 2)
-
- ;; CHECK: (table $0 2 2 funcref)
+ ;; CHECK: (memory $m 1 2)
+ (memory $m 1 2)
+ ;; CHECK: (table $t 2 2 funcref)
+ (table $t funcref (elem $liveness2 $liveness2))
;; CHECK: (elem $0 (i32.const 0) $liveness2 $liveness2)
;; CHECK: (export "asyncify_start_unwind" (func $asyncify_start_unwind))
diff --git a/test/lit/passes/asyncify_enable-multivalue.wast b/test/lit/passes/asyncify_enable-multivalue.wast
index e5834b114..f29edd4a5 100644
--- a/test/lit/passes/asyncify_enable-multivalue.wast
+++ b/test/lit/passes/asyncify_enable-multivalue.wast
@@ -5,11 +5,12 @@
;; Pre-existing imports that the pass turns into the implementations.
(module
- (memory 1 2)
(import "asyncify" "start_unwind" (func $asyncify_start_unwind (param i32)))
(import "asyncify" "stop_unwind" (func $asyncify_stop_unwind))
(import "asyncify" "start_rewind" (func $asyncify_start_rewind (param i32)))
(import "asyncify" "stop_rewind" (func $asyncify_stop_rewind))
+
+ (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -404,7 +405,6 @@
;; CHECK-NEXT: (global.get $__asyncify_state)
;; CHECK-NEXT: )
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -423,6 +423,8 @@
(import "env" "import3" (func $import3 (param i32)))
;; CHECK: (import "env" "import-mv" (func $import-mv (result i32 i64)))
(import "env" "import-mv" (func $import-mv (result i32 i64)))
+
+ (memory 1 2)
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind.wast b/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind.wast
index dcb4ead34..fda095ad5 100644
--- a/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind.wast
+++ b/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --mod-asyncify-always-and-only-unwind -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (result i32)))
@@ -17,6 +16,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast b/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast
index 7d53b6cbb..99ac2c05f 100644
--- a/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast
+++ b/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --mod-asyncify-always-and-only-unwind -O -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -15,6 +14,10 @@
(import "env" "import" (func $import))
(import "env" "import2" (func $import2 (result i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_mod-asyncify-never-unwind.wast b/test/lit/passes/asyncify_mod-asyncify-never-unwind.wast
index 1ac962eb9..e03a0ad7c 100644
--- a/test/lit/passes/asyncify_mod-asyncify-never-unwind.wast
+++ b/test/lit/passes/asyncify_mod-asyncify-never-unwind.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --mod-asyncify-never-unwind -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (result i32)))
@@ -17,6 +16,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast b/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast
index 112d750ba..38a54ea80 100644
--- a/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast
+++ b/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --mod-asyncify-never-unwind -O -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -15,6 +14,9 @@
(import "env" "import" (func $import))
(import "env" "import2" (func $import2 (result i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_optimize-level=1.wast b/test/lit/passes/asyncify_optimize-level=1.wast
index 0eefc7ffa..d7627f407 100644
--- a/test/lit/passes/asyncify_optimize-level=1.wast
+++ b/test/lit/passes/asyncify_optimize-level=1.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --optimize-level=1 -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -19,6 +18,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast
index 6a0026459..92dbe2bb2 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-addlist@foo -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -13,6 +12,9 @@
;; CHECK: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast
index 217feb358..81107cb16 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-ignore-indirect.wast
@@ -6,15 +6,17 @@
(module
;; CHECK: (type $t (func))
(type $t (func))
- (memory 1 2)
- (table 1 funcref)
- (elem (i32.const 0))
;; CHECK: (type $1 (func (param i32)))
;; CHECK: (type $2 (func (result i32)))
;; CHECK: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory 1 2)
+ (table 1 funcref)
+ (elem (i32.const 0))
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.wast b/test/lit/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.wast
index e86fe988e..8415dfdb7 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.wast
@@ -9,7 +9,6 @@
;; state.
(module
- (memory 1 2)
;; CHECK: (type $f (func))
(type $f (func))
;; CHECK: (type $1 (func (param i32)))
@@ -22,6 +21,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
(table funcref (elem $calls-import2-drop $calls-import2-drop))
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.wast b/test/lit/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.wast
index d89ff3a1a..87e62f4fb 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.wast
@@ -5,7 +5,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-blacklist@@%S/asyncify-foo,bar-nl.txt -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -14,6 +13,8 @@
;; CHECK: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory 1 2)
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast b/test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast
index dc99a09d0..88371e31a 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-ignore-imports -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $f (func))
(type $f (func))
;; CHECK: (type $1 (func (param i32)))
@@ -17,6 +16,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
(table funcref (elem $calls-import2-drop $calls-import2-drop))
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast b/test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast
index 519c6ea2f..af043224a 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-ignore-indirect -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $f (func))
(type $f (func))
;; CHECK: (type $1 (func (param i32)))
@@ -17,6 +16,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
(table funcref (elem $calls-import2-drop $calls-import2-drop))
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast b/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast
index ba781e12a..801ab5eb9 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.wast
@@ -5,10 +5,12 @@
;; Pre-existing imports that the pass turns into the implementations.
(module
- (memory 1 2)
(import "asyncify" "start_unwind" (func $asyncify_start_unwind (param i32)))
(import "asyncify" "start_rewind" (func $asyncify_start_rewind (param i32)))
(import "asyncify" "stop_rewind" (func $asyncify_stop_rewind))
+
+ (memory 1 2)
+
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -400,7 +402,6 @@
;; CHECK-NEXT: (global.get $__asyncify_state)
;; CHECK-NEXT: )
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -415,6 +416,9 @@
(import "env" "import2" (func $import2 (result i32)))
;; CHECK: (import "env" "import3" (func $import3 (param i32)))
(import "env" "import3" (func $import3 (param i32)))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-onlylist@foo,bar.wast b/test/lit/passes/asyncify_pass-arg=asyncify-onlylist@foo,bar.wast
index d5dd3775a..00d257005 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-onlylist@foo,bar.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-onlylist@foo,bar.wast
@@ -5,7 +5,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-onlylist@@%S/asyncify-foo,bar-nl.txt -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -14,6 +13,8 @@
;; CHECK: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory 1 2)
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-verbose.wast b/test/lit/passes/asyncify_pass-arg=asyncify-verbose.wast
index 035c46059..2b463426a 100644
--- a/test/lit/passes/asyncify_pass-arg=asyncify-verbose.wast
+++ b/test/lit/passes/asyncify_pass-arg=asyncify-verbose.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-verbose -S -o - | filecheck %s
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -13,6 +12,9 @@
;; CHECK: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/asyncify_pass-arg=in-secondary-memory.wast b/test/lit/passes/asyncify_pass-arg=in-secondary-memory.wast
index 7772d68f5..64489fb3b 100644
--- a/test/lit/passes/asyncify_pass-arg=in-secondary-memory.wast
+++ b/test/lit/passes/asyncify_pass-arg=in-secondary-memory.wast
@@ -4,7 +4,6 @@
;; RUN: wasm-opt --enable-multimemory --asyncify --pass-arg=asyncify-in-secondary-memory --pass-arg=asyncify-secondary-memory-size@3 %s -S -o - | filecheck %s --check-prefix SIZE
(module
- (memory 1 2)
;; CHECK: (type $0 (func))
;; CHECK: (type $1 (func (param i32)))
@@ -24,6 +23,9 @@
;; SIZE: (import "env" "import" (func $import))
(import "env" "import" (func $import))
+
+ (memory 1 2)
+
;; CHECK: (global $__asyncify_state (mut i32) (i32.const 0))
;; CHECK: (global $__asyncify_data (mut i32) (i32.const 0))
diff --git a/test/lit/passes/cfp.wast b/test/lit/passes/cfp.wast
index 7fb2a7f13..c84eea900 100644
--- a/test/lit/passes/cfp.wast
+++ b/test/lit/passes/cfp.wast
@@ -1461,7 +1461,6 @@
(struct.set $struct2 0
(local.get $struct2)
(i32.const 9999) ;; use a different value here
- (f64.const 0)
)
(drop
(struct.new $struct3
diff --git a/test/lit/passes/coalesce-locals-learning.wast b/test/lit/passes/coalesce-locals-learning.wast
index 5451c68cd..689f7441b 100644
--- a/test/lit/passes/coalesce-locals-learning.wast
+++ b/test/lit/passes/coalesce-locals-learning.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --coalesce-locals-learning -S -o - | filecheck %s
(module
- (memory 10)
;; CHECK: (type $2 (func))
;; CHECK: (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
@@ -18,8 +17,12 @@
(type $3 (func (param i32 f32)))
;; CHECK: (type $4 (func (param i32)))
(type $4 (func (param i32)))
+
;; CHECK: (import "env" "_emscripten_autodebug_i32" (func $_emscripten_autodebug_i32 (param i32 i32) (result i32)))
(import "env" "_emscripten_autodebug_i32" (func $_emscripten_autodebug_i32 (param i32 i32) (result i32)))
+
+ (memory 10)
+
;; CHECK: (memory $0 10)
;; CHECK: (func $nothing-to-do
diff --git a/test/lit/passes/coalesce-locals.wast b/test/lit/passes/coalesce-locals.wast
index 38fefc17a..f195c3681 100644
--- a/test/lit/passes/coalesce-locals.wast
+++ b/test/lit/passes/coalesce-locals.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt --coalesce-locals -S -o - | filecheck %s
(module
- (memory 10)
;; CHECK: (type $2 (func))
;; CHECK: (type $1 (func (result i32)))
@@ -35,6 +34,9 @@
(import "env" "get" (func $get (result i32)))
;; CHECK: (import "env" "set" (func $set (param i32)))
(import "env" "set" (func $set (param i32)))
+
+ (memory 10)
+
;; CHECK: (memory $0 10)
;; CHECK: (func $nothing-to-do
diff --git a/test/lit/passes/directize_all-features.wast b/test/lit/passes/directize_all-features.wast
index 1e46e42c1..c1308faad 100644
--- a/test/lit/passes/directize_all-features.wast
+++ b/test/lit/passes/directize_all-features.wast
@@ -372,6 +372,8 @@
;; CHECK: (type $ii (func (param i32 i32)))
;; IMMUT: (type $ii (func (param i32 i32)))
(type $ii (func (param i32 i32)))
+ (global $g (import "env" "g") i32)
+
;; CHECK: (import "env" "g" (global $g i32))
;; CHECK: (table $0 5 5 funcref)
@@ -379,7 +381,7 @@
;; IMMUT: (table $0 5 5 funcref)
(table $0 5 5 funcref)
- (global $g (import "env" "g") i32)
+
(elem (global.get $g) $foo)
;; CHECK: (elem $0 (global.get $g) $foo)
@@ -421,6 +423,8 @@
;; CHECK: (type $ii (func (param i32 i32)))
;; IMMUT: (type $ii (func (param i32 i32)))
(type $ii (func (param i32 i32)))
+ (global $g (import "env" "g") i32)
+
;; CHECK: (import "env" "g" (global $g i32))
;; CHECK: (table $0 5 5 funcref)
@@ -431,7 +435,7 @@
;; CHECK: (table $1 5 5 funcref)
;; IMMUT: (table $1 5 5 funcref)
(table $1 5 5 funcref)
- (global $g (import "env" "g") i32)
+
(elem (table $1) (global.get $g) func $foo)
;; CHECK: (elem $0 (table $1) (global.get $g) func $foo)
diff --git a/test/lit/passes/flatten_i64-to-i32-lowering.wast b/test/lit/passes/flatten_i64-to-i32-lowering.wast
index d2fc16a58..5a185cc0a 100644
--- a/test/lit/passes/flatten_i64-to-i32-lowering.wast
+++ b/test/lit/passes/flatten_i64-to-i32-lowering.wast
@@ -4,7 +4,6 @@
;; RUN: foreach %s %t wasm-opt -all --flatten --i64-to-i32-lowering -S -o - | filecheck %s
(module
- (memory 1 1)
;; CHECK: (type $0 (func (result i32)))
;; CHECK: (type $1 (func (result i64)))
@@ -13,6 +12,8 @@
;; CHECK: (import "env" "func" (func $import (type $1) (result i64)))
(import "env" "func" (func $import (result i64)))
+
+ (memory 1 1)
;; CHECK: (global $i64toi32_i32$HIGH_BITS (mut i32) (i32.const 0))
;; CHECK: (memory $0 1 1)
diff --git a/test/lit/passes/global-effects.wast b/test/lit/passes/global-effects.wast
index 00c9a77ff..d0d3228df 100644
--- a/test/lit/passes/global-effects.wast
+++ b/test/lit/passes/global-effects.wast
@@ -16,8 +16,6 @@
;; WITHOUT: (type $2 (func (param i32)))
;; WITHOUT: (import "a" "b" (func $import (type $0)))
-
- ;; WITHOUT: (tag $tag)
;; INCLUDE: (type $0 (func))
;; INCLUDE: (type $1 (func (result i32)))
@@ -25,8 +23,6 @@
;; INCLUDE: (type $2 (func (param i32)))
;; INCLUDE: (import "a" "b" (func $import (type $0)))
-
- ;; INCLUDE: (tag $tag)
;; DISCARD: (type $0 (func))
;; DISCARD: (type $1 (func (result i32)))
@@ -34,12 +30,13 @@
;; DISCARD: (type $2 (func (param i32)))
;; DISCARD: (import "a" "b" (func $import (type $0)))
+ (import "a" "b" (func $import))
+ ;; WITHOUT: (tag $tag)
+ ;; INCLUDE: (tag $tag)
;; DISCARD: (tag $tag)
(tag $tag)
- (import "a" "b" (func $import))
-
;; WITHOUT: (func $main (type $0)
;; WITHOUT-NEXT: (call $nop)
;; WITHOUT-NEXT: (call $unreachable)
diff --git a/test/lit/passes/gto-removals.wast b/test/lit/passes/gto-removals.wast
index bcc3f0463..558b0c85f 100644
--- a/test/lit/passes/gto-removals.wast
+++ b/test/lit/passes/gto-removals.wast
@@ -850,7 +850,7 @@
(func $unreachable-set-2 (param $"{mut:i8}" (ref null $"{mut:i8}"))
;; As above, but the side effects now are a br. Again, the br must happen
;; before the trap (in fact, the br will skip the trap here).
- (block
+ (block $block
(struct.set $"{mut:i8}" 0
(local.get $"{mut:i8}")
(br $block)
diff --git a/test/lit/passes/memory-packing_all-features.wast b/test/lit/passes/memory-packing_all-features.wast
index 42e21e32c..8d5089e6f 100644
--- a/test/lit/passes/memory-packing_all-features.wast
+++ b/test/lit/passes/memory-packing_all-features.wast
@@ -5,19 +5,17 @@
(module
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
-
+ (import "env" "memoryBase" (global $memoryBase i32))
;; CHECK: (memory $0 2048 2048)
(memory $0 2048 2048)
- (import "env" "memoryBase" (global $memoryBase i32))
;; nothing
)
(module
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
-
+ (import "env" "memoryBase" (global $memoryBase i32))
;; CHECK: (memory $0 2048 2048)
(memory $0 2048 2048)
- (import "env" "memoryBase" (global $memoryBase i32))
(data (i32.const 4066) "") ;; empty; leave it as is
;; (remove-unused-module-elements handles such
;; things, taking into account possible traps etc.)
@@ -26,10 +24,10 @@
;; CHECK: (data $0 (i32.const 4066) "")
(module
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "memoryBase" (global $memoryBase i32))
;; CHECK: (memory $0 2048 2048)
(memory $0 2048 2048)
- (import "env" "memoryBase" (global $memoryBase i32))
(data (global.get $memoryBase) "waka this cannot be optimized\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00we don't know where it will go")
)
@@ -681,6 +679,7 @@
;; CHECK: (type $0 (func))
;; CHECK: (import "env" "param" (global $param i32))
+ (import "env" "param" (global $param i32))
;; CHECK: (global $__mem_segment_drop_state (mut i32) (i32.const 0))
@@ -700,7 +699,6 @@
;; CHECK: (memory $0 2048 2048)
(memory $0 2048 2048)
- (import "env" "param" (global $param i32))
(data "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00even\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00more\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00zeroes\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") ;; 0
@@ -2232,10 +2230,11 @@
;; CHECK: (data $2 (i32.const 4096) "\00")
(module
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "memoryBase" (global $memoryBase i32))
;; CHECK: (memory $0 1 1)
(memory $0 1 1)
- (import "env" "memoryBase" (global $memoryBase i32))
+
(data (i32.const 1024) "x")
(data (global.get $memoryBase) "\00") ;; this could trample, or not
)
@@ -2244,10 +2243,11 @@
;; CHECK: (data $1 (global.get $memoryBase) "\00")
(module
;; CHECK: (import "env" "memoryBase" (global $memoryBase i32))
+ (import "env" "memoryBase" (global $memoryBase i32))
;; CHECK: (memory $0 1 1)
(memory $0 1 1)
- (import "env" "memoryBase" (global $memoryBase i32))
+
(data (i32.const 1024) "\00") ;; this could trample, or not
(data (global.get $memoryBase) "x")
)
diff --git a/test/lit/passes/monomorphize.wast b/test/lit/passes/monomorphize.wast
index 0974978b9..43208a97d 100644
--- a/test/lit/passes/monomorphize.wast
+++ b/test/lit/passes/monomorphize.wast
@@ -342,8 +342,6 @@
;; ALWAYS: (type $4 (func (param (ref $A))))
;; ALWAYS: (import "a" "b" (func $import (type $2) (param (ref $B))))
-
- ;; ALWAYS: (global $global (mut i32) (i32.const 1))
;; CAREFUL: (type $2 (func (param (ref $B))))
;; CAREFUL: (type $3 (func))
@@ -351,12 +349,12 @@
;; CAREFUL: (type $4 (func (param (ref $A))))
;; CAREFUL: (import "a" "b" (func $import (type $2) (param (ref $B))))
+ (import "a" "b" (func $import (param (ref $B))))
+ ;; ALWAYS: (global $global (mut i32) (i32.const 1))
;; CAREFUL: (global $global (mut i32) (i32.const 1))
(global $global (mut i32) (i32.const 1))
- (import "a" "b" (func $import (param (ref $B))))
-
;; ALWAYS: (func $calls (type $3)
;; ALWAYS-NEXT: (call $refinable
;; ALWAYS-NEXT: (struct.new_default $A)
diff --git a/test/lit/passes/optimize-instructions-ignore-traps.wast b/test/lit/passes/optimize-instructions-ignore-traps.wast
index e594b791c..96ea16449 100644
--- a/test/lit/passes/optimize-instructions-ignore-traps.wast
+++ b/test/lit/passes/optimize-instructions-ignore-traps.wast
@@ -6,12 +6,11 @@
;; CHECK: (type $0 (func (param i32 i32) (result i32)))
(type $0 (func (param i32 i32) (result i32)))
;; CHECK: (import "a" "b" (func $get-i32 (type $2) (result i32)))
+ (import "a" "b" (func $get-i32 (result i32)))
;; CHECK: (memory $0 0)
(memory $0 0)
- (import "a" "b" (func $get-i32 (result i32)))
-
;; CHECK: (func $conditionals (type $0) (param $0 i32) (param $1 i32) (result i32)
;; CHECK-NEXT: (local $2 i32)
;; CHECK-NEXT: (local $3 i32)
diff --git a/test/lit/passes/optimize-instructions-mvp.wast b/test/lit/passes/optimize-instructions-mvp.wast
index 9ac34145c..1575e8d6b 100644
--- a/test/lit/passes/optimize-instructions-mvp.wast
+++ b/test/lit/passes/optimize-instructions-mvp.wast
@@ -2,7 +2,6 @@
;; RUN: wasm-opt %s --optimize-instructions --mvp-features -S -o - | filecheck %s
(module
- (memory 0)
;; CHECK: (type $0 (func (result i32)))
(type $0 (func (param i32 i64)))
@@ -11,6 +10,8 @@
;; CHECK: (import "a" "b" (func $get-f64 (result f64)))
(import "a" "b" (func $get-f64 (result f64)))
+ (memory 0)
+
;; CHECK: (func $and-and (param $i1 i32) (result i32)
;; CHECK-NEXT: (i32.and
;; CHECK-NEXT: (local.get $i1)
diff --git a/test/lit/passes/remove-unused-module-elements-eh-old.wast b/test/lit/passes/remove-unused-module-elements-eh-old.wast
index da6d6ff8a..cd052dbfb 100644
--- a/test/lit/passes/remove-unused-module-elements-eh-old.wast
+++ b/test/lit/passes/remove-unused-module-elements-eh-old.wast
@@ -4,6 +4,8 @@
(module
(type $0 (func (param i32)))
+ (import "env" "e" (tag $e-import (param i32)))
+
;; CHECK-NOT: (tag $e-remove
;; CHECK: (tag $e-export
;; CHECK: (tag $e-throw
@@ -14,7 +16,6 @@
(tag $e-catch (type $0)) ;; cannot be removed (used in catch)
(export "e-export" (tag $e-export))
- (import "env" "e" (tag $e-import (param i32)))
(start $start)
(func $start