diff options
94 files changed, 567 insertions, 1168 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 80d552130..a44aedcef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,13 @@ full changeset diff at the end of each section. Current Trunk ------------- - - (If new wat parser is enabled) Source map comments on `else` branches must - now be placed above the instruction inside the `else` branch rather than on - the `else` branch itself. + - The new, standards-compliant text parser is now the default. `wasm-opt` has a + `--deprecated-wat-parser` flag that will switch back to using the old text + parser, but that option will go away soon. + - Source map comments on `else` branches must now be placed above the + instruction inside the `else` branch rather than on the `else` branch itself. + - Source map locations from instructions are no longer automatically propagated + to function epilogues. - Add a new `BinaryenModuleReadWithFeatures` function to the C API that allows to configure which features to enable in the parser. - The build-time option to use legacy WasmGC opcodes is removed. diff --git a/src/parser/wat-parser.cpp b/src/parser/wat-parser.cpp index cc7d87540..fd18fbbe0 100644 --- a/src/parser/wat-parser.cpp +++ b/src/parser/wat-parser.cpp @@ -96,6 +96,8 @@ void propagateDebugLocations(Module& wasm) { // do not already have their own debug locations. PassRunner runner(&wasm); runner.add("propagate-debug-locs"); + // The parser should not be responsible for validation. + runner.setIsNested(true); runner.run(); } diff --git a/src/wasm/wasm-io.cpp b/src/wasm/wasm-io.cpp index df1cc19f4..324637103 100644 --- a/src/wasm/wasm-io.cpp +++ b/src/wasm/wasm-io.cpp @@ -33,7 +33,7 @@ namespace wasm { -bool useNewWATParser = false; +bool useNewWATParser = true; #define DEBUG_TYPE "writer" diff --git a/test/ctor-eval/bad-indirect-call3.wast.out b/test/ctor-eval/bad-indirect-call3.wast.out index a011ee67d..1d67f0715 100644 --- a/test/ctor-eval/bad-indirect-call3.wast.out +++ b/test/ctor-eval/bad-indirect-call3.wast.out @@ -5,7 +5,7 @@ (memory $0 256 256) (data $0 (i32.const 10) "waka waka waka waka waka") (table $0 1 1 funcref) - (elem $0 (i32.const 0) $callee) + (elem $implicit-elem (i32.const 0) $callee) (export "sig_mismatch" (func $sig_mismatch)) (func $callee (type $0) (param $0 externref) (i32.store8 diff --git a/test/lit/basic/exception-handling-old.wast b/test/lit/basic/exception-handling-old.wast index 5474a4d90..6d6c82e83 100644 --- a/test/lit/basic/exception-handling-old.wast +++ b/test/lit/basic/exception-handling-old.wast @@ -66,7 +66,7 @@ ;; Old Phase 3 exception handling ;; CHECK-TEXT: (func $simple-try-catch (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -106,7 +106,7 @@ ;; CHECK-TEXT: (func $try-catch-multivalue-tag (type $0) ;; CHECK-TEXT-NEXT: (local $x (tuple i32 i64)) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32-i64 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -179,16 +179,16 @@ ) ;; CHECK-TEXT: (func $try-with-block-label (type $0) - ;; CHECK-TEXT-NEXT: (block $l10 + ;; CHECK-TEXT-NEXT: (block $label ;; CHECK-TEXT-NEXT: (try $l1 ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (br $l10) + ;; CHECK-TEXT-NEXT: (br $label) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-i32 ;; CHECK-TEXT-NEXT: (drop ;; CHECK-TEXT-NEXT: (pop i32) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: (br $l10) + ;; CHECK-TEXT-NEXT: (br $label) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -221,7 +221,7 @@ ) ;; CHECK-TEXT: (func $empty-try-body (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) @@ -254,7 +254,7 @@ ) ;; CHECK-TEXT: (func $multiple-insts-within-try-and-catch-bodies (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: (call $bar) @@ -298,7 +298,7 @@ ) ;; CHECK-TEXT: (func $multiple-catches (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -350,7 +350,7 @@ ) ;; CHECK-TEXT: (func $catch-all (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -383,7 +383,7 @@ ) ;; CHECK-TEXT: (func $catch-and-catch-all-together (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -447,9 +447,9 @@ ) ;; CHECK-TEXT: (func $nested-try-catch (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (try $try1 + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -471,7 +471,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (try $try2 + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -563,7 +563,7 @@ ) ;; CHECK-TEXT: (func $catchless-delegateless-try (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -591,13 +591,13 @@ ;; CHECK-TEXT: (func $inner-delegate-target-outer-catch (type $0) ;; CHECK-TEXT-NEXT: (try $l0 ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (delegate $l0) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: (try $try3 + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) @@ -653,20 +653,20 @@ ) ;; CHECK-TEXT: (func $branch-and-delegate-target-same-try-label (type $0) - ;; CHECK-TEXT-NEXT: (block $l05 + ;; CHECK-TEXT-NEXT: (block $label ;; CHECK-TEXT-NEXT: (try $l0 ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (br_if $l05 + ;; CHECK-TEXT-NEXT: (br_if $label ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (delegate $l0) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: (try $try4 + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (br_if $l05 + ;; CHECK-TEXT-NEXT: (br_if $label ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -736,7 +736,7 @@ ;; CHECK-TEXT: (func $inner-delegate-target-outer-delegate (type $0) ;; CHECK-TEXT-NEXT: (try $l0 ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) @@ -778,7 +778,7 @@ ) ;; CHECK-TEXT: (func $empty-catch-body (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) @@ -854,7 +854,7 @@ ) ;; CHECK-TEXT: (func $branch-and-rethrow-target-same-try-label (type $0) - ;; CHECK-TEXT-NEXT: (block $l06 + ;; CHECK-TEXT-NEXT: (block $label ;; CHECK-TEXT-NEXT: (try $l0 ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) @@ -866,7 +866,7 @@ ;; CHECK-TEXT-NEXT: (rethrow $l0) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (br $l06) + ;; CHECK-TEXT-NEXT: (br $label) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -915,7 +915,7 @@ ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) @@ -984,7 +984,7 @@ ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) @@ -1063,7 +1063,7 @@ ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (rethrow $l0) ;; CHECK-TEXT-NEXT: ) @@ -1073,14 +1073,14 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: (try $l07 + ;; CHECK-TEXT-NEXT: (try $l00 ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (call $foo) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all - ;; CHECK-TEXT-NEXT: (try $try8 + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (rethrow $l07) + ;; CHECK-TEXT-NEXT: (rethrow $l00) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch_all ;; CHECK-TEXT-NEXT: (nop) @@ -1152,7 +1152,7 @@ ) ;; CHECK-TEXT: (func $pop-within-if-condition (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) @@ -1212,13 +1212,13 @@ ) ;; CHECK-TEXT: (func $pop-can-be-supertype (type $0) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (catch $e-eqref ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (pop anyref) + ;; CHECK-TEXT-NEXT: (pop eqref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -1249,7 +1249,7 @@ ;; CHECK-TEXT: (func $catchless-try-with-inner-delegate (type $0) ;; CHECK-TEXT-NEXT: (try $label$0 ;; CHECK-TEXT-NEXT: (do - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (throw $e-i32 ;; CHECK-TEXT-NEXT: (i32.const 0) @@ -1295,7 +1295,7 @@ ;; CHECK-TEXT-NEXT: (block $l0 ;; CHECK-TEXT-NEXT: (block $l1 ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: (try $try + ;; CHECK-TEXT-NEXT: (try ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: ) diff --git a/test/lit/basic/extended-names-passive-data-segments.wast b/test/lit/basic/extended-names-passive-data-segments.wast index e2d63ed3f..0380b1056 100644 --- a/test/lit/basic/extended-names-passive-data-segments.wast +++ b/test/lit/basic/extended-names-passive-data-segments.wast @@ -18,7 +18,7 @@ (data $passive_data "b") (data "c") ) -;; CHECK-TEXT: (data $1 "c") +;; CHECK-TEXT: (data $0 "c") ;; CHECK-BIN: (data $1 "c") diff --git a/test/lit/basic/extended-names.wast b/test/lit/basic/extended-names.wast index c89dd0d38..7c398860a 100644 --- a/test/lit/basic/extended-names.wast +++ b/test/lit/basic/extended-names.wast @@ -16,7 +16,7 @@ ;; CHECK-TEXT: (data $passive_data "b") - ;; CHECK-TEXT: (data $2 "c") + ;; CHECK-TEXT: (data $0 "c") ;; CHECK-TEXT: (table $t1 1 funcref) ;; CHECK-BIN: (memory $m1 1 1) diff --git a/test/lit/basic/reference-types.wast b/test/lit/basic/reference-types.wast index 212230ca3..c4bfe8a45 100644 --- a/test/lit/basic/reference-types.wast +++ b/test/lit/basic/reference-types.wast @@ -69,7 +69,7 @@ ;; CHECK-TEXT: (table $0 3 3 funcref) - ;; CHECK-TEXT: (elem $0 (i32.const 0) $take_eqref $take_funcref $take_anyref) + ;; CHECK-TEXT: (elem $implicit-elem (i32.const 0) $take_eqref $take_funcref $take_anyref) ;; CHECK-TEXT: (elem declare func $foo $ref-taken-but-not-in-table) @@ -457,67 +457,67 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in (result eqref) + ;; CHECK-TEXT-NEXT: (loop (result eqref) ;; CHECK-TEXT-NEXT: (local.get $local_eqref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in11 (result eqref) + ;; CHECK-TEXT-NEXT: (loop (result eqref) ;; CHECK-TEXT-NEXT: (global.get $global_eqref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in12 (result eqref) + ;; CHECK-TEXT-NEXT: (loop (result eqref) ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in13 (result funcref) + ;; CHECK-TEXT-NEXT: (loop (result funcref) ;; CHECK-TEXT-NEXT: (local.get $local_funcref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in14 (result funcref) + ;; CHECK-TEXT-NEXT: (loop (result funcref) ;; CHECK-TEXT-NEXT: (global.get $global_funcref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in15 (result funcref) + ;; CHECK-TEXT-NEXT: (loop (result funcref) ;; CHECK-TEXT-NEXT: (ref.null nofunc) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in16 (result funcref) + ;; CHECK-TEXT-NEXT: (loop (result funcref) ;; CHECK-TEXT-NEXT: (ref.func $foo) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in17 (result anyref) + ;; CHECK-TEXT-NEXT: (loop (result anyref) ;; CHECK-TEXT-NEXT: (local.get $local_anyref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in18 (result anyref) + ;; CHECK-TEXT-NEXT: (loop (result anyref) ;; CHECK-TEXT-NEXT: (global.get $global_anyref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in19 (result anyref) + ;; CHECK-TEXT-NEXT: (loop (result anyref) ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in20 (result anyref) + ;; CHECK-TEXT-NEXT: (loop (result anyref) ;; CHECK-TEXT-NEXT: (local.get $local_eqref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in21 (result anyref) + ;; CHECK-TEXT-NEXT: (loop (result anyref) ;; CHECK-TEXT-NEXT: (global.get $global_eqref) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (loop $loop-in22 (result anyref) + ;; CHECK-TEXT-NEXT: (loop (result anyref) ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) @@ -590,7 +590,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (try $try (result eqref) + ;; CHECK-TEXT-NEXT: (try (result eqref) ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (local.get $local_eqref) ;; CHECK-TEXT-NEXT: ) @@ -603,7 +603,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (try $try28 (result funcref) + ;; CHECK-TEXT-NEXT: (try (result funcref) ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (ref.func $foo) ;; CHECK-TEXT-NEXT: ) @@ -616,7 +616,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (try $try29 (result anyref) + ;; CHECK-TEXT-NEXT: (try (result anyref) ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (local.get $local_eqref) ;; CHECK-TEXT-NEXT: ) @@ -629,7 +629,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: ) ;; CHECK-TEXT-NEXT: (drop - ;; CHECK-TEXT-NEXT: (try $try30 (result anyref) + ;; CHECK-TEXT-NEXT: (try (result anyref) ;; CHECK-TEXT-NEXT: (do ;; CHECK-TEXT-NEXT: (ref.null none) ;; CHECK-TEXT-NEXT: ) diff --git a/test/lit/basic/table-operations.wast b/test/lit/basic/table-operations.wast index 3f1e13bea..4ccbe6c6a 100644 --- a/test/lit/basic/table-operations.wast +++ b/test/lit/basic/table-operations.wast @@ -42,9 +42,9 @@ (elem $bar $bar $bar) ) - ;; CHECK-TEXT: (elem $0 (table $table-1) (i32.const 0) func $foo) + ;; CHECK-TEXT: (elem $implicit-elem (table $table-1) (i32.const 0) func $foo) - ;; CHECK-TEXT: (elem $1 (table $table-2) (i32.const 0) func $bar $bar $bar) + ;; CHECK-TEXT: (elem $implicit-elem_1 (table $table-2) (i32.const 0) func $bar $bar $bar) ;; CHECK-TEXT: (func $foo (type $0) ;; CHECK-TEXT-NEXT: (nop) diff --git a/test/lit/basic/tags.wast b/test/lit/basic/tags.wast index 8e314af0b..cd0615eab 100644 --- a/test/lit/basic/tags.wast +++ b/test/lit/basic/tags.wast @@ -25,9 +25,9 @@ ;; CHECK-TEXT: (import "env" "im0" (tag $e-import (param i32))) - ;; CHECK-TEXT: (import "env" "im1" (tag $eimport$1 (param i32 f32))) + ;; CHECK-TEXT: (import "env" "im1" (tag $timport$0 (param i32 f32))) - ;; CHECK-TEXT: (tag $2 (param i32)) + ;; CHECK-TEXT: (tag $1 (param i32)) ;; CHECK-TEXT: (tag $e (param i32 f32)) ;; CHECK-BIN: (type $0 (func (param i32 f32))) diff --git a/test/lit/basic/types-function-references.wast b/test/lit/basic/types-function-references.wast index c1687c706..b85e1f422 100644 --- a/test/lit/basic/types-function-references.wast +++ b/test/lit/basic/types-function-references.wast @@ -16,18 +16,6 @@ ;; CHECK-BIN: (type $void (func)) (type $void (func)) ;; inline ref type in result - ;; CHECK-BIN: (type $i32-i32 (func (param i32) (result i32))) - - ;; CHECK-BIN: (type $3 (func (result i32 (ref null $mixed_results) f64))) - - ;; CHECK-BIN: (type $4 (func (param (ref $i32-i32)) (result i32))) - - ;; CHECK-BIN: (type $5 (func (param (ref null $i32-i32)) (result i32))) - - ;; CHECK-BIN: (type $6 (func (result i32))) - - ;; CHECK-BIN: (type $_=>_eqref (func (result eqref))) - (type $_=>_eqref (func (result eqref))) ;; CHECK-TEXT: (type $i32-i32 (func (param i32) (result i32))) ;; CHECK-TEXT: (type $mixed_results (func (result anyref f32 anyref f32))) @@ -40,9 +28,21 @@ ;; CHECK-TEXT: (type $6 (func (result i32))) - ;; CHECK-TEXT: (type $=>eqref (func (result eqref))) + ;; CHECK-TEXT: (type $_=>_eqref (func (result eqref))) + ;; CHECK-BIN: (type $i32-i32 (func (param i32) (result i32))) + + ;; CHECK-BIN: (type $3 (func (result i32 (ref null $mixed_results) f64))) + + ;; CHECK-BIN: (type $4 (func (param (ref $i32-i32)) (result i32))) + + ;; CHECK-BIN: (type $5 (func (param (ref null $i32-i32)) (result i32))) + + ;; CHECK-BIN: (type $6 (func (result i32))) + + ;; CHECK-BIN: (type $_=>_eqref (func (result eqref))) + (type $_=>_eqref (func (result eqref))) - ;; CHECK-TEXT: (type $f64_=>_ref_null<_->_eqref> (func (param f64) (result (ref null $=>eqref)))) + ;; CHECK-TEXT: (type $f64_=>_ref_null<_->_eqref> (func (param f64) (result (ref null $_=>_eqref)))) ;; CHECK-BIN: (type $f64_=>_ref_null<_->_eqref> (func (param f64) (result (ref null $_=>_eqref)))) (type $f64_=>_ref_null<_->_eqref> (func (param f64) (result (ref null $_=>_eqref)))) (type $=>eqref (func (result eqref))) @@ -162,7 +162,7 @@ (call_ref $i32-i32 (i32.const 42) (local.get $f)) ) - ;; CHECK-TEXT: (func $ref-in-sig (type $f64_=>_ref_null<_->_eqref>) (param $0 f64) (result (ref null $=>eqref)) + ;; CHECK-TEXT: (func $ref-in-sig (type $f64_=>_ref_null<_->_eqref>) (param $0 f64) (result (ref null $_=>_eqref)) ;; CHECK-TEXT-NEXT: (ref.null nofunc) ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (func $ref-in-sig (type $f64_=>_ref_null<_->_eqref>) (param $0 f64) (result (ref null $_=>_eqref)) diff --git a/test/lit/basic/unit.wat b/test/lit/basic/unit.wat index 9cdcb5792..5846febd5 100644 --- a/test/lit/basic/unit.wat +++ b/test/lit/basic/unit.wat @@ -1617,7 +1617,7 @@ ) ;; CHECK-TEXT: (func $unreachable-loop (type $5) (result i32) ;; CHECK-TEXT-NEXT: (f64.abs - ;; CHECK-TEXT-NEXT: (loop $loop-in + ;; CHECK-TEXT-NEXT: (loop ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: (return ;; CHECK-TEXT-NEXT: (i32.const 1) @@ -1643,7 +1643,7 @@ ) ;; CHECK-TEXT: (func $unreachable-loop0 (type $5) (result i32) ;; CHECK-TEXT-NEXT: (f64.abs - ;; CHECK-TEXT-NEXT: (loop $loop-in + ;; CHECK-TEXT-NEXT: (loop ;; CHECK-TEXT-NEXT: (return ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) @@ -1665,7 +1665,7 @@ ) ) ;; CHECK-TEXT: (func $unreachable-loop-toplevel (type $5) (result i32) - ;; CHECK-TEXT-NEXT: (loop $loop-in + ;; CHECK-TEXT-NEXT: (loop ;; CHECK-TEXT-NEXT: (nop) ;; CHECK-TEXT-NEXT: (return ;; CHECK-TEXT-NEXT: (i32.const 1) @@ -1687,7 +1687,7 @@ ) ) ;; CHECK-TEXT: (func $unreachable-loop0-toplevel (type $5) (result i32) - ;; CHECK-TEXT-NEXT: (loop $loop-in + ;; CHECK-TEXT-NEXT: (loop ;; CHECK-TEXT-NEXT: (return ;; CHECK-TEXT-NEXT: (i32.const 1) ;; CHECK-TEXT-NEXT: ) diff --git a/test/lit/ctor-eval/return_call.wast b/test/lit/ctor-eval/return_call.wast index 3ff35ec42..d3bf96f27 100644 --- a/test/lit/ctor-eval/return_call.wast +++ b/test/lit/ctor-eval/return_call.wast @@ -86,7 +86,7 @@ (call $import) ) - ;; CHECK: (elem $0 (i32.const 0) $test2) + ;; CHECK: (elem $implicit-elem (i32.const 0) $test2) ;; CHECK: (export "g1" (global $g1)) diff --git a/test/lit/debug/full.wat b/test/lit/debug/full.wat index e8e0b9a9b..3ea861611 100644 --- a/test/lit/debug/full.wat +++ b/test/lit/debug/full.wat @@ -25,7 +25,6 @@ ;; NRML-NEXT: (i32.const 2) ;; NRML-NEXT: ) ;; NRML-NEXT: ) - ;; NRML-NEXT: ;;@ src.cpp:1:2 ;; NRML-NEXT: ) ;; FULL: (func $a ;; FULL-NEXT: [none] ;;@ src.cpp:1:2 @@ -46,7 +45,6 @@ ;; FULL-NEXT: (i32.const 2) ;; FULL-NEXT: ) ;; FULL-NEXT: ) ;; end block block - ;; FULL-NEXT: ;;@ src.cpp:1:2 ;; FULL-NEXT: ) (func $a ;;@ src.cpp:1:2 diff --git a/test/lit/debug/replace-keep.wat b/test/lit/debug/replace-keep.wat index cfd8e1ced..4c073aeab 100644 --- a/test/lit/debug/replace-keep.wat +++ b/test/lit/debug/replace-keep.wat @@ -50,7 +50,6 @@ ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; end block - ;; CHECK-NEXT: ;;@ src.cpp:200:2 ;; CHECK-NEXT: ) (func $test-no-trample (local $temp i32) diff --git a/test/lit/exec/strings.wast b/test/lit/exec/strings.wast index d2bf39191..0d5bb7dc4 100644 --- a/test/lit/exec/strings.wast +++ b/test/lit/exec/strings.wast @@ -5,10 +5,10 @@ (module (type $array16 (array (mut i16))) - (memory 1 1) - (import "fuzzing-support" "log-i32" (func $log (param i32))) + (memory 1 1) + ;; CHECK: [fuzz-exec] calling new_wtf16_array ;; CHECK-NEXT: [fuzz-exec] note result: new_wtf16_array => string("ello") (func $new_wtf16_array (export "new_wtf16_array") (result stringref) diff --git a/test/lit/gc-eh-old.wast b/test/lit/gc-eh-old.wast index 6ff712e18..2c12cec49 100644 --- a/test/lit/gc-eh-old.wast +++ b/test/lit/gc-eh-old.wast @@ -14,7 +14,7 @@ (tag $tagA (param (ref $A))) ;; CHECK: (func $foo (type $2) (result (ref null $A)) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/if-then-else.wast b/test/lit/if-then-else.wast index 7fa59fad0..c1247af96 100644 --- a/test/lit/if-then-else.wast +++ b/test/lit/if-then-else.wast @@ -7,6 +7,7 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (then + ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else ;; CHECK-NEXT: (return @@ -22,6 +23,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (else + ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return diff --git a/test/lit/merge/fusing.wat b/test/lit/merge/fusing.wat index a1ac3a2c7..e074d30ba 100644 --- a/test/lit/merge/fusing.wat +++ b/test/lit/merge/fusing.wat @@ -40,20 +40,20 @@ ;; CHECK: (export "keepalive" (func $keepalive)) - ;; CHECK: (export "mem" (memory $first.mem)) - ;; CHECK: (export "exn" (tag $exn)) - ;; CHECK: (export "mem_5" (memory $second.mem)) + ;; CHECK: (export "mem" (memory $first.mem)) - ;; CHECK: (export "foo_6" (func $second.foo)) + ;; CHECK: (export "foo_5" (func $second.foo)) - ;; CHECK: (export "bar_7" (func $bar_6)) + ;; CHECK: (export "bar_6" (func $bar_6)) ;; CHECK: (export "keepalive2" (func $keepalive2)) ;; CHECK: (export "keepalive3" (func $keepalive3)) + ;; CHECK: (export "mem_9" (memory $second.mem)) + ;; CHECK: (func $first.foo (type $0) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 1) diff --git a/test/lit/merge/names.wat b/test/lit/merge/names.wat index 24b1dab0d..4562af58b 100644 --- a/test/lit/merge/names.wat +++ b/test/lit/merge/names.wat @@ -44,10 +44,6 @@ ;; CHECK: (tag $tag$3) - ;; CHECK: (export "m0" (memory $mem0)) - - ;; CHECK: (export "m1" (memory $1)) - ;; CHECK: (export "f0" (func $func0)) ;; CHECK: (export "f1" (func $1)) @@ -60,16 +56,16 @@ ;; CHECK: (export "g1" (global $global$2)) + ;; CHECK: (export "m0" (memory $mem0)) + + ;; CHECK: (export "m1" (memory $1)) + ;; CHECK: (export "tag0" (tag $tag0)) ;; CHECK: (export "tag1" (tag $tag$1)) ;; CHECK: (export "func" (func $2)) - ;; CHECK: (export "m2" (memory $mem2)) - - ;; CHECK: (export "m3" (memory $3)) - ;; CHECK: (export "f2" (func $func2)) ;; CHECK: (export "f3" (func $4)) @@ -78,6 +74,10 @@ ;; CHECK: (export "t3" (table $3)) + ;; CHECK: (export "m2" (memory $mem2)) + + ;; CHECK: (export "m3" (memory $3)) + ;; CHECK: (export "g2" (global $glob2)) ;; CHECK: (export "g3" (global $global$0)) @@ -97,8 +97,8 @@ (table $table0 (export "t0") 1 funcref) (table (export "t1") 1 funcref) - (global $glob0 (export g0) i32 (i32.const 0)) - (global (export g1) i32 (i32.const 0)) + (global $glob0 (export "g0") i32 (i32.const 0)) + (global (export "g1") i32 (i32.const 0)) (memory $mem0 (export "m0") 0) (memory (export "m1") 0) @@ -109,8 +109,8 @@ (data $data0 "") (data "") - (tag $tag0 (export tag0)) - (tag (export tag1)) + (tag $tag0 (export "tag0")) + (tag (export "tag1")) (type $t (struct (field $a i32) (field $b i32))) diff --git a/test/lit/merge/names.wat.second b/test/lit/merge/names.wat.second index 4aed55d53..9f4fef1d7 100644 --- a/test/lit/merge/names.wat.second +++ b/test/lit/merge/names.wat.second @@ -9,8 +9,8 @@ (memory $mem2 (export "m2") 0) (memory (export "m3") 0) - (global $glob2 (export g2) i32 (i32.const 0)) - (global (export g3) i32 (i32.const 0)) + (global $glob2 (export "g2") i32 (i32.const 0)) + (global (export "g3") i32 (i32.const 0)) (elem $elem2 func) (elem func) @@ -18,8 +18,8 @@ (data $data2 "") (data "") - (tag $tag2 (export tag2)) - (tag (export tag3)) + (tag $tag2 (export "tag2")) + (tag (export "tag3")) (type $u (struct (field $c i64) (field $d i32))) diff --git a/test/lit/merge/renamings.wat b/test/lit/merge/renamings.wat index 98aac63be..4d1c32c5a 100644 --- a/test/lit/merge/renamings.wat +++ b/test/lit/merge/renamings.wat @@ -140,7 +140,7 @@ ) ;; CHECK: (func $uses (type $3) (param $array (ref $array)) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -150,7 +150,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -290,7 +290,7 @@ ;; CHECK-NEXT: ) ;; CHECK: (func $uses.second (type $3) (param $array (ref $array)) -;; CHECK-NEXT: (try $try +;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -300,7 +300,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK-NEXT: (try $try0 +;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/parse-bad-nominal-types.wast b/test/lit/parse-bad-nominal-types.wast index 378232adf..1801f13aa 100644 --- a/test/lit/parse-bad-nominal-types.wast +++ b/test/lit/parse-bad-nominal-types.wast @@ -2,17 +2,17 @@ ;; RUN: foreach %s %t not wasm-opt -all 2>&1 | filecheck %s -;; CHECK: [parse exception: unknown supertype: ( type $bad-func ( sub $bad ( func ) ) ) (at 2:24)] +;; CHECK: 2:28: error: unknown type identifier (module (type $bad-func (sub $bad (func))) ) -;; CHECK: [parse exception: unknown supertype: ( type $bad-struct ( sub $bad ( struct ) ) ) (at 2:26)] +;; CHECK: 2:30: error: unknown type identifier (module (type $bad-struct (sub $bad (struct))) ) -;; CHECK: [parse exception: unknown supertype: ( type $bad-array ( sub $bad ( array i32 ) ) ) (at 2:25)] +;; CHECK: 2:29: error: unknown type identifier (module (type $bad-array (sub $bad (array i32))) ) diff --git a/test/lit/parse-bad-supertype.wast b/test/lit/parse-bad-supertype.wast index 10e8589fa..8612bee27 100644 --- a/test/lit/parse-bad-supertype.wast +++ b/test/lit/parse-bad-supertype.wast @@ -2,7 +2,7 @@ ;; RUN: not wasm-opt %s -all 2>&1 | filecheck %s -;; CHECK: Fatal: Invalid type: Heap type has an invalid supertype at type $sub +;; CHECK: Fatal: 8:2: error: invalid type: Heap type has an invalid supertype (module (type $super (sub (struct i32))) (type $sub (sub $super (struct i64))) diff --git a/test/lit/parse-bad-tuple-extract-index.wast b/test/lit/parse-bad-tuple-extract-index.wast index 5375d2d2b..ac20c5c43 100644 --- a/test/lit/parse-bad-tuple-extract-index.wast +++ b/test/lit/parse-bad-tuple-extract-index.wast @@ -2,7 +2,7 @@ ;; RUN: not wasm-opt %s 2>&1 | filecheck %s -;; CHECK: [parse exception: Bad index on tuple.extract: ( tuple.extract 2 2 ( tuple.make 2 ( i32.const 0 ) ( i64.const 1 ) ) ) (at 9:19)] +;; CHECK: Fatal: 9:3: error: tuple index out of bounds (module (func diff --git a/test/lit/parse-error.wast b/test/lit/parse-error.wast index c301103b2..c6aeb42ad 100644 --- a/test/lit/parse-error.wast +++ b/test/lit/parse-error.wast @@ -1,7 +1,7 @@ ;; Test that parse errors have helpful messages ;; RUN: not wasm-opt %s 2>&1 | filecheck %s -;; CHECK: [parse exception: abc (at 8:4)] +;; CHECK: Fatal: 8:5: error: unrecognized instruction (module (func $foo diff --git a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast index 87dec51e3..7037baf7d 100644 --- a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast +++ b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast @@ -8,8 +8,6 @@ (type $t0 (func (param i32) (result i32))) ;; CHECK: (memory $memory 0) - ;; CHECK: (export "memory" (memory $memory)) - ;; CHECK: (export "fib" (func $fib)) ;; CHECK: (export "looped" (func $looped)) @@ -22,6 +20,8 @@ ;; CHECK: (export "t3" (func $t3)) + ;; CHECK: (export "memory" (memory $memory)) + ;; CHECK: (func $fib (; has Stack IR ;) (param $0 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.le_s diff --git a/test/lit/passes/asyncify-wasm64.wast b/test/lit/passes/asyncify-wasm64.wast index 94cdf0347..e61364a9b 100644 --- a/test/lit/passes/asyncify-wasm64.wast +++ b/test/lit/passes/asyncify-wasm64.wast @@ -29,7 +29,7 @@ ;; CHECK: (table $0 2 2 funcref) - ;; CHECK: (elem $0 (i32.const 0) $liveness2 $liveness2) + ;; CHECK: (elem $implicit-elem (i32.const 0) $liveness2 $liveness2) ;; CHECK: (export "asyncify_start_unwind" (func $asyncify_start_unwind)) diff --git a/test/lit/passes/asyncify.wast b/test/lit/passes/asyncify.wast index 71043f2e8..703ef0fb6 100644 --- a/test/lit/passes/asyncify.wast +++ b/test/lit/passes/asyncify.wast @@ -26,7 +26,7 @@ ;; CHECK: (table $t 2 2 funcref) (table $t funcref (elem $liveness2 $liveness2)) - ;; CHECK: (elem $0 (i32.const 0) $liveness2 $liveness2) + ;; CHECK: (elem $implicit-elem (i32.const 0) $liveness2 $liveness2) ;; CHECK: (export "asyncify_start_unwind" (func $asyncify_start_unwind)) diff --git a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast index adef11937..b0b758b49 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-addlist@foo_pass-arg=asyncify-propagate-addlist.wast @@ -4,7 +4,6 @@ ;; RUN: foreach %s %t wasm-opt --asyncify --pass-arg=asyncify-addlist@foo -S --pass-arg=asyncify-propagate-addlist -o - | filecheck %s (module - (memory 1 2) ;; CHECK: (type $0 (func)) ;; CHECK: (type $1 (func (param i32))) @@ -13,6 +12,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-asserts_pass-arg=asyncify-onlylist@waka.wast b/test/lit/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.wast index 8415dfdb7..d5dc9ff9b 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 @@ -33,7 +33,7 @@ ;; CHECK: (table $0 2 2 funcref) - ;; CHECK: (elem $0 (i32.const 0) $calls-import2-drop $calls-import2-drop) + ;; CHECK: (elem $implicit-elem (i32.const 0) $calls-import2-drop $calls-import2-drop) ;; CHECK: (export "asyncify_start_unwind" (func $asyncify_start_unwind)) 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 88371e31a..8766276e5 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-ignore-imports.wast @@ -28,7 +28,7 @@ ;; CHECK: (table $0 2 2 funcref) - ;; CHECK: (elem $0 (i32.const 0) $calls-import2-drop $calls-import2-drop) + ;; CHECK: (elem $implicit-elem (i32.const 0) $calls-import2-drop $calls-import2-drop) ;; CHECK: (export "asyncify_start_unwind" (func $asyncify_start_unwind)) 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 af043224a..8ff747646 100644 --- a/test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast +++ b/test/lit/passes/asyncify_pass-arg=asyncify-ignore-indirect.wast @@ -28,7 +28,7 @@ ;; CHECK: (table $0 2 2 funcref) - ;; CHECK: (elem $0 (i32.const 0) $calls-import2-drop $calls-import2-drop) + ;; CHECK: (elem $implicit-elem (i32.const 0) $calls-import2-drop $calls-import2-drop) ;; CHECK: (export "asyncify_start_unwind" (func $asyncify_start_unwind)) diff --git a/test/lit/passes/catch-pop-fixup-eh-old.wast b/test/lit/passes/catch-pop-fixup-eh-old.wast deleted file mode 100644 index 50aa7f7ba..000000000 --- a/test/lit/passes/catch-pop-fixup-eh-old.wast +++ /dev/null @@ -1,400 +0,0 @@ -;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. -;; We run wasm-opt with --no-validation because functions in this file contain -;; 'pop's in invalid positions and the objective of this test is to fix them. -;; But wasm-opt runs validation after reading functions, so we need to disable -;; it to proceed. -;; RUN: wasm-opt %s --catch-pop-fixup --no-validation -all -S -o - | filecheck %s - -(module - ;; CHECK: (type $struct.A (struct (field i32))) - - ;; CHECK: (tag $e-i32 (param i32)) - (tag $e-i32 (param i32)) - ;; CHECK: (tag $e-i32-f32 (param i32 f32)) - (tag $e-i32-f32 (param i32 f32)) - - (type $struct.A (struct i32)) - ;; CHECK: (tag $e-struct.A (param (ref $struct.A))) - (tag $e-struct.A (param (ref $struct.A))) - - ;; CHECK: (func $pop-within-block1 (type $0) - ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (throw $e-i32 - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-block1 - (try - (do) - (catch $e-i32 - (throw $e-i32 - ;; The pop is within a block, so it will be handled - (block (result i32) - (pop i32) - ) - ) - ) - ) - ) - - ;; CHECK: (func $pop-within-block2 (type $0) - ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (throw $e-i32 - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-block2 - (try - (do) - (catch $e-i32 - (throw $e-i32 - ;; More nesting of blocks can be handled too - (block (result i32) - (block (result i32) - (block (result i32) - (block (result i32) - (block (result i32) - (pop i32) - ) - ) - ) - ) - ) - ) - ) - ) - ) - - ;; CHECK: (func $pop-within-block3 (type $1) (result i32) - ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try (result i32) - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $l0 (result i32) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (br $l0 - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-block3 (result i32) - (try (result i32) - (do - (i32.const 0) - ) - (catch $e-i32 - ;; This block cannot be deleted when written back because there is a - ;; branch targeting this block. So the pop inside will be handled. - (block $l0 (result i32) - (drop - (pop i32) - ) - (br $l0 - (i32.const 0) - ) - ) - ) - ) - ) - - ;; CHECK: (func $helper (type $0) - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - (func $helper) - ;; CHECK: (func $pop-within-implicit-block1 (type $0) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (call $helper) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-implicit-block1 - (try - (do) - (catch $e-i32 - ;; Because this catch contains multiple instructions, an implicit - ;; block will be created within the catch when parsed. But that block - ;; will be deleted when written back, so this pop is not considered - ;; nested in a block. - (drop - (pop i32) - ) - (call $helper) - ) - ) - ) - - ;; CHECK: (func $pop-within-implicit-block2 (type $0) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (call $helper) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-implicit-block2 - (try - (do) - (catch $e-i32 - ;; In this case we explicitly wrap the pop with a 'block', but this - ;; block doesn't have any targeting branches, it will be also deleted - ;; when written back to binary. So this pop is fine and not considered - ;; nested in a block. - (block - (drop - (pop i32) - ) - (call $helper) - ) - ) - ) - ) - - ;; CHECK: (func $pop-within-try (type $1) (result i32) - ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try (result i32) - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try4 (result i32) - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-try (result i32) - (try (result i32) - (do - (i32.const 0) - ) - (catch $e-i32 - ;; The pop is wihtin a try, so it will be handled - (try (result i32) - (do - (pop i32) - ) - (catch_all - (i32.const 0) - ) - ) - ) - ) - ) - - ;; CHECK: (func $pop-within-if-condition (type $1) (result i32) - ;; CHECK-NEXT: (try $try (result i32) - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (if (result i32) - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (i32.const 1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-if-condition (result i32) - (try (result i32) - (do - (i32.const 0) - ) - (catch $e-i32 - ;; The pop is wihtin an if condition, which is considered not nested. - ;; This will be not handled. - (if (result i32) - (pop i32) - (then (i32.const 1)) - (else (i32.const 0)) - ) - ) - ) - ) - - ;; CHECK: (func $pop-within-block-within-if-condition (type $0) - ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32 - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (pop i32) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $l0 - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (if (result i32) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (i32.const 1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (else - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (br $l0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-within-block-within-if-condition - (try - (do) - (catch $e-i32 - ;; This block cannot be removed because there is a branch targeting - ;; this. This pop should be handled because the whole 'if' is nested - ;; within the block. - (block $l0 - (drop - (if (result i32) - (pop i32) - (then (i32.const 1)) - (else (i32.const 0)) - ) - ) - (br $l0) - ) - ) - ) - ) - - ;; CHECK: (func $pop-tuple-within-block (type $0) - ;; CHECK-NEXT: (local $x (tuple i32 f32)) - ;; CHECK-NEXT: (local $1 (tuple i32 f32)) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-i32-f32 - ;; CHECK-NEXT: (local.set $1 - ;; CHECK-NEXT: (pop (tuple i32 f32)) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (throw $e-i32 - ;; CHECK-NEXT: (block (result i32) - ;; CHECK-NEXT: (local.set $x - ;; CHECK-NEXT: (local.get $1) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-tuple-within-block (local $x (tuple i32 f32)) - (try - (do) - (catch $e-i32-f32 - (throw $e-i32 - ;; This tests a pop taking a tuple type. - (block (result i32) - (local.set $x (pop (tuple i32 f32))) - (i32.const 0) - ) - ) - ) - ) - ) - - ;; CHECK: (func $pop-non-defaultable-type-within-block (type $0) - ;; CHECK-NEXT: (local $0 (ref $struct.A)) - ;; CHECK-NEXT: (try $try - ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (catch $e-struct.A - ;; CHECK-NEXT: (local.set $0 - ;; CHECK-NEXT: (pop (ref $struct.A)) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (throw $e-struct.A - ;; CHECK-NEXT: (block (result (ref $struct.A)) - ;; CHECK-NEXT: (local.get $0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - (func $pop-non-defaultable-type-within-block - (try - (do) - (catch $e-struct.A - (throw $e-struct.A - ;; The pop is within a block, so it will be handled. But because this - ;; pop is of non-defaultable type, we have to fix it up using - ;; TypeUpdating::handleNonDefaultableLocals: the new local created is - ;; converted to (ref null $struct.A) type and we read the local using - ;; 'ref.as_non_null'. - (block (result (ref $struct.A)) - (pop (ref $struct.A)) - ) - ) - ) - ) - ) -) diff --git a/test/lit/passes/coalesce-locals-eh-old.wast b/test/lit/passes/coalesce-locals-eh-old.wast index 3acbda064..63b1445dd 100644 --- a/test/lit/passes/coalesce-locals-eh-old.wast +++ b/test/lit/passes/coalesce-locals-eh-old.wast @@ -18,7 +18,7 @@ (tag $any (param (ref any))) ;; CHECK: (func $bug-cfg-traversal (type $3) (param $0 i32) (result i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (call $bar) @@ -50,7 +50,7 @@ ;; CHECK: (func $0 (type $0) ;; CHECK-NEXT: (local $0 anyref) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/coalesce-locals.wast b/test/lit/passes/coalesce-locals.wast index 5441c3fd6..422c06a81 100644 --- a/test/lit/passes/coalesce-locals.wast +++ b/test/lit/passes/coalesce-locals.wast @@ -2099,8 +2099,8 @@ ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $z14 - ;; CHECK-NEXT: (br_table $z14 $z14 + ;; CHECK-NEXT: (block $z0 + ;; CHECK-NEXT: (br_table $z0 $z0 ;; CHECK-NEXT: (i32.const 100) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/code-pushing-eh-old.wast b/test/lit/passes/code-pushing-eh-old.wast index bfda0dd16..8fc0d423d 100644 --- a/test/lit/passes/code-pushing-eh-old.wast +++ b/test/lit/passes/code-pushing-eh-old.wast @@ -73,7 +73,7 @@ ;; CHECK: (func $can-push-past-try (type $0) ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (block $out - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -126,7 +126,7 @@ ;; CHECK-NEXT: (local.set $x ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: ) @@ -219,7 +219,7 @@ ;; CHECK-NEXT: (block $out ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -277,7 +277,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: (try $l ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) diff --git a/test/lit/passes/dce-eh-old.wast b/test/lit/passes/dce-eh-old.wast index b6e44bd62..120ec4e11 100644 --- a/test/lit/passes/dce-eh-old.wast +++ b/test/lit/passes/dce-eh-old.wast @@ -16,7 +16,7 @@ (func $foo) ;; CHECK: (func $try_unreachable (type $0) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) @@ -37,7 +37,7 @@ ) ;; CHECK: (func $catch_unreachable (type $0) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -58,7 +58,7 @@ ) ;; CHECK: (func $both_unreachable (type $0) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) @@ -136,7 +136,7 @@ ;; CHECK: (func $call-pop-catch (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (block $label - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/dce_all-features.wast b/test/lit/passes/dce_all-features.wast index 25657a764..e5e0f9ca4 100644 --- a/test/lit/passes/dce_all-features.wast +++ b/test/lit/passes/dce_all-features.wast @@ -50,18 +50,18 @@ ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then - ;; CHECK-NEXT: (block $out3 + ;; CHECK-NEXT: (block $out1 ;; CHECK-NEXT: (return) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $out4 - ;; CHECK-NEXT: (br_table $out4 $out4 $out4 $out4 + ;; CHECK-NEXT: (block $out2 + ;; CHECK-NEXT: (br_table $out2 $out2 $out2 $out2 ;; CHECK-NEXT: (i32.const 4) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $out5 - ;; CHECK-NEXT: (br_if $out5 + ;; CHECK-NEXT: (block $out3 + ;; CHECK-NEXT: (br_if $out3 ;; CHECK-NEXT: (i32.const 3) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop @@ -102,9 +102,9 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $out16 + ;; CHECK-NEXT: (block $out9 ;; CHECK-NEXT: (block $in - ;; CHECK-NEXT: (br_if $out16 + ;; CHECK-NEXT: (br_if $out9 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -114,9 +114,9 @@ ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (block $block11 - ;; CHECK-NEXT: (block $out18 - ;; CHECK-NEXT: (block $in19 - ;; CHECK-NEXT: (br_if $in19 + ;; CHECK-NEXT: (block $out10 + ;; CHECK-NEXT: (block $in0 + ;; CHECK-NEXT: (br_if $in0 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -125,17 +125,17 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $out20 - ;; CHECK-NEXT: (block $in21 - ;; CHECK-NEXT: (br_table $out20 $in21 + ;; CHECK-NEXT: (block $out11 + ;; CHECK-NEXT: (block $in1 + ;; CHECK-NEXT: (br_table $out11 $in1 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $out22 - ;; CHECK-NEXT: (block $in23 - ;; CHECK-NEXT: (br_table $in23 $out22 + ;; CHECK-NEXT: (block $out12 + ;; CHECK-NEXT: (block $in2 + ;; CHECK-NEXT: (br_table $in2 $out12 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -145,9 +145,9 @@ ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (block $block13 - ;; CHECK-NEXT: (block $out25 - ;; CHECK-NEXT: (block $in26 - ;; CHECK-NEXT: (br_table $in26 $in26 + ;; CHECK-NEXT: (block $out13 + ;; CHECK-NEXT: (block $in3 + ;; CHECK-NEXT: (br_table $in3 $in3 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -176,9 +176,9 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (block $out29 - ;; CHECK-NEXT: (loop $in30 - ;; CHECK-NEXT: (br_if $out29 + ;; CHECK-NEXT: (block $out14 + ;; CHECK-NEXT: (loop $in4 + ;; CHECK-NEXT: (br_if $out14 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) @@ -188,8 +188,8 @@ ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then ;; CHECK-NEXT: (block $block20 - ;; CHECK-NEXT: (loop $in32 - ;; CHECK-NEXT: (br_if $in32 + ;; CHECK-NEXT: (loop $in5 + ;; CHECK-NEXT: (br_if $in5 ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) @@ -1500,7 +1500,7 @@ ) ) ;; CHECK: (func $unnecessary-concrete-try (type $0) (result i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) @@ -1645,7 +1645,7 @@ ) ;; CHECK: (func $try (type $0) (result anyref) - ;; CHECK-NEXT: (try $try (result i31ref) + ;; CHECK-NEXT: (try (result i31ref) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (call $try) diff --git a/test/lit/passes/flatten-eh-old.wast b/test/lit/passes/flatten-eh-old.wast index c092dd212..56057b779 100644 --- a/test/lit/passes/flatten-eh-old.wast +++ b/test/lit/passes/flatten-eh-old.wast @@ -11,7 +11,7 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 f32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e-i32 ;; CHECK-NEXT: (i32.const 0) @@ -59,7 +59,7 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (block $l0 - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -105,7 +105,7 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (i32.const 0) @@ -142,7 +142,7 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (unreachable) @@ -181,7 +181,7 @@ ;; CHECK-NEXT: (local $3 i32) ;; CHECK-NEXT: (local $4 i32) ;; CHECK-NEXT: (local $5 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $3 ;; CHECK-NEXT: (i32.const 3) diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast index 2ba7c6954..5db45e272 100644 --- a/test/lit/passes/flatten_all-features.wast +++ b/test/lit/passes/flatten_all-features.wast @@ -1218,9 +1218,8 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (return) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (unreachable) @@ -2641,7 +2640,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $9) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in + ;; CHECK-NEXT: (loop ;; CHECK-NEXT: (local.set $10 ;; CHECK-NEXT: (i32.const 5) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/global-effects.wast b/test/lit/passes/global-effects.wast index 38e96c6eb..7390f996d 100644 --- a/test/lit/passes/global-effects.wast +++ b/test/lit/passes/global-effects.wast @@ -27,7 +27,7 @@ ;; WITHOUT: (table $t 0 funcref) ;; INCLUDE: (table $t 0 funcref) - (table $t funcref 0) + (table $t 0 funcref) ;; WITHOUT: (elem declare func $throw) @@ -182,7 +182,7 @@ ) ;; WITHOUT: (func $call-throw-and-catch (type $void) - ;; WITHOUT-NEXT: (try $try + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (call $throw) ;; WITHOUT-NEXT: ) @@ -190,7 +190,7 @@ ;; WITHOUT-NEXT: (nop) ;; WITHOUT-NEXT: ) ;; WITHOUT-NEXT: ) - ;; WITHOUT-NEXT: (try $try0 + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (call $throw-and-import) ;; WITHOUT-NEXT: ) @@ -200,7 +200,7 @@ ;; WITHOUT-NEXT: ) ;; WITHOUT-NEXT: ) ;; INCLUDE: (func $call-throw-and-catch (type $void) - ;; INCLUDE-NEXT: (try $try0 + ;; INCLUDE-NEXT: (try ;; INCLUDE-NEXT: (do ;; INCLUDE-NEXT: (call $throw-and-import) ;; INCLUDE-NEXT: ) @@ -298,7 +298,7 @@ ) ;; WITHOUT: (func $call-return-call-throw-and-catch (type $void) - ;; WITHOUT-NEXT: (try $try + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (call $return-call-throw-and-catch) ;; WITHOUT-NEXT: ) @@ -306,7 +306,7 @@ ;; WITHOUT-NEXT: (nop) ;; WITHOUT-NEXT: ) ;; WITHOUT-NEXT: ) - ;; WITHOUT-NEXT: (try $try1 + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (call $return-call-indirect-throw-and-catch) ;; WITHOUT-NEXT: ) @@ -314,7 +314,7 @@ ;; WITHOUT-NEXT: (nop) ;; WITHOUT-NEXT: ) ;; WITHOUT-NEXT: ) - ;; WITHOUT-NEXT: (try $try2 + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (call $return-call-ref-throw-and-catch) ;; WITHOUT-NEXT: ) @@ -327,7 +327,7 @@ ;; WITHOUT-NEXT: (call $return-call-ref-throw-and-catch) ;; WITHOUT-NEXT: ) ;; INCLUDE: (func $call-return-call-throw-and-catch (type $void) - ;; INCLUDE-NEXT: (try $try1 + ;; INCLUDE-NEXT: (try ;; INCLUDE-NEXT: (do ;; INCLUDE-NEXT: (call $return-call-indirect-throw-and-catch) ;; INCLUDE-NEXT: ) @@ -335,7 +335,7 @@ ;; INCLUDE-NEXT: (nop) ;; INCLUDE-NEXT: ) ;; INCLUDE-NEXT: ) - ;; INCLUDE-NEXT: (try $try2 + ;; INCLUDE-NEXT: (try ;; INCLUDE-NEXT: (do ;; INCLUDE-NEXT: (call $return-call-ref-throw-and-catch) ;; INCLUDE-NEXT: ) @@ -380,7 +380,7 @@ ) ;; WITHOUT: (func $call-unreachable-and-catch (type $void) - ;; WITHOUT-NEXT: (try $try + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (call $unreachable) ;; WITHOUT-NEXT: ) @@ -405,7 +405,7 @@ ) ;; WITHOUT: (func $call-throw-or-unreachable-and-catch (type $2) (param $x i32) - ;; WITHOUT-NEXT: (try $try + ;; WITHOUT-NEXT: (try ;; WITHOUT-NEXT: (do ;; WITHOUT-NEXT: (if ;; WITHOUT-NEXT: (local.get $x) @@ -423,7 +423,7 @@ ;; WITHOUT-NEXT: ) ;; WITHOUT-NEXT: ) ;; INCLUDE: (func $call-throw-or-unreachable-and-catch (type $2) (param $x i32) - ;; INCLUDE-NEXT: (try $try + ;; INCLUDE-NEXT: (try ;; INCLUDE-NEXT: (do ;; INCLUDE-NEXT: (if ;; INCLUDE-NEXT: (local.get $x) diff --git a/test/lit/passes/gto-mutability.wast b/test/lit/passes/gto-mutability.wast index ed04edccc..47a9e2315 100644 --- a/test/lit/passes/gto-mutability.wast +++ b/test/lit/passes/gto-mutability.wast @@ -102,7 +102,7 @@ ) ;; CHECK: (func $foo (type $2) (result (ref null $struct)) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast index fdd5139f0..f2feea228 100644 --- a/test/lit/passes/gufa-refs.wast +++ b/test/lit/passes/gufa-refs.wast @@ -1915,7 +1915,7 @@ ;; CHECK-NEXT: (throw $nothing ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -1941,7 +1941,7 @@ ;; CHECK-NEXT: (throw $something ;; CHECK-NEXT: (struct.new_default $struct) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -2012,7 +2012,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -2028,7 +2028,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try1 (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: ) @@ -2041,7 +2041,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try2 (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -2054,7 +2054,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try3 (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -2144,7 +2144,7 @@ ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: (struct.new_default $struct) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -2162,7 +2162,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -5243,13 +5243,13 @@ (i32.const 42) )) - ;; CHECK: (export "mut_A" (global $mut_A)) - (export "mut_A" (global $mut_A)) - ;; CHECK: (export "yes" (func $yes)) ;; CHECK: (export "no" (func $no)) + ;; CHECK: (export "mut_A" (global $mut_A)) + (export "mut_A" (global $mut_A)) + ;; CHECK: (func $yes (type $2) (param $A (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 1) diff --git a/test/lit/passes/gufa-tags.wast b/test/lit/passes/gufa-tags.wast index a9de6202c..a03567307 100644 --- a/test/lit/passes/gufa-tags.wast +++ b/test/lit/passes/gufa-tags.wast @@ -19,7 +19,7 @@ ;; CHECK: (func $test (type $2) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 f32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $tag$i32 ;; CHECK-NEXT: (i32.const 42) @@ -78,7 +78,7 @@ ;; CHECK: (func $bar (type $3) (result i32) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 42) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/gufa-vs-cfp.wast b/test/lit/passes/gufa-vs-cfp.wast index 44a44a3e5..cb3aeaa22 100644 --- a/test/lit/passes/gufa-vs-cfp.wast +++ b/test/lit/passes/gufa-vs-cfp.wast @@ -459,11 +459,11 @@ ;; CHECK: (func $test (type $0) ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 10) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block ;; (replaces unreachable StructNew we can't emit) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (i32.const 10) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) diff --git a/test/lit/passes/inlining-eh-old.wast b/test/lit/passes/inlining-eh-old.wast index f35e834a4..b6e3caec2 100644 --- a/test/lit/passes/inlining-eh-old.wast +++ b/test/lit/passes/inlining-eh-old.wast @@ -110,7 +110,7 @@ ;; CHECK: (func $caller-with-pop (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/inlining-unreachable.wast b/test/lit/passes/inlining-unreachable.wast index 1b08ac2b0..044de4848 100644 --- a/test/lit/passes/inlining-unreachable.wast +++ b/test/lit/passes/inlining-unreachable.wast @@ -105,7 +105,7 @@ ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__return_call ;; CHECK-NEXT: (block - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (br $__return_call) diff --git a/test/lit/passes/inlining_enable-tail-call.wast b/test/lit/passes/inlining_enable-tail-call.wast index 77aa77974..a5e797ca7 100644 --- a/test/lit/passes/inlining_enable-tail-call.wast +++ b/test/lit/passes/inlining_enable-tail-call.wast @@ -488,7 +488,7 @@ ) ;; CHECK: (func $caller-2 ;; CHECK-NEXT: (block $__original_body - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__original_body) ;; CHECK-NEXT: ) @@ -532,7 +532,7 @@ ;; CHECK: (func $caller-2 (result i32) ;; CHECK-NEXT: (block $__original_body ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__original_body) ;; CHECK-NEXT: ) @@ -581,7 +581,7 @@ ;; CHECK: (func $caller-2 ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (block $__original_body - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 @@ -639,7 +639,7 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (block $__original_body ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $0 @@ -725,7 +725,7 @@ ;; CHECK-NEXT: (local $2 i32) ;; CHECK-NEXT: (local $3 i32) ;; CHECK-NEXT: (block $__original_body - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $2 @@ -803,7 +803,7 @@ ;; CHECK-NEXT: (block $__original_body_0 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__original_body - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__original_body) ;; CHECK-NEXT: ) @@ -811,7 +811,7 @@ ;; CHECK-NEXT: (return) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block $__inlined_func$second-2$1 - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (br $__original_body_0) @@ -938,7 +938,7 @@ ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__original_body ;; CHECK-NEXT: (return - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.set $2 @@ -954,7 +954,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (block $__inlined_func$second - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block @@ -1050,7 +1050,7 @@ ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__return_call ;; CHECK-NEXT: (block - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (br $__return_call) @@ -1120,7 +1120,7 @@ ;; CHECK-NEXT: (block $__inlined_func$second-2$1 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__return_call - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (br $__return_call) @@ -1189,7 +1189,7 @@ ;; CHECK-NEXT: (block $__inlined_func$second-2$1 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__return_call - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__inlined_func$second-2$1) ;; CHECK-NEXT: (br $__return_call) @@ -1261,7 +1261,7 @@ ;; CHECK-NEXT: (block $__inlined_func$second-2$1 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__return_call - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (block ;; CHECK-NEXT: (local.tee $0 @@ -1361,7 +1361,7 @@ ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__return_call ;; CHECK-NEXT: (block - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__return_call) ;; CHECK-NEXT: ) @@ -1425,7 +1425,7 @@ ;; CHECK-NEXT: (block $__inlined_func$callee-2$1 ;; CHECK-NEXT: (block ;; CHECK-NEXT: (block $__return_call - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__return_call) ;; CHECK-NEXT: ) @@ -1570,7 +1570,7 @@ ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (br $__original_body) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/inlining_optimize-level=3.wast b/test/lit/passes/inlining_optimize-level=3.wast index c03f7f117..1064ba04d 100644 --- a/test/lit/passes/inlining_optimize-level=3.wast +++ b/test/lit/passes/inlining_optimize-level=3.wast @@ -14,13 +14,6 @@ ;; CHECK: (elem $0 (i32.const 0) $no-loops-but-one-use-but-tabled) - ;; CHECK: (export "yes" (func $yes)) - (export "yes" (func $yes)) - ;; CHECK: (export "no-loops-but-one-use-but-exported" (func $no-loops-but-one-use-but-exported)) - (export "no-loops-but-one-use-but-exported" (func $no-loops-but-one-use-but-exported)) - (table 1 1 funcref) - (elem (i32.const 0) $no-loops-but-one-use-but-tabled) - ;; CHECK: (export "A" (func $recursive-inlining-1)) ;; CHECK: (export "B" (func $recursive-inlining-2)) @@ -29,6 +22,13 @@ ;; CHECK: (export "BB" (func $b-recursive-inlining-2)) + ;; CHECK: (export "yes" (func $yes)) + (export "yes" (func $yes)) + ;; CHECK: (export "no-loops-but-one-use-but-exported" (func $no-loops-but-one-use-but-exported)) + (export "no-loops-but-one-use-but-exported" (func $no-loops-but-one-use-but-exported)) + (table 1 1 funcref) + (elem (i32.const 0) $no-loops-but-one-use-but-tabled) + ;; CHECK: (func $yes (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) @@ -61,7 +61,7 @@ ) ) ;; CHECK: (func $no-loops-but-one-use-but-exported (result i32) - ;; CHECK-NEXT: (loop $loop-in (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -71,7 +71,7 @@ ) ) ;; CHECK: (func $no-loops-but-one-use-but-tabled (result i32) - ;; CHECK-NEXT: (loop $loop-in (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -175,7 +175,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__inlined_func$no-loops$4 (result i32) - ;; CHECK-NEXT: (loop $loop-in (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -184,7 +184,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__inlined_func$no-loops$5 (result i32) - ;; CHECK-NEXT: (loop $loop-in0 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -193,7 +193,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__inlined_func$yes-loops-but-one-use$6 (result i32) - ;; CHECK-NEXT: (loop $loop-in1 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -202,7 +202,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__inlined_func$no-loops-but-one-use-but-exported$7 (result i32) - ;; CHECK-NEXT: (loop $loop-in2 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -211,7 +211,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (block $__inlined_func$no-loops-but-one-use-but-tabled$8 (result i32) - ;; CHECK-NEXT: (loop $loop-in3 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/instrument-locals-eh-old.wast b/test/lit/passes/instrument-locals-eh-old.wast index 5824c0bd0..8ee553554 100644 --- a/test/lit/passes/instrument-locals-eh-old.wast +++ b/test/lit/passes/instrument-locals-eh-old.wast @@ -7,7 +7,7 @@ ;; CHECK: (func $test (type $8) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast index 5e6c3b48a..94c61433f 100644 --- a/test/lit/passes/optimize-instructions-call_ref.wast +++ b/test/lit/passes/optimize-instructions-call_ref.wast @@ -217,6 +217,12 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-instructions-exceptions.wast b/test/lit/passes/optimize-instructions-exceptions.wast index dcb649129..6d313bd18 100644 --- a/test/lit/passes/optimize-instructions-exceptions.wast +++ b/test/lit/passes/optimize-instructions-exceptions.wast @@ -5,7 +5,7 @@ (module ;; CHECK: (func $test ;; CHECK-NEXT: (if - ;; CHECK-NEXT: (try $try (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 123) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index d44c7da5d..4a57c1919 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -22,13 +22,13 @@ ;; CHECK: (type $B (sub $A (struct (field i32) (field i32) (field f32)))) (type $B (sub $A (struct (field i32) (field i32) (field f32)))) + ;; CHECK: (type $void (sub (func))) + ;; CHECK: (type $B-child (sub $B (struct (field i32) (field i32) (field f32) (field i64)))) (type $B-child (sub $B (struct (field i32) (field i32) (field f32) (field i64)))) (type $empty (struct)) - ;; CHECK: (type $void (sub (func))) - ;; CHECK: (type $void2 (sub $void (func))) ;; CHECK: (type $C (sub $A (struct (field i32) (field i32) (field f64)))) @@ -50,7 +50,7 @@ ;; These functions test if an `if` with subtyped arms is correctly folded ;; 1. if its `ifTrue` and `ifFalse` arms are identical (can fold) - ;; CHECK: (func $if-arms-subtype-fold (type $27) (result anyref) + ;; CHECK: (func $if-arms-subtype-fold (type $26) (result anyref) ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) (func $if-arms-subtype-fold (result anyref) @@ -65,7 +65,7 @@ ) ) ;; 2. if its `ifTrue` and `ifFalse` arms are not identical (cannot fold) - ;; CHECK: (func $if-arms-subtype-nofold (type $28) (param $i31ref i31ref) (result anyref) + ;; CHECK: (func $if-arms-subtype-nofold (type $27) (param $i31ref i31ref) (result anyref) ;; CHECK-NEXT: (if (result anyref) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (then @@ -122,7 +122,7 @@ ) ;; Similar, but for arrays. - ;; CHECK: (func $store-trunc2 (type $15) (param $x (ref null $array)) + ;; CHECK: (func $store-trunc2 (type $14) (param $x (ref null $array)) ;; CHECK-NEXT: (array.set $array ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: (i32.const 0) @@ -139,7 +139,7 @@ ;; ref.is_null is not needed on a non-nullable value, and if something is ;; cast to its own type, we don't need that either, etc. - ;; CHECK: (func $unneeded_test (type $16) (param $struct (ref $struct)) (param $func (ref func)) (param $i31 (ref i31)) + ;; CHECK: (func $unneeded_test (type $15) (param $struct (ref $struct)) (param $func (ref func)) (param $i31 (ref i31)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (drop @@ -182,7 +182,7 @@ ;; similar to $unneeded_is, but the values are nullable. we can at least ;; leave just the null check. - ;; CHECK: (func $unneeded_test_null (type $17) (param $struct (ref null $struct)) (param $func funcref) (param $i31 i31ref) + ;; CHECK: (func $unneeded_test_null (type $16) (param $struct (ref null $struct)) (param $func funcref) (param $i31 i31ref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.is_null ;; CHECK-NEXT: (local.get $struct) @@ -223,7 +223,7 @@ ;; ref.as_non_null is not needed on a non-nullable value, and if something is ;; a func we don't need that either etc., and can just return the value. - ;; CHECK: (func $unneeded_cast (type $16) (param $struct (ref $struct)) (param $func (ref func)) (param $i31 (ref i31)) + ;; CHECK: (func $unneeded_cast (type $15) (param $struct (ref $struct)) (param $func (ref func)) (param $i31 (ref i31)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $struct) ;; CHECK-NEXT: ) @@ -251,7 +251,7 @@ ;; similar to $unneeded_cast, but the values are nullable. we can turn the ;; more specific things into ref.as_non_null. - ;; CHECK: (func $unneeded_cast_null (type $17) (param $struct (ref null $struct)) (param $func funcref) (param $i31 i31ref) + ;; CHECK: (func $unneeded_cast_null (type $16) (param $struct (ref null $struct)) (param $func funcref) (param $i31 i31ref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (local.get $struct) @@ -283,7 +283,7 @@ ) ) - ;; CHECK: (func $unneeded_unreachability (type $5) + ;; CHECK: (func $unneeded_unreachability (type $void) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.test (ref func) ;; CHECK-NEXT: (unreachable) @@ -308,7 +308,7 @@ ) ) - ;; CHECK: (func $redundant-non-null-casts (type $29) (param $x (ref null $struct)) (param $y (ref null $array)) (param $f (ref null $void)) + ;; CHECK: (func $redundant-non-null-casts (type $28) (param $x (ref null $struct)) (param $y (ref null $array)) (param $f (ref null $void)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (local.get $x) @@ -395,7 +395,7 @@ ) ) - ;; CHECK: (func $get-eqref (type $30) (result eqref) + ;; CHECK: (func $get-eqref (type $29) (result eqref) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $get-eqref (result eqref) @@ -471,12 +471,12 @@ ) ) - ;; CHECK: (func $nothing (type $5) + ;; CHECK: (func $nothing (type $void) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $nothing) - ;; CHECK: (func $ref-eq-corner-cases (type $4) (param $x eqref) + ;; CHECK: (func $ref-eq-corner-cases (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.eq ;; CHECK-NEXT: (block (result eqref) @@ -563,7 +563,7 @@ ) ) - ;; CHECK: (func $ref-eq-ref-cast (type $4) (param $x eqref) + ;; CHECK: (func $ref-eq-ref-cast (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.eq ;; CHECK-NEXT: (local.get $x) @@ -586,7 +586,7 @@ ) ) - ;; CHECK: (func $flip-cast-of-as-non-null (type $18) (param $x anyref) + ;; CHECK: (func $flip-cast-of-as-non-null (type $17) (param $x anyref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref $struct) ;; CHECK-NEXT: (local.get $x) @@ -639,7 +639,7 @@ ) ) ) - ;; CHECK: (func $flip-tee-of-as-non-null (type $18) (param $x anyref) + ;; CHECK: (func $flip-tee-of-as-non-null (type $17) (param $x anyref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (local.tee $x @@ -659,7 +659,7 @@ ) ) - ;; CHECK: (func $flip-tee-of-as-non-null-non-nullable (type $31) (param $x (ref any)) (param $y anyref) + ;; CHECK: (func $flip-tee-of-as-non-null-non-nullable (type $30) (param $x (ref any)) (param $y anyref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $x ;; CHECK-NEXT: (ref.as_non_null @@ -680,7 +680,7 @@ ) ) ) - ;; CHECK: (func $ternary-identical-arms (type $32) (param $x i32) (param $y (ref null $struct)) (param $z (ref null $struct)) + ;; CHECK: (func $ternary-identical-arms (type $31) (param $x i32) (param $y (ref null $struct)) (param $z (ref null $struct)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.is_null ;; CHECK-NEXT: (if (result (ref null $struct)) @@ -708,7 +708,7 @@ ) ) ) - ;; CHECK: (func $select-identical-arms-but-side-effect (type $19) (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32) + ;; CHECK: (func $select-identical-arms-but-side-effect (type $18) (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (select ;; CHECK-NEXT: (struct.get_u $struct $i8 @@ -735,7 +735,7 @@ ) ) ) - ;; CHECK: (func $ternary-identical-arms-no-side-effect (type $33) (param $x (ref $struct)) (param $y (ref $struct)) (param $z i32) + ;; CHECK: (func $ternary-identical-arms-no-side-effect (type $32) (param $x (ref $struct)) (param $y (ref $struct)) (param $z i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (struct.get_u $struct $i8 ;; CHECK-NEXT: (select (result (ref $struct)) @@ -760,7 +760,7 @@ ) ) ) - ;; CHECK: (func $if-identical-arms-with-side-effect (type $19) (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32) + ;; CHECK: (func $if-identical-arms-with-side-effect (type $18) (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (struct.get_u $struct $i8 ;; CHECK-NEXT: (if (result (ref null $struct)) @@ -795,7 +795,7 @@ ) ) - ;; CHECK: (func $ref-cast-squared (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-squared (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref null $struct) ;; CHECK-NEXT: (local.get $x) @@ -812,7 +812,7 @@ ) ) ) - ;; CHECK: (func $ref-cast-squared-fallthrough (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-squared-fallthrough (type $5) (param $x eqref) ;; CHECK-NEXT: (local $1 (ref null $struct)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref null $struct)) @@ -841,7 +841,7 @@ ) ) ) - ;; CHECK: (func $ref-cast-cubed (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-cubed (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref null $struct) ;; CHECK-NEXT: (local.get $x) @@ -860,7 +860,7 @@ ) ) ) - ;; CHECK: (func $ref-cast-squared-different (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-squared-different (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast nullref ;; CHECK-NEXT: (local.get $x) @@ -879,7 +879,7 @@ ) ) - ;; CHECK: (func $ref-eq-null (type $4) (param $x eqref) + ;; CHECK: (func $ref-eq-null (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.is_null ;; CHECK-NEXT: (local.get $x) @@ -1087,7 +1087,7 @@ ) ) - ;; CHECK: (func $hoist-LUB-danger (type $34) (param $x i32) (param $b (ref $B)) (param $c (ref $C)) (result i32) + ;; CHECK: (func $hoist-LUB-danger (type $33) (param $x i32) (param $b (ref $B)) (param $c (ref $C)) (result i32) ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: (then @@ -1126,7 +1126,7 @@ ) ) - ;; CHECK: (func $incompatible-cast-of-non-null (type $35) (param $struct (ref $struct)) + ;; CHECK: (func $incompatible-cast-of-non-null (type $34) (param $struct (ref $struct)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref none)) ;; CHECK-NEXT: (drop @@ -1244,7 +1244,7 @@ ) ) - ;; CHECK: (func $subtype-compatible (type $21) (param $A (ref null $A)) (param $B (ref null $B)) + ;; CHECK: (func $subtype-compatible (type $20) (param $A (ref null $A)) (param $B (ref null $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.test (ref $B) ;; CHECK-NEXT: (local.get $A) @@ -1324,7 +1324,7 @@ ) ) - ;; CHECK: (func $compatible-test-separate-fallthrough (type $12) (param $eqref eqref) (result i32) + ;; CHECK: (func $compatible-test-separate-fallthrough (type $11) (param $eqref eqref) (result i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $eqref ;; CHECK-NEXT: (block (result eqref) @@ -1358,7 +1358,7 @@ ) ) - ;; CHECK: (func $improvable-test-separate-fallthrough (type $12) (param $eqref eqref) (result i32) + ;; CHECK: (func $improvable-test-separate-fallthrough (type $11) (param $eqref eqref) (result i32) ;; CHECK-NEXT: (ref.test (ref i31) ;; CHECK-NEXT: (block (result eqref) ;; CHECK-NEXT: (ref.as_non_null @@ -1379,7 +1379,7 @@ ) ) - ;; CHECK: (func $incompatible-test-separate-fallthrough (type $12) (param $eqref eqref) (result i32) + ;; CHECK: (func $incompatible-test-separate-fallthrough (type $11) (param $eqref eqref) (result i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $eqref ;; CHECK-NEXT: (block (result eqref) @@ -1538,7 +1538,7 @@ ) ) - ;; CHECK: (func $ref.test-unreachable (type $36) (param $A (ref null $A)) + ;; CHECK: (func $ref.test-unreachable (type $35) (param $A (ref null $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.test (ref $A) ;; CHECK-NEXT: (unreachable) @@ -1565,7 +1565,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-null (type $5) + ;; CHECK: (func $ref-cast-static-null (type $void) ;; CHECK-NEXT: (local $a (ref null $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.null none) @@ -1661,7 +1661,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-general (type $21) (param $a (ref null $A)) (param $b (ref null $B)) + ;; CHECK: (func $ref-cast-static-general (type $20) (param $a (ref null $A)) (param $b (ref null $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $a) ;; CHECK-NEXT: ) @@ -1708,7 +1708,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-squared (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-static-squared (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref null $A) ;; CHECK-NEXT: (local.get $x) @@ -1751,7 +1751,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-many (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-static-many (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref null $B-child) ;; CHECK-NEXT: (local.get $x) @@ -1842,7 +1842,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-very-many (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-static-very-many (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref null $B-child) ;; CHECK-NEXT: (local.get $x) @@ -1880,7 +1880,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-fallthrough-remaining (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-static-fallthrough-remaining (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref null $B)) ;; CHECK-NEXT: (call $ref-cast-static-fallthrough-remaining @@ -1915,7 +1915,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-fallthrough-remaining-child (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-static-fallthrough-remaining-child (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref null $B) ;; CHECK-NEXT: (block (result eqref) @@ -1947,7 +1947,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-fallthrough-remaining-impossible (type $22) (param $x (ref eq)) + ;; CHECK: (func $ref-cast-static-fallthrough-remaining-impossible (type $21) (param $x (ref eq)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block ;; CHECK-NEXT: (drop @@ -1982,7 +1982,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-fallthrough-remaining-nonnull (type $22) (param $x (ref eq)) + ;; CHECK: (func $ref-cast-static-fallthrough-remaining-nonnull (type $21) (param $x (ref eq)) ;; CHECK-NEXT: (local $1 (ref $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref $B)) @@ -2021,7 +2021,7 @@ ) ) - ;; CHECK: (func $ref-cast-static-squared-impossible (type $4) (param $x eqref) + ;; CHECK: (func $ref-cast-static-squared-impossible (type $5) (param $x eqref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast nullref ;; CHECK-NEXT: (local.get $x) @@ -2091,7 +2091,7 @@ ) ) - ;; CHECK: (func $ref-test-static-same-type (type $23) (param $nullable (ref null $A)) (param $non-nullable (ref $A)) + ;; CHECK: (func $ref-test-static-same-type (type $22) (param $nullable (ref null $A)) (param $non-nullable (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (ref.is_null @@ -2124,7 +2124,7 @@ ) ) - ;; CHECK: (func $ref-test-static-subtype (type $13) (param $nullable (ref null $B)) (param $non-nullable (ref $B)) + ;; CHECK: (func $ref-test-static-subtype (type $12) (param $nullable (ref null $B)) (param $non-nullable (ref $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.eqz ;; CHECK-NEXT: (ref.is_null @@ -2155,7 +2155,7 @@ ) ) - ;; CHECK: (func $ref-test-static-supertype (type $23) (param $nullable (ref null $A)) (param $non-nullable (ref $A)) + ;; CHECK: (func $ref-test-static-supertype (type $22) (param $nullable (ref null $A)) (param $non-nullable (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.test (ref $B) ;; CHECK-NEXT: (local.get $nullable) @@ -2182,7 +2182,7 @@ ) ) - ;; CHECK: (func $ref-test-static-impossible (type $37) (param $nullable (ref null $array)) (param $non-nullable (ref $array)) + ;; CHECK: (func $ref-test-static-impossible (type $36) (param $nullable (ref null $array)) (param $non-nullable (ref $array)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (drop @@ -2262,14 +2262,14 @@ ) ) - ;; CHECK: (func $impossible (type $38) (result (ref none)) + ;; CHECK: (func $impossible (type $37) (result (ref none)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $impossible (result (ref none)) (unreachable) ) - ;; CHECK: (func $bottom-type-accessors (type $39) (param $bot (ref none)) (param $null nullref) + ;; CHECK: (func $bottom-type-accessors (type $38) (param $bot (ref none)) (param $null nullref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) @@ -2311,7 +2311,7 @@ ) ) - ;; CHECK: (func $ref-cast-heap-type (type $13) (param $null-b (ref null $B)) (param $b (ref $B)) + ;; CHECK: (func $ref-cast-heap-type (type $12) (param $null-b (ref null $B)) (param $b (ref $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $b) ;; CHECK-NEXT: ) @@ -2358,7 +2358,7 @@ ) ) - ;; CHECK: (func $ref-cast-heap-type-incompatible (type $13) (param $null-b (ref null $B)) (param $b (ref $B)) + ;; CHECK: (func $ref-cast-heap-type-incompatible (type $12) (param $null-b (ref null $B)) (param $b (ref $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref none)) ;; CHECK-NEXT: (drop @@ -2417,7 +2417,7 @@ ) ) - ;; CHECK: (func $compatible-cast-separate-fallthrough (type $24) (param $eqref eqref) (result (ref i31)) + ;; CHECK: (func $compatible-cast-separate-fallthrough (type $23) (param $eqref eqref) (result (ref i31)) ;; CHECK-NEXT: (local $1 i31ref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $eqref @@ -2457,7 +2457,7 @@ ) ) - ;; CHECK: (func $compatible-cast-fallthrough-null-check (type $24) (param $eqref eqref) (result (ref i31)) + ;; CHECK: (func $compatible-cast-fallthrough-null-check (type $23) (param $eqref eqref) (result (ref i31)) ;; CHECK-NEXT: (local $1 i31ref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $eqref @@ -2489,7 +2489,7 @@ ) ) - ;; CHECK: (func $compatible-cast-separate-fallthrough-multiple-options-1 (type $25) (param $eqref eqref) (result (ref eq)) + ;; CHECK: (func $compatible-cast-separate-fallthrough-multiple-options-1 (type $24) (param $eqref eqref) (result (ref eq)) ;; CHECK-NEXT: (local $1 i31ref) ;; CHECK-NEXT: (block $outer (result (ref eq)) ;; CHECK-NEXT: (block (result (ref i31)) @@ -2547,7 +2547,7 @@ ) ) - ;; CHECK: (func $compatible-cast-separate-fallthrough-multiple-options-2 (type $25) (param $eqref eqref) (result (ref eq)) + ;; CHECK: (func $compatible-cast-separate-fallthrough-multiple-options-2 (type $24) (param $eqref eqref) (result (ref eq)) ;; CHECK-NEXT: (local $1 (ref i31)) ;; CHECK-NEXT: (block $outer (result (ref eq)) ;; CHECK-NEXT: (block (result (ref i31)) @@ -2602,7 +2602,7 @@ ) ) - ;; CHECK: (func $incompatible-cast-separate-fallthrough (type $40) (param $eqref eqref) (result structref) + ;; CHECK: (func $incompatible-cast-separate-fallthrough (type $39) (param $eqref eqref) (result structref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $eqref ;; CHECK-NEXT: (block (result (ref i31)) @@ -2739,7 +2739,7 @@ ) ) - ;; CHECK: (func $as_of_unreachable (type $41) (result (ref $A)) + ;; CHECK: (func $as_of_unreachable (type $40) (result (ref $A)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $as_of_unreachable (result (ref $A)) @@ -2753,7 +2753,7 @@ ) ) - ;; CHECK: (func $cast-internalized-extern (type $42) (param $externref externref) + ;; CHECK: (func $cast-internalized-extern (type $41) (param $externref externref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref $A) ;; CHECK-NEXT: (extern.internalize @@ -2775,7 +2775,7 @@ ) ) - ;; CHECK: (func $struct.set.null.fallthrough (type $5) + ;; CHECK: (func $struct.set.null.fallthrough (type $void) ;; CHECK-NEXT: (local $temp (ref null $struct)) ;; CHECK-NEXT: (block ;; (replaces unreachable StructSet we can't emit) ;; CHECK-NEXT: (drop @@ -2804,7 +2804,7 @@ ) ) - ;; CHECK: (func $set.array.null (type $5) + ;; CHECK: (func $set.array.null (type $void) ;; CHECK-NEXT: (local $temp (ref none)) ;; CHECK-NEXT: (block ;; (replaces unreachable ArraySet we can't emit) ;; CHECK-NEXT: (drop @@ -2862,7 +2862,7 @@ ) ) - ;; CHECK: (func $refinalize.select.arm.flip (type $5) + ;; CHECK: (func $refinalize.select.arm.flip (type $void) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref $void2) ;; CHECK-NEXT: (ref.func $refinalize.select.arm) @@ -2882,7 +2882,7 @@ ) ) - ;; CHECK: (func $refinalize.select.arm.unknown (type $43) (param $x i32) + ;; CHECK: (func $refinalize.select.arm.unknown (type $42) (param $x i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast (ref $void2) ;; CHECK-NEXT: (ref.func $refinalize.select.arm) @@ -2902,7 +2902,7 @@ ) ) - ;; CHECK: (func $non-null-bottom-ref (type $44) (result (ref func)) + ;; CHECK: (func $non-null-bottom-ref (type $43) (result (ref func)) ;; CHECK-NEXT: (local $0 funcref) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $0 @@ -2930,7 +2930,7 @@ ) ) - ;; CHECK: (func $non-null-bottom-cast (type $45) (result (ref nofunc)) + ;; CHECK: (func $non-null-bottom-cast (type $44) (result (ref nofunc)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.func $non-null-bottom-cast) ;; CHECK-NEXT: ) @@ -3000,7 +3000,7 @@ ) ) - ;; CHECK: (func $ref.test-fallthrough (type $5) + ;; CHECK: (func $ref.test-fallthrough (type $void) ;; CHECK-NEXT: (local $A (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.test (ref $B) @@ -3088,7 +3088,7 @@ ) ) - ;; CHECK: (func $gc_to_unreachable_in_added_constants (type $5) + ;; CHECK: (func $gc_to_unreachable_in_added_constants (type $void) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.wrap_i64 ;; CHECK-NEXT: (i64.add @@ -3129,7 +3129,7 @@ (unreachable) ) - ;; CHECK: (func $array-copy-non-null (type $15) (param $x (ref null $array)) + ;; CHECK: (func $array-copy-non-null (type $14) (param $x (ref null $array)) ;; CHECK-NEXT: (block $block ;; CHECK-NEXT: (array.copy $array $array ;; CHECK-NEXT: (ref.as_non_null @@ -3178,7 +3178,7 @@ ) ) - ;; CHECK: (func $struct.new (type $5) + ;; CHECK: (func $struct.new (type $void) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref $struct)) ;; CHECK-NEXT: (drop @@ -3263,7 +3263,7 @@ ) ) - ;; CHECK: (func $array.new (type $5) + ;; CHECK: (func $array.new (type $void) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref $array)) ;; CHECK-NEXT: (drop @@ -3332,7 +3332,7 @@ ) ) - ;; CHECK: (func $array.new_fixed (type $5) + ;; CHECK: (func $array.new_fixed (type $void) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/optimize-instructions-iit-eh-old.wast b/test/lit/passes/optimize-instructions-iit-eh-old.wast index af45a9427..c0e4a05da 100644 --- a/test/lit/passes/optimize-instructions-iit-eh-old.wast +++ b/test/lit/passes/optimize-instructions-iit-eh-old.wast @@ -9,7 +9,7 @@ (tag $e (param (ref null $struct.A))) ;; CHECK: (func $ref-cast-statically-removed (type $2) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-instructions-mvp.wast b/test/lit/passes/optimize-instructions-mvp.wast index 43da637e8..8b1afa76a 100644 --- a/test/lit/passes/optimize-instructions-mvp.wast +++ b/test/lit/passes/optimize-instructions-mvp.wast @@ -1526,7 +1526,7 @@ ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (i32.const 5) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 6) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1536,7 +1536,7 @@ ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (i32.const 8) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in1 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 7) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -1546,7 +1546,7 @@ ;; CHECK-NEXT: (block (result i32) ;; CHECK-NEXT: (i32.const 10) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in3 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (call $and-pos1) ;; CHECK-NEXT: (i32.const 9) ;; CHECK-NEXT: ) @@ -1558,14 +1558,14 @@ ;; CHECK-NEXT: (call $and-pos1) ;; CHECK-NEXT: (i32.const 12) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in5 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 11) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.and - ;; CHECK-NEXT: (loop $loop-in7 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (call $and-pos1) ;; CHECK-NEXT: (i32.const 13) ;; CHECK-NEXT: ) @@ -1581,7 +1581,7 @@ ;; CHECK-NEXT: (call $and-pos1) ;; CHECK-NEXT: (i32.const 14) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in10 (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (call $and-pos1) ;; CHECK-NEXT: (i32.const 13) ;; CHECK-NEXT: ) @@ -10356,7 +10356,7 @@ ;; CHECK-NEXT: (local.get $x1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $x3 - ;; CHECK-NEXT: (loop $loop-in (result i32) + ;; CHECK-NEXT: (loop (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-stack-ir.wast b/test/lit/passes/optimize-stack-ir.wast index a84ed5223..123be3afb 100644 --- a/test/lit/passes/optimize-stack-ir.wast +++ b/test/lit/passes/optimize-stack-ir.wast @@ -945,7 +945,7 @@ ) ;; CHECK: (func $unreachable-loop (type $5) (result i32) - ;; CHECK-NEXT: loop $loop-in + ;; CHECK-NEXT: loop ;; CHECK-NEXT: i32.const 1 ;; CHECK-NEXT: return ;; CHECK-NEXT: end @@ -961,7 +961,7 @@ ) ;; CHECK: (func $unreachable-loop0 (type $5) (result i32) - ;; CHECK-NEXT: loop $loop-in + ;; CHECK-NEXT: loop ;; CHECK-NEXT: i32.const 1 ;; CHECK-NEXT: return ;; CHECK-NEXT: end @@ -976,7 +976,7 @@ ) ;; CHECK: (func $unreachable-loop-toplevel (type $5) (result i32) - ;; CHECK-NEXT: loop $loop-in + ;; CHECK-NEXT: loop ;; CHECK-NEXT: i32.const 1 ;; CHECK-NEXT: return ;; CHECK-NEXT: end @@ -990,7 +990,7 @@ ) ;; CHECK: (func $unreachable-loop0-toplevel (type $5) (result i32) - ;; CHECK-NEXT: loop $loop-in + ;; CHECK-NEXT: loop ;; CHECK-NEXT: i32.const 1 ;; CHECK-NEXT: return ;; CHECK-NEXT: end diff --git a/test/lit/passes/outlining.wast b/test/lit/passes/outlining.wast index 76f305db7..5119572b3 100644 --- a/test/lit/passes/outlining.wast +++ b/test/lit/passes/outlining.wast @@ -630,7 +630,7 @@ ;; CHECK: (func $a (type $0) ;; CHECK-NEXT: (block $label1 ;; CHECK-NEXT: (call $outline$) - ;; CHECK-NEXT: (loop $loop-in + ;; CHECK-NEXT: (loop ;; CHECK-NEXT: (br $label1) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $outline$) @@ -699,7 +699,7 @@ ) (block (block - (br_table 1 0 (local.get $0)) + (br_table 1 0 (local.get 0)) (return (i32.const 21)) ) (return (i32.const 20)) @@ -982,7 +982,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (loop $loop-in + ;; CHECK-NEXT: (loop ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/poppify.wast b/test/lit/passes/poppify.wast index b348c5081..828257532 100644 --- a/test/lit/passes/poppify.wast +++ b/test/lit/passes/poppify.wast @@ -223,7 +223,7 @@ ) ;; CHECK: (func $try-catch (type $0) (result i32) - ;; CHECK-NEXT: (try $try (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (throw $e @@ -256,7 +256,7 @@ ;; CHECK: (func $try-delegate (type $0) (result i32) ;; CHECK-NEXT: (try $l0 (result i32) ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: (throw $e diff --git a/test/lit/passes/rse-eh-old.wast b/test/lit/passes/rse-eh-old.wast index 64802aec4..7cdb2bccf 100644 --- a/test/lit/passes/rse-eh-old.wast +++ b/test/lit/passes/rse-eh-old.wast @@ -9,7 +9,7 @@ ;; CHECK: (func $try1 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -37,7 +37,7 @@ ;; CHECK: (func $try2 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -70,7 +70,7 @@ ;; CHECK: (func $try3 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -108,7 +108,7 @@ ;; CHECK: (func $try4 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: (local.set $x @@ -139,7 +139,7 @@ ;; CHECK: (func $try5 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $x ;; CHECK-NEXT: (i32.const 1) @@ -170,7 +170,7 @@ ;; CHECK: (func $nested-try1 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do @@ -218,7 +218,7 @@ ;; CHECK: (func $nested-try2 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do @@ -265,7 +265,7 @@ ;; CHECK: (func $nested-try3 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do @@ -316,7 +316,7 @@ ;; CHECK: (func $nested-catch1 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -328,7 +328,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch $e2 - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -382,7 +382,7 @@ ;; CHECK: (func $nested-catch2 (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -397,7 +397,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (catch_all - ;; CHECK-NEXT: (try $try1 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -455,7 +455,7 @@ ;; CHECK: (func $catchless-try (type $0) ;; CHECK-NEXT: (local $x i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (call $foo) ;; CHECK-NEXT: (local.set $x @@ -486,9 +486,9 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try2 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -541,9 +541,9 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try3 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -597,9 +597,9 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try4 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -657,13 +657,13 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try5 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try6 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -738,13 +738,13 @@ ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (try $l0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (try $l1 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try7 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try8 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) diff --git a/test/lit/passes/simplify-locals-eh-old.wast b/test/lit/passes/simplify-locals-eh-old.wast index 0bf26f34d..7b48707d4 100644 --- a/test/lit/passes/simplify-locals-eh-old.wast +++ b/test/lit/passes/simplify-locals-eh-old.wast @@ -10,7 +10,7 @@ (func $foo (param i32 i32)) ;; CHECK: (func $pop-cannot-be-sinked (type $0) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -42,7 +42,7 @@ ;; CHECK: (func $pop-within-catch-can-be-sinked (type $0) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) @@ -50,7 +50,7 @@ ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (call $foo ;; CHECK-NEXT: (i32.const 3) - ;; CHECK-NEXT: (try $try0 (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -92,7 +92,7 @@ ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (call $bar) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $0) @@ -124,7 +124,7 @@ ;; CHECK: (func $non-call-can-be-sinked-into-try (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (i32.const 3) @@ -155,7 +155,7 @@ ;; CHECK: (func $return-call-can-be-sinked-into-try (type $3) (result i32) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (try $try (result i32) + ;; CHECK-NEXT: (try (result i32) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (if (result i32) diff --git a/test/lit/passes/simplify-locals-gc-nn.wast b/test/lit/passes/simplify-locals-gc-nn.wast index fcb446760..674361080 100644 --- a/test/lit/passes/simplify-locals-gc-nn.wast +++ b/test/lit/passes/simplify-locals-gc-nn.wast @@ -5,7 +5,7 @@ ;; CHECK: (func $test-nn (type $0) ;; CHECK-NEXT: (local $nn anyref) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $nn ;; CHECK-NEXT: (ref.as_non_null @@ -52,7 +52,7 @@ ;; CHECK: (func $test-nn-tuple (type $0) ;; CHECK-NEXT: (local $nn (tuple i32 anyref i64)) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $nn ;; CHECK-NEXT: (tuple.make 3 @@ -112,7 +112,7 @@ ;; CHECK: (func $test-nullable (type $0) ;; CHECK-NEXT: (local $nullable anyref) ;; CHECK-NEXT: (nop) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (local.set $nullable ;; CHECK-NEXT: (ref.as_non_null diff --git a/test/lit/passes/stack-ir-eh-old.wast b/test/lit/passes/stack-ir-eh-old.wast index 40ad7e587..a5f0b9249 100644 --- a/test/lit/passes/stack-ir-eh-old.wast +++ b/test/lit/passes/stack-ir-eh-old.wast @@ -17,7 +17,7 @@ ;; CHECK-NEXT: rethrow $l0 ;; CHECK-NEXT: end ;; CHECK-NEXT: try $l00 - ;; CHECK-NEXT: try $try + ;; CHECK-NEXT: try ;; CHECK-NEXT: i32.const 0 ;; CHECK-NEXT: throw $e0 ;; CHECK-NEXT: delegate $l00 diff --git a/test/lit/passes/type-generalizing.wast b/test/lit/passes/type-generalizing.wast index f927086de..604561349 100644 --- a/test/lit/passes/type-generalizing.wast +++ b/test/lit/passes/type-generalizing.wast @@ -119,7 +119,7 @@ ;; CHECK: (func $loop (type $1) (result eqref) ;; CHECK-NEXT: (local $var eqref) - ;; CHECK-NEXT: (loop $loop-in (result eqref) + ;; CHECK-NEXT: (loop (result eqref) ;; CHECK-NEXT: (local.get $var) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -943,9 +943,7 @@ (type $mid (sub $top (func (result eqref)))) (type $bot (sub $mid (func (result i31ref)))) - ;; CHECK: (type $1 (func (result anyref))) - - ;; CHECK: (func $call-ref-no-limit (type $1) (result anyref) + ;; CHECK: (func $call-ref-no-limit (type $top) (result anyref) ;; CHECK-NEXT: (local $f (ref null $top)) ;; CHECK-NEXT: (call_ref $top ;; CHECK-NEXT: (local.get $f) diff --git a/test/lit/passes/type-merging-tnh.wast b/test/lit/passes/type-merging-tnh.wast index a82aa87e1..efa82c924 100644 --- a/test/lit/passes/type-merging-tnh.wast +++ b/test/lit/passes/type-merging-tnh.wast @@ -55,21 +55,23 @@ ;; CHECK: (type $2 (func (param (ref $A)) (result (ref $B)))) ;; CHECK: (func $test (type $2) (param $a (ref $A)) (result (ref $B)) - ;; CHECK-NEXT: (block $__binaryen_fake_return (result (ref $B)) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast $__binaryen_fake_return (ref $A) (ref $B) - ;; CHECK-NEXT: (local.get $a) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $l (result (ref $A)) - ;; CHECK-NEXT: (br_on_non_null $l + ;; CHECK-NEXT: (block $label (result (ref $B)) + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (br_on_cast $label (ref $A) (ref $B) ;; CHECK-NEXT: (local.get $a) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $l (result (ref $A)) + ;; CHECK-NEXT: (br_on_non_null $l + ;; CHECK-NEXT: (local.get $a) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test (param $a (ref $A)) (result (ref $B)) diff --git a/test/lit/passes/type-merging.wast b/test/lit/passes/type-merging.wast index 9327ebdb1..734c0197a 100644 --- a/test/lit/passes/type-merging.wast +++ b/test/lit/passes/type-merging.wast @@ -1052,21 +1052,23 @@ ;; CHECK: (type $2 (func (param (ref $A)) (result (ref $B)))) ;; CHECK: (func $test (type $2) (param $a (ref $A)) (result (ref $B)) - ;; CHECK-NEXT: (block $__binaryen_fake_return (result (ref $B)) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast $__binaryen_fake_return (ref $A) (ref $B) - ;; CHECK-NEXT: (local.get $a) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $l (result (ref $A)) - ;; CHECK-NEXT: (br_on_non_null $l + ;; CHECK-NEXT: (block $label (result (ref $B)) + ;; CHECK-NEXT: (block (result (ref $B)) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (br_on_cast $label (ref $A) (ref $B) ;; CHECK-NEXT: (local.get $a) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (block $l (result (ref $A)) + ;; CHECK-NEXT: (br_on_non_null $l + ;; CHECK-NEXT: (local.get $a) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $test (param $a (ref $A)) (result (ref $B)) diff --git a/test/lit/passes/type-refining.wast b/test/lit/passes/type-refining.wast index 1bddb9776..ebff9b2cd 100644 --- a/test/lit/passes/type-refining.wast +++ b/test/lit/passes/type-refining.wast @@ -1262,7 +1262,7 @@ ;; CHECK: (func $struct.new (type $4) (param $extern externref) (result anyref) ;; CHECK-NEXT: (struct.new $A ;; CHECK-NEXT: (ref.cast (ref noextern) - ;; CHECK-NEXT: (try $try (result externref) + ;; CHECK-NEXT: (try (result externref) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (struct.get $A 0 ;; CHECK-NEXT: (struct.new $A @@ -1314,7 +1314,7 @@ ;; CHECK-NEXT: (struct.set $A 0 ;; CHECK-NEXT: (local.get $ref) ;; CHECK-NEXT: (ref.cast (ref noextern) - ;; CHECK-NEXT: (try $try (result externref) + ;; CHECK-NEXT: (try (result externref) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (struct.get $A 0 ;; CHECK-NEXT: (struct.new $A diff --git a/test/lit/passes/unsubtyping.wast b/test/lit/passes/unsubtyping.wast index 204b76ef7..368f935b9 100644 --- a/test/lit/passes/unsubtyping.wast +++ b/test/lit/passes/unsubtyping.wast @@ -311,7 +311,7 @@ ;; CHECK: (func $loop (type $2) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (loop $loop-in (result (ref $sub)) + ;; CHECK-NEXT: (loop (result (ref $sub)) ;; CHECK-NEXT: (struct.new_default $sub) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -829,7 +829,7 @@ ;; CHECK: (func $try (type $2) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try (result (ref $super)) + ;; CHECK-NEXT: (try (result (ref $super)) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (struct.new_default $sub) ;; CHECK-NEXT: ) @@ -865,7 +865,7 @@ ;; CHECK: (func $try-catch (type $2) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (try $try (result (ref $super)) + ;; CHECK-NEXT: (try (result (ref $super)) ;; CHECK-NEXT: (do ;; CHECK-NEXT: (struct.new_default $super) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/vacuum-eh-old.wast b/test/lit/passes/vacuum-eh-old.wast index 0215b5b25..125475e26 100644 --- a/test/lit/passes/vacuum-eh-old.wast +++ b/test/lit/passes/vacuum-eh-old.wast @@ -12,7 +12,7 @@ ;; CHECK: (tag $e2 (param i32)) (tag $e2 (param i32)) - (table $t funcref 0) + (table $t 0 funcref) ;; CHECK: (func $try-test (type $void) ;; CHECK-NEXT: (nop) @@ -31,7 +31,7 @@ ;; CHECK: (func $inner-try-catch_all-test (type $2) (result i32) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try0 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -69,9 +69,9 @@ ;; CHECK: (func $inner-try-catch-test (type $void) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try1 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e2 ;; CHECK-NEXT: (i32.const 0) @@ -139,9 +139,9 @@ ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (try $label$0 ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do - ;; CHECK-NEXT: (try $try2 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (throw $e ;; CHECK-NEXT: (i32.const 0) @@ -188,7 +188,7 @@ ;; CHECK: (func $trivial-catch-all-of-throw (type $void) ;; CHECK-NEXT: (local $0 i32) - ;; CHECK-NEXT: (try $try3 + ;; CHECK-NEXT: (try ;; CHECK-NEXT: (do ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) diff --git a/test/lit/validation/bulk.wast b/test/lit/validation/bulk.wast index 36d2841dd..5d6755c93 100644 --- a/test/lit/validation/bulk.wast +++ b/test/lit/validation/bulk.wast @@ -2,7 +2,7 @@ ;; RUN: not wasm-opt -all %s 2>&1 | filecheck %s -;; CHECK: unknown data segment +;; CHECK: data index out of bounds (module (memory $0 16) diff --git a/test/lit/wasm-split/multi-memory-lowering-import-error.wast b/test/lit/wasm-split/multi-memory-lowering-import-error.wast deleted file mode 100644 index f697db40b..000000000 --- a/test/lit/wasm-split/multi-memory-lowering-import-error.wast +++ /dev/null @@ -1,8 +0,0 @@ -;; RUN: not wasm-opt %s --multi-memory-lowering -all 2>&1 | filecheck %s - -(module - (memory $memory1 1) - (import "env" "mem" (memory $memory2 1 1)) -) - -;; CHECK: MultiMemoryLowering: only the first memory can be imported diff --git a/test/lld/standalone-wasm-with-start.wat b/test/lld/standalone-wasm-with-start.wat index 8767c8efb..45ba29c1e 100644 --- a/test/lld/standalone-wasm-with-start.wat +++ b/test/lld/standalone-wasm-with-start.wat @@ -10,8 +10,9 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $_start (result i32) - (nop) + (i32.const 0) + ) + (func $foo (result i32) + (i32.const 0) ) - (func $foo (result i32)) ) - diff --git a/test/lld/standalone-wasm-with-start.wat.out b/test/lld/standalone-wasm-with-start.wat.out index 01a351a7f..472940690 100644 --- a/test/lld/standalone-wasm-with-start.wat.out +++ b/test/lld/standalone-wasm-with-start.wat.out @@ -11,9 +11,9 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $_start (result i32) - (nop) + (i32.const 0) ) (func $foo (result i32) - (nop) + (i32.const 0) ) ) diff --git a/test/lld/standalone-wasm.wat b/test/lld/standalone-wasm.wat index 2ccbf3f29..16c4fffd0 100644 --- a/test/lld/standalone-wasm.wat +++ b/test/lld/standalone-wasm.wat @@ -10,11 +10,12 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $__original_main (result i32) - (nop) + (i32.const 0) ) (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main) ) - (func $foo (result i32)) + (func $foo (result i32) + (i32.const 0) + ) ) - diff --git a/test/lld/standalone-wasm.wat.out b/test/lld/standalone-wasm.wat.out index f5c18bc6a..867f2ad13 100644 --- a/test/lld/standalone-wasm.wat.out +++ b/test/lld/standalone-wasm.wat.out @@ -12,12 +12,12 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $__original_main (result i32) - (nop) + (i32.const 0) ) (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main) ) (func $foo (result i32) - (nop) + (i32.const 0) ) ) diff --git a/test/lld/standalone-wasm2.wat b/test/lld/standalone-wasm2.wat index f4c7843b6..b0abafcc2 100644 --- a/test/lld/standalone-wasm2.wat +++ b/test/lld/standalone-wasm2.wat @@ -8,10 +8,9 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $__original_main (param $0 i32) (param $1 i32) (result i32) - (nop) + (i32.const 0) ) (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main (local.get $0) (local.get $1)) ) ) - diff --git a/test/lld/standalone-wasm2.wat.out b/test/lld/standalone-wasm2.wat.out index 4b98b8500..1cc867e6c 100644 --- a/test/lld/standalone-wasm2.wat.out +++ b/test/lld/standalone-wasm2.wat.out @@ -9,7 +9,7 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $__original_main (param $0 i32) (param $1 i32) (result i32) - (nop) + (i32.const 0) ) (func $main (param $0 i32) (param $1 i32) (result i32) (call $__original_main diff --git a/test/lld/standalone-wasm3.wat b/test/lld/standalone-wasm3.wat index 45c0bed35..0e276d601 100644 --- a/test/lld/standalone-wasm3.wat +++ b/test/lld/standalone-wasm3.wat @@ -7,7 +7,6 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $__original_main (param $0 i32) (param $1 i32) (result i32) - (nop) + (i32.const 0) ) ) - diff --git a/test/lld/standalone-wasm3.wat.out b/test/lld/standalone-wasm3.wat.out index df88bf543..b93736881 100644 --- a/test/lld/standalone-wasm3.wat.out +++ b/test/lld/standalone-wasm3.wat.out @@ -8,6 +8,6 @@ (export "__heap_base" (global $global$1)) (export "__data_end" (global $global$2)) (func $__original_main (param $0 i32) (param $1 i32) (result i32) - (nop) + (i32.const 0) ) ) diff --git a/test/metadce/tag.wast.dced b/test/metadce/tag.wast.dced index dcaf51af3..6f07a4e75 100644 --- a/test/metadce/tag.wast.dced +++ b/test/metadce/tag.wast.dced @@ -4,7 +4,7 @@ (tag $t1) (export "test" (func $test)) (func $test (type $0) - (try $try + (try (do (throw $t0) ) diff --git a/test/passes/duplicate-function-elimination_optimize-level=1.txt b/test/passes/duplicate-function-elimination_optimize-level=1.txt index 1a7b938a6..a61abe722 100644 --- a/test/passes/duplicate-function-elimination_optimize-level=1.txt +++ b/test/passes/duplicate-function-elimination_optimize-level=1.txt @@ -88,7 +88,7 @@ (module (type $2 (func)) (type $3 (func (param i32))) - (type $S (func (result i32))) + (type $T (func (result i32))) (memory $0 0) (func $keep4-similar-but-func-sig-differs (drop @@ -412,12 +412,12 @@ ) ) (module - (type $S (func)) + (type $T (func)) (memory $0 0) (table $0 2 2 funcref) (elem $0 (i32.const 0) $keep2 $keep2) (func $keep2 - (call_indirect (type $S) + (call_indirect (type $T) (i32.const 0) ) ) diff --git a/test/passes/duplicate-function-elimination_optimize-level=2.txt b/test/passes/duplicate-function-elimination_optimize-level=2.txt index ab08b8f32..27ea0bffb 100644 --- a/test/passes/duplicate-function-elimination_optimize-level=2.txt +++ b/test/passes/duplicate-function-elimination_optimize-level=2.txt @@ -85,7 +85,7 @@ (module (type $2 (func)) (type $3 (func (param i32))) - (type $S (func (result i32))) + (type $T (func (result i32))) (memory $0 0) (func $keep4-similar-but-func-sig-differs (drop @@ -409,12 +409,12 @@ ) ) (module - (type $S (func)) + (type $T (func)) (memory $0 0) (table $0 2 2 funcref) (elem $0 (i32.const 0) $keep2 $keep2) (func $keep2 - (call_indirect (type $S) + (call_indirect (type $T) (i32.const 0) ) ) diff --git a/test/passes/log-execution.txt b/test/passes/log-execution.txt index 35ca7411e..f7c46b584 100644 --- a/test/passes/log-execution.txt +++ b/test/passes/log-execution.txt @@ -66,7 +66,7 @@ (call $log_execution (i32.const 7) ) - (loop $loop-in + (loop (call $log_execution (i32.const 6) ) diff --git a/test/passes/precompute_all-features.txt b/test/passes/precompute_all-features.txt index 2ec32c907..189adadce 100644 --- a/test/passes/precompute_all-features.txt +++ b/test/passes/precompute_all-features.txt @@ -63,7 +63,7 @@ ) ) (drop - (block $d2 (result i32) + (block $d1 (result i32) (call $x (i32.const 6) ) @@ -72,7 +72,7 @@ ) ) (drop - (block $d4 (result i32) + (block $d2 (result i32) (call $x (i32.const 7) ) diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index 2fd56cb9c..f3c1b7d77 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -251,15 +251,15 @@ ) ) ) - (block $a1 - (block $b2 - (block $c3 + (block $a0 + (block $b0 + (block $c0 ) ) ) - (block $a4 - (block $b5 - (block $c6 + (block $a1 + (block $b1 + (block $c1 ) ) ) @@ -281,7 +281,7 @@ (if (i32.const 0) (then - (block $a7 + (block $a0 (drop (i32.const 1) ) @@ -295,7 +295,7 @@ (if (i32.const 0) (then - (block $a9 + (block $a1 (block $block8 ) ) @@ -417,11 +417,11 @@ ) ) (if - (block $a17 (result i32) + (block $a0 (result i32) (i32.const 0) ) (then - (block $a18 + (block $a1 (block (drop (i32.const 1) @@ -430,7 +430,7 @@ ) ) (else - (block $a20 + (block $a2 (block (drop (i32.const 2) @@ -457,41 +457,41 @@ (i32.const 1) ) ) - (block $do-once$022 + (block $do-once$00 (if (call $b13) (then (drop (call $b14) ) - (br $do-once$022) + (br $do-once$00) ) ) (drop (i32.const 1) ) ) - (block $do-once$025 + (block $do-once$01 (if (i32.const 0) (then (drop (call $b14) ) - (br $do-once$025) + (br $do-once$01) ) ) (drop (i32.const 1) ) ) - (block $do-once$028 (result i32) + (block $do-once$02 (result i32) (if (local.tee $x (i32.const 1) ) (then - (br $do-once$028 + (br $do-once$02 (local.tee $x (i32.const 2) ) @@ -511,77 +511,77 @@ ) ) ) - (loop $in30 - (br $in30) + (loop $in0 + (br $in0) ) - (loop $loop-in - (block $out31 - (br_if $out31 + (loop + (block $out0 + (br_if $out0 (i32.const 0) ) ) ) - (loop $in33 - (block $out34 - (br_if $out34 + (loop $in1 + (block $out1 + (br_if $out1 (i32.const 0) ) ) ) - (loop $in36 + (loop $in2 (nop) ) - (loop $in37 - (block $out38 + (loop $in3 + (block $out2 ) ) - (loop $in39 + (loop $in4 (if (i32.eqz (i32.const 0) ) (then - (block $out40 + (block $out3 (nop) - (br_if $in39 + (br_if $in4 (i32.const 1) ) ) ) ) ) - (loop $in42 - (block $out43 - (br_if $in42 + (loop $in5 + (block $out4 + (br_if $in5 (i32.const 0) ) ) ) - (loop $in45 + (loop $in6 (if (i32.const 0) (then - (block $out46 + (block $out5 (unreachable) ) ) (else - (br $in45) + (br $in6) ) ) ) - (loop $in48 + (loop $in7 (if (i32.const 0) (then - (block $out49 + (block $out6 (block (call $loops) ) ) ) (else - (br $in48) + (br $in7) ) ) ) @@ -598,33 +598,33 @@ ) ) ) - (loop $in52 + (loop $in8 (if (i32.const 0) (then - (block $out53 + (block $out7 ) ) (else (call $loops) - (br $in52) + (br $in8) ) ) ) - (loop $in55 + (loop $in9 (if (i32.const 0) (then (call $loops) - (br $in55) + (br $in9) ) (else - (block $out56 + (block $out8 ) ) ) ) - (loop $in58 + (loop $in10 (if (i32.const 0) (then @@ -632,19 +632,19 @@ (i32.const 1) ) (call $loops) - (br $in58) + (br $in10) ) (else - (block $out59 + (block $out9 ) ) ) ) - (loop $in62 + (loop $in11 (if (i32.const 0) (then - (block $out63 + (block $out10 ) ) (else @@ -652,11 +652,11 @@ (drop (i32.const 100) ) - (br $in62) + (br $in11) ) ) ) - (loop $in65 + (loop $in12 (if (i32.const 0) (then @@ -664,15 +664,15 @@ (drop (i32.const 101) ) - (br $in65) + (br $in12) ) (else - (block $out66 + (block $out11 ) ) ) ) - (loop $in68 + (loop $in13 (if (i32.const 0) (then @@ -683,60 +683,60 @@ (drop (i32.const 102) ) - (br $in68) + (br $in13) ) (else - (block $out69 + (block $out12 ) ) ) ) - (loop $in72 + (loop $in14 (if (i32.eqz (i32.const 0) ) (then - (block $out73 + (block $out13 (nop) (call $loops) (return) - (br $in72) + (br $in14) ) ) ) ) - (loop $in75 - (block $out76 - (br_if $out76 + (loop $in15 + (block $out14 + (br_if $out14 (i32.const 0) ) (call $loops) - (br $out76) - (br $in75) + (br $out14) + (br $in15) ) ) - (loop $in78 + (loop $in16 (if (i32.const 0) (then - (block $out79 + (block $out15 ) ) (else (call $loops) (drop - (block $out2 (result i32) + (block $out20 (result i32) (i32.const 1) ) ) - (br $in78) + (br $in16) ) ) ) - (loop $in81 - (block $out82 - (br_if $in81 + (loop $in17 + (block $out16 + (br_if $in17 (i32.eqz (i32.const 0) ) @@ -756,18 +756,18 @@ ) ) ) - (loop $in83 - (block $out84 - (br $out84) - (br $in83) + (loop $in18 + (block $out17 + (br $out17) + (br $in18) ) ) - (loop $in85 - (block $out86 + (loop $in19 + (block $out18 (drop (i32.const 0) ) - (br $in85) + (br $in19) ) ) (loop $in-not @@ -782,11 +782,11 @@ (br $in-not) ) ) - (loop $in-todo287 + (loop $in-todo20 (if (i32.const 0) (then - (block $out-todo288 + (block $out-todo20 ) ) (else @@ -794,7 +794,7 @@ (drop (i32.const 1) ) - (br $in-todo287) + (br $in-todo20) ) ) ) @@ -2843,7 +2843,7 @@ ) ) (func $do-not-flow-values-through-unreachable-code-b (result i32) - (loop $loop-in + (loop (unreachable) (if (i32.const 0) diff --git a/test/passes/remove-unused-brs_shrink-level=1.txt b/test/passes/remove-unused-brs_shrink-level=1.txt index 06b4e4e72..24696cb83 100644 --- a/test/passes/remove-unused-brs_shrink-level=1.txt +++ b/test/passes/remove-unused-brs_shrink-level=1.txt @@ -123,11 +123,11 @@ ) ) ) - (block $out83 - (br_if $out83 + (block $out80 + (br_if $out80 (i32.const 1) ) - (br_if $out83 + (br_if $out80 (call $b14) ) ) diff --git a/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt b/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt index 8398d6ee6..82f76d359 100644 --- a/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt +++ b/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt @@ -115,11 +115,11 @@ ) ) ) - (block $out83 - (br_if $out83 + (block $out80 + (br_if $out80 (i32.const 1) ) - (br_if $out83 + (br_if $out80 (call $b14) ) ) diff --git a/test/passes/remove-unused-names.txt b/test/passes/remove-unused-names.txt index a48bfc135..bba63259a 100644 --- a/test/passes/remove-unused-names.txt +++ b/test/passes/remove-unused-names.txt @@ -17,34 +17,34 @@ (br $in0) ) (nop) - (block $out4 - (loop $in5 - (br $out4) - (br $in5) + (block $out1 + (loop $in3 + (br $out1) + (br $in3) ) ) - (block $out6 - (loop $in7 - (br $out6) - (br $in7) + (block $out2 + (loop $in4 + (br $out2) + (br $in4) ) ) - (loop $in8 - (block $out9 - (br $out9) - (br $in8) + (loop $in5 + (block $out3 + (br $out3) + (br $in5) ) ) - (loop $in10 - (block $out11 - (br $out11) - (br $in10) + (loop $in6 + (block $out4 + (br $out4) + (br $in6) ) ) - (block $out12 - (loop $in13 - (br $out12) - (br $in13) + (block $out5 + (loop $in7 + (br $out5) + (br $in7) ) ) ) @@ -53,13 +53,13 @@ (br $b) (br $b) ) - (block $b15 - (br_table $b15 $b15 + (block $b0 + (br_table $b0 $b0 (i32.const 3) ) ) - (block $b17 - (br_table $b17 $b17 + (block $b1 + (br_table $b1 $b1 (i32.const 3) ) ) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index 05f27ea4c..c1c803af5 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -166,14 +166,11 @@ (i32.const 20) ) ) - (return - (block - (drop - (i32.const 10) - ) - (unreachable) - ) + (drop + (i32.const 10) ) + (unreachable) + (return) ) (func $binary (type $3) (drop diff --git a/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.txt b/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.txt index 86849e493..474b59c35 100644 --- a/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.txt +++ b/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.txt @@ -1,6 +1,6 @@ (module (type $FUNCSIG$vj (func (param i32 i32))) - (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$j (func (result i32))) (type $2 (func (param i32) (result i32))) (type $3 (func (result f32))) (type $4 (func (param f32))) diff --git a/test/passes/simplify-locals-nonesting.txt b/test/passes/simplify-locals-nonesting.txt index a5dd4d343..8d1610d7d 100644 --- a/test/passes/simplify-locals-nonesting.txt +++ b/test/passes/simplify-locals-nonesting.txt @@ -88,7 +88,7 @@ (if (local.get $8) (then - (block $block1 + (block $block (nop) (nop) (nop) diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt index 0b7b4b705..befbe33ef 100644 --- a/test/passes/simplify-locals_all-features.txt +++ b/test/passes/simplify-locals_all-features.txt @@ -805,10 +805,10 @@ ) ) ) - (block $moar18 + (block $moar0 (local.set $y (block (result i32) - (br_if $moar18 + (br_if $moar0 (local.get $y) ) (i32.const 0) @@ -1497,7 +1497,7 @@ (unreachable) ) (nop) - (loop $loopy9 (result i32) + (loop $loopy0 (result i32) (nop) (i32.const 1) ) diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.txt b/test/passes/simplify-locals_all-features_disable-exception-handling.txt index e6986b1a7..111223c49 100644 --- a/test/passes/simplify-locals_all-features_disable-exception-handling.txt +++ b/test/passes/simplify-locals_all-features_disable-exception-handling.txt @@ -799,10 +799,10 @@ ) ) ) - (block $moar18 + (block $moar0 (local.set $y (block (result i32) - (br_if $moar18 + (br_if $moar0 (local.get $y) ) (i32.const 0) @@ -1491,7 +1491,7 @@ (unreachable) ) (nop) - (loop $loopy9 (result i32) + (loop $loopy0 (result i32) (nop) (i32.const 1) ) diff --git a/test/unit/test_poppy_validation.py b/test/unit/test_poppy_validation.py deleted file mode 100644 index a1a3a9c8d..000000000 --- a/test/unit/test_poppy_validation.py +++ /dev/null @@ -1,203 +0,0 @@ -import os - -from scripts.test import shared -from . import utils - - -class PoppyValidationTest(utils.BinaryenTestCase): - def check_invalid(self, module, error): - p = shared.run_process(shared.WASM_OPT + - ['--experimental-poppy', '--print', '-o', os.devnull], - input=module, check=False, capture_output=True) - self.assertIn(error, p.stderr) - self.assertIn('Fatal: error validating input', p.stderr) - self.assertNotEqual(p.returncode, 0) - - def check_valid(self, module): - p = shared.run_process(shared.WASM_OPT + - ['--experimental-poppy', '--print', '-o', os.devnull], - input=module, check=False, capture_output=True) - self.assertEqual(p.stderr, "") - self.assertEqual(p.returncode, 0) - - def test_top_level_pop(self): - module = ''' - (module - (func $foo (result i32) - (block (result i32) - (i32.const 0) - (pop i32) - ) - ) - ) - ''' - self.check_invalid(module, "Unexpected top-level pop in block") - - def test_top_level_pop_fixed(self): - module = ''' - (module - (func $foo (result i32) - (block (result i32) - (i32.const 0) - ) - ) - ) - ''' - self.check_valid(module) - - def test_incompatible_type(self): - module = ''' - (module - (func $foo (result i32) - (f32.const 42) - (i32.const 42) - (i32.add - (pop i32) - (pop i32) - ) - ) - ) - ''' - self.check_invalid(module, "block element has incompatible type") - self.check_invalid(module, "required: (tuple i32 i32), available: (tuple f32 i32)") - - def test_incorrect_pop_type(self): - module = ''' - (module - (func $foo (result i32) - (i32.const 42) - (i32.const 42) - (i32.add - (pop i32) - (pop f32) - ) - ) - ) - ''' - self.check_invalid(module, "binary child types must be equal") - - def test_incompatible_type_fixed(self): - module = ''' - (module - (func $foo (result i32) - (i32.const 42) - (i32.const 42) - (i32.add - (pop i32) - (pop i32) - ) - ) - ) - ''' - self.check_valid(module) - - def test_incorrect_block_type(self): - module = ''' - (module - (func $foo (result i32) - (f32.const 42) - (nop) - ) - ) - ''' - self.check_invalid(module, "block contents should satisfy block type") - - def test_nonblock_body(self): - module = ''' - (module - (func $foo (result f32) - (f32.const 42) - ) - ) - ''' - self.check_invalid(module, "Function body must be a block") - - def test_nonpop_if_condition(self): - module = ''' - (module - (func $foo - (nop) - (i32.const 1) - (if - (i32.const 42) - (then) - ) - ) - ) - ''' - self.check_invalid(module, "Expected condition to be a Pop") - - def test_nonblock_if_true(self): - module = ''' - (module - (func $foo - (nop) - (i32.const 1) - (if - (pop i32) - (then (nop)) - ) - ) - ) - ''' - self.check_invalid(module, "Expected control flow child to be a block") - - def test_nonblock_if_false(self): - module = ''' - (module - (func $foo - (nop) - (i32.const 1) - (if - (pop i32) - (then (block)) - (else (nop)) - ) - ) - ) - ''' - self.check_invalid(module, "Expected control flow child to be a block") - - def test_nonblock_if_fixed(self): - module = ''' - (module - (func $foo - (nop) - (i32.const 1) - (if - (pop i32) - (then) - (else) - ) - ) - ) - ''' - self.check_valid(module) - - def test_nonblock_loop_body(self): - module = ''' - (module - (func $foo - (nop) - (loop - (nop) - ) - ) - ) - ''' - self.check_invalid(module, "Expected control flow child to be a block") - - def test_nonpop_child(self): - module = ''' - (module - (func $foo (result i32) - (i32.const 42) - (i32.const 5) - (i32.add - (pop i32) - (i32.const -1) - ) - ) - ) - ''' - self.check_invalid(module, "Unexpected non-Pop child") |