diff options
author | Alon Zakai <azakai@google.com> | 2024-05-09 15:00:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 15:00:13 -0700 |
commit | 7b2e0190213487b5d2505fe86aa9bbbd30e80fcc (patch) | |
tree | 2ae614b27102d83452b0f075612c7558c4493aa6 /test | |
parent | 006181bb98118c70d36e84e6f1f72b5d60264817 (diff) | |
download | binaryen-7b2e0190213487b5d2505fe86aa9bbbd30e80fcc.tar.gz binaryen-7b2e0190213487b5d2505fe86aa9bbbd30e80fcc.tar.bz2 binaryen-7b2e0190213487b5d2505fe86aa9bbbd30e80fcc.zip |
[StackIR] Run StackIR during binary writing and not as a pass (#6568)
Previously we had passes --generate-stack-ir, --optimize-stack-ir, --print-stack-ir
that could be run like any other passes. After generating StackIR it was stashed on
the function and invalidated if we modified BinaryenIR. If it wasn't invalidated then
it was used during binary writing. This PR switches things so that we optionally
generate, optimize, and print StackIR only during binary writing. It also removes
all traces of StackIR from wasm.h - after this, StackIR is a feature of binary writing
(and printing) logic only.
This is almost NFC, but there are some minor noticeable differences:
1. We no longer print has StackIR in the text format when we see it is there. It
will not be there during normal printing, as it is only present during binary writing.
(but --print-stack-ir still works as before; as mentioned above it runs during writing).
2. --generate/optimize/print-stack-ir change from being passes to being flags that
control that behavior instead. As passes, their order on the commandline mattered,
while now it does not, and they only "globally" affect things during writing.
3. The C API changes slightly, as there is no need to pass it an option "optimize" to
the StackIR APIs. Whether we optimize is handled by --optimize-stack-ir which is
set like other optimization flags on the PassOptions object, so we don't need the
old option to those C APIs.
The main benefit here is simplifying the code, so we don't need to think about
StackIR in more places than just binary writing. That may also allow future
improvements to our usage of StackIR.
Diffstat (limited to 'test')
45 files changed, 291 insertions, 237 deletions
diff --git a/test/binaryen.js/hello-world.js.txt b/test/binaryen.js/hello-world.js.txt index 3f9296adf..70c94764a 100644 --- a/test/binaryen.js/hello-world.js.txt +++ b/test/binaryen.js/hello-world.js.txt @@ -16,7 +16,7 @@ optimized: (module (type $0 (func (param i32 i32) (result i32))) (export "adder" (func $adder)) - (func $adder (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + (func $adder (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) (local.get $1) diff --git a/test/binaryen.js/low-memory-unused.js.txt b/test/binaryen.js/low-memory-unused.js.txt index 99c682259..d9b10a3f6 100644 --- a/test/binaryen.js/low-memory-unused.js.txt +++ b/test/binaryen.js/low-memory-unused.js.txt @@ -32,7 +32,7 @@ (type $0 (func (param i32) (result i32))) (memory $0 1) (export "test" (func $test)) - (func $test (; has Stack IR ;) (param $0 i32) (result i32) + (func $test (param $0 i32) (result i32) (i32.load (i32.add (local.get $0) @@ -48,7 +48,7 @@ (type $0 (func (param i32) (result i32))) (memory $0 1) (export "test" (func $test)) - (func $test (; has Stack IR ;) (param $0 i32) (result i32) + (func $test (param $0 i32) (result i32) (i32.load offset=128 (local.get $0) ) diff --git a/test/binaryen.js/optimize-levels.js.txt b/test/binaryen.js/optimize-levels.js.txt index ed928fbef..4e2902079 100644 --- a/test/binaryen.js/optimize-levels.js.txt +++ b/test/binaryen.js/optimize-levels.js.txt @@ -38,7 +38,7 @@ shrinkLevel=1 (module (type $i (func (param i32) (result i32))) (export "test" (func $test)) - (func $test (; has Stack IR ;) (param $0 i32) (result i32) + (func $test (param $0 i32) (result i32) (local.get $0) ) ) @@ -60,7 +60,7 @@ shrinkLevel=1 (module (type $i (func (param i32) (result i32))) (export "test" (func $test)) - (func $test (; has Stack IR ;) (param $0 i32) (result i32) + (func $test (param $0 i32) (result i32) (local.get $0) ) ) diff --git a/test/binaryen.js/sieve.js.txt b/test/binaryen.js/sieve.js.txt index 46e5d3b39..e04b0bfe1 100644 --- a/test/binaryen.js/sieve.js.txt +++ b/test/binaryen.js/sieve.js.txt @@ -62,7 +62,7 @@ optimized: (type $0 (func (param i32) (result i32))) (memory $0 1 100) (export "sieve" (func $sieve)) - (func $sieve (; has Stack IR ;) (param $0 i32) (result i32) + (func $sieve (param $0 i32) (result i32) (local $1 i32) (if (i32.lt_u diff --git a/test/binaryen.js/stackir.js b/test/binaryen.js/stackir.js index d797aa6d8..dd503a53d 100644 --- a/test/binaryen.js/stackir.js +++ b/test/binaryen.js/stackir.js @@ -26,4 +26,5 @@ console.log("=== default ==="); console.log(module.emitStackIR()); console.log("=== optimize ==="); // should omit the second block -console.log(module.emitStackIR(true)); +binaryen.setOptimizeLevel(2); +console.log(module.emitStackIR()); diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index e5b614bec..66cf43290 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -2008,12 +2008,17 @@ void test_binaries() { BinaryenModuleWriteText(module, buffer, 1024); printf("module s-expr printed (in memory):\n%s\n", buffer); - // writ the s-expr representation to a pointer which is managed by the + // write the s-expr representation to a pointer which is managed by the // caller char* text = BinaryenModuleAllocateAndWriteText(module); printf("module s-expr printed (in memory, caller-owned):\n%s\n", text); free(text); + // write StackIR + text = BinaryenModuleAllocateAndWriteStackIR(module); + printf("module s-expr printed (StackIR):\n%s\n", text); + free(text); + BinaryenModuleDispose(module); } diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 8bdf1ba52..fe784a453 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -3140,6 +3140,16 @@ module s-expr printed (in memory, caller-owned): ) ) +module s-expr printed (StackIR): +(module + (type $0 (func (param i32 i32) (result i32))) + (func $adder (param $0 i32) (param $1 i32) (result i32) + local.get $0 + local.get $1 + i32.add + ) +) + (module (type $0 (func (param i32))) (type $1 (func)) diff --git a/test/example/relooper-fuzz.txt b/test/example/relooper-fuzz.txt index 1030fac32..e4c3f6db4 100644 --- a/test/example/relooper-fuzz.txt +++ b/test/example/relooper-fuzz.txt @@ -311,7 +311,7 @@ (memory $0 1 1) (export "mem" (memory $0)) (start $main) - (func $check (; has Stack IR ;) (result i32) + (func $check (result i32) (if (i32.eq (i32.load @@ -348,7 +348,7 @@ ) ) ) - (func $main (; has Stack IR ;) + (func $main (local $0 i32) (local $1 i32) (i32.store diff --git a/test/example/relooper-fuzz1.txt b/test/example/relooper-fuzz1.txt index 3cdb12e69..675d51042 100644 --- a/test/example/relooper-fuzz1.txt +++ b/test/example/relooper-fuzz1.txt @@ -293,7 +293,7 @@ (memory $0 1 1) (export "mem" (memory $0)) (start $main) - (func $check (; has Stack IR ;) (result i32) + (func $check (result i32) (if (i32.eq (i32.load @@ -330,7 +330,7 @@ ) ) ) - (func $main (; has Stack IR ;) + (func $main (local $0 i32) (i32.store (i32.const 8) diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test index bf12fc1cf..09e5b7c9d 100644 --- a/test/lit/help/wasm-as.test +++ b/test/lit/help/wasm-as.test @@ -126,6 +126,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test index bbf8e1daa..e511ef0b9 100644 --- a/test/lit/help/wasm-ctor-eval.test +++ b/test/lit/help/wasm-ctor-eval.test @@ -133,6 +133,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test index f1f8283c8..2dffcc945 100644 --- a/test/lit/help/wasm-dis.test +++ b/test/lit/help/wasm-dis.test @@ -119,6 +119,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test index 8666c2ea1..a4ba48b16 100644 --- a/test/lit/help/wasm-emscripten-finalize.test +++ b/test/lit/help/wasm-emscripten-finalize.test @@ -161,6 +161,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-merge.test b/test/lit/help/wasm-merge.test index 997923256..c87be5edf 100644 --- a/test/lit/help/wasm-merge.test +++ b/test/lit/help/wasm-merge.test @@ -149,6 +149,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test index 4d706dc0f..f0889eb81 100644 --- a/test/lit/help/wasm-metadce.test +++ b/test/lit/help/wasm-metadce.test @@ -174,6 +174,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index f7ee47c09..f6497618e 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -182,8 +182,6 @@ ;; CHECK-NEXT: without JavaScript BigInt ;; CHECK-NEXT: support). ;; CHECK-NEXT: -;; CHECK-NEXT: --generate-stack-ir generate Stack IR -;; CHECK-NEXT: ;; CHECK-NEXT: --global-refining refine the types of globals ;; CHECK-NEXT: ;; CHECK-NEXT: --gsi globally optimize struct values @@ -333,8 +331,6 @@ ;; CHECK-NEXT: --optimize-j2cl optimizes J2CL specific ;; CHECK-NEXT: constructs. ;; CHECK-NEXT: -;; CHECK-NEXT: --optimize-stack-ir optimize Stack IR -;; CHECK-NEXT: ;; CHECK-NEXT: --outlining outline instructions ;; CHECK-NEXT: ;; CHECK-NEXT: --pick-load-signs pick load signs based on their @@ -369,9 +365,6 @@ ;; CHECK-NEXT: --print-minified print in minified s-expression ;; CHECK-NEXT: format ;; CHECK-NEXT: -;; CHECK-NEXT: --print-stack-ir print out Stack IR (useful for -;; CHECK-NEXT: internal debugging) -;; CHECK-NEXT: ;; CHECK-NEXT: --propagate-debug-locs propagate debug location from ;; CHECK-NEXT: parents or previous siblings to ;; CHECK-NEXT: child nodes @@ -746,6 +739,12 @@ ;; CHECK-NEXT: in, but not inspect their ;; CHECK-NEXT: contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test index e28894e4a..a98b8a199 100644 --- a/test/lit/help/wasm-reduce.test +++ b/test/lit/help/wasm-reduce.test @@ -155,6 +155,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index e7b287fcc..fcd919ea8 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -235,6 +235,12 @@ ;; CHECK-NEXT: them and pass them back in, but not ;; CHECK-NEXT: inspect their contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index 4b0330db6..13e93c33b 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -132,8 +132,6 @@ ;; CHECK-NEXT: without JavaScript BigInt ;; CHECK-NEXT: support). ;; CHECK-NEXT: -;; CHECK-NEXT: --generate-stack-ir generate Stack IR -;; CHECK-NEXT: ;; CHECK-NEXT: --global-refining refine the types of globals ;; CHECK-NEXT: ;; CHECK-NEXT: --gsi globally optimize struct values @@ -283,8 +281,6 @@ ;; CHECK-NEXT: --optimize-j2cl optimizes J2CL specific ;; CHECK-NEXT: constructs. ;; CHECK-NEXT: -;; CHECK-NEXT: --optimize-stack-ir optimize Stack IR -;; CHECK-NEXT: ;; CHECK-NEXT: --outlining outline instructions ;; CHECK-NEXT: ;; CHECK-NEXT: --pick-load-signs pick load signs based on their @@ -319,9 +315,6 @@ ;; CHECK-NEXT: --print-minified print in minified s-expression ;; CHECK-NEXT: format ;; CHECK-NEXT: -;; CHECK-NEXT: --print-stack-ir print out Stack IR (useful for -;; CHECK-NEXT: internal debugging) -;; CHECK-NEXT: ;; CHECK-NEXT: --propagate-debug-locs propagate debug location from ;; CHECK-NEXT: parents or previous siblings to ;; CHECK-NEXT: child nodes @@ -696,6 +689,12 @@ ;; CHECK-NEXT: in, but not inspect their ;; CHECK-NEXT: contents or call them. ;; CHECK-NEXT: +;; CHECK-NEXT: --generate-stack-ir generate StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --optimize-stack-ir optimize StackIR during writing +;; CHECK-NEXT: +;; CHECK-NEXT: --print-stack-ir print StackIR during writing +;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- diff --git a/test/lit/passes/O.wast b/test/lit/passes/O.wast index 7affbb8b7..baba79ee0 100644 --- a/test/lit/passes/O.wast +++ b/test/lit/passes/O.wast @@ -20,7 +20,7 @@ ;; CHECK: (export "end-if-else-call" (func $end-if-else-call)) - ;; CHECK: (func $ret (; has Stack IR ;) (result i32) + ;; CHECK: (func $ret (result i32) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (call $ret) ;; CHECK-NEXT: ) @@ -50,7 +50,7 @@ (unreachable) ) ) - ;; CHECK: (func $if-0-unreachable-to-none (; has Stack IR ;) (param $0 i64) + ;; CHECK: (func $if-0-unreachable-to-none (param $0 i64) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $if-0-unreachable-to-none (export "waka") (param $var$0 i64) @@ -68,7 +68,7 @@ ) ) ) - ;; CHECK: (func $many-selects (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $many-selects (param $0 i32) (result i32) ;; CHECK-NEXT: (select ;; CHECK-NEXT: (i32.const -1073741824) ;; CHECK-NEXT: (select @@ -112,7 +112,7 @@ ) (local.get $0) ) - ;; CHECK: (func $end-if-else (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $end-if-else (param $0 i32) (result i32) ;; CHECK-NEXT: (select ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: (local.get $0) @@ -130,7 +130,7 @@ ) (local.get $x) ) - ;; CHECK: (func $end-if-else-call (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $end-if-else-call (param $0 i32) (result i32) ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (then diff --git a/test/lit/passes/O1_skip.wast b/test/lit/passes/O1_skip.wast index 2cefecdcf..54d6a6843 100644 --- a/test/lit/passes/O1_skip.wast +++ b/test/lit/passes/O1_skip.wast @@ -46,7 +46,7 @@ ) ;; CHECK: (export "foo" (func $foo)) -;; CHECK: (func $foo (; has Stack IR ;) (param $p i32) +;; CHECK: (func $foo (param $p i32) ;; CHECK-NEXT: (local $x i32) ;; CHECK-NEXT: (local $y i32) ;; CHECK-NEXT: (call $log diff --git a/test/lit/passes/O3_Oz.wast b/test/lit/passes/O3_Oz.wast index 48345663e..cc129c964 100644 --- a/test/lit/passes/O3_Oz.wast +++ b/test/lit/passes/O3_Oz.wast @@ -14,7 +14,7 @@ ;; CHECK: (export "export" (func $export)) - ;; CHECK: (func $export (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $export (param $0 i32) (result i32) ;; CHECK-NEXT: (i32.add ;; CHECK-NEXT: (local.tee $0 ;; CHECK-NEXT: (i32.add 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 7037baf7d..830008e2f 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 @@ -22,7 +22,7 @@ ;; CHECK: (export "memory" (memory $memory)) - ;; CHECK: (func $fib (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $fib (param $0 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.le_s ;; CHECK-NEXT: (local.get $0) @@ -76,7 +76,7 @@ ) ) ) - ;; CHECK: (func $looped (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $looped (param $0 i32) (result i32) ;; CHECK-NEXT: (loop $L0 ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.ge_s @@ -123,7 +123,7 @@ ) ) - ;; CHECK: (func $t1 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $t1 (param $0 i32) (result i32) ;; CHECK-NEXT: (local.set $0 ;; CHECK-NEXT: (i32.add ;; CHECK-NEXT: (local.get $0) @@ -157,7 +157,7 @@ ) ) ) - ;; CHECK: (func $t2 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $t2 (param $0 i32) (result i32) ;; CHECK-NEXT: (call $fib ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -168,7 +168,7 @@ ) ) - ;; CHECK: (func $t3 (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $t3 (param $0 i32) (result i32) ;; CHECK-NEXT: (call $fib ;; CHECK-NEXT: (i32.add ;; CHECK-NEXT: (local.get $0) diff --git a/test/lit/passes/O4_disable-bulk-memory.wast b/test/lit/passes/O4_disable-bulk-memory.wast index 0cafb1d5d..d75258a96 100644 --- a/test/lit/passes/O4_disable-bulk-memory.wast +++ b/test/lit/passes/O4_disable-bulk-memory.wast @@ -9,7 +9,7 @@ (global $global$0 (mut i32) (i32.const 10)) ;; CHECK: (export "func_59_invoker" (func $0)) (export "func_59_invoker" (func $0)) - ;; CHECK: (func $0 (; has Stack IR ;) + ;; CHECK: (func $0 ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $0 (; 0 ;) (type $0) @@ -226,7 +226,7 @@ ) (local.get $0) ) - ;; CHECK: (func $~lib/allocator/arena/__memory_allocate (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $~lib/allocator/arena/__memory_allocate (param $0 i32) (result i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) ;; CHECK-NEXT: (local $3 i32) @@ -569,7 +569,7 @@ ) (local.get $0) ) - ;; CHECK: (func $assembly/index/Body#constructor (; has Stack IR ;) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32) + ;; CHECK: (func $assembly/index/Body#constructor (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (result i32) ;; CHECK-NEXT: (local $7 i32) ;; CHECK-NEXT: (f64.store ;; CHECK-NEXT: (local.tee $7 @@ -1299,7 +1299,7 @@ (local.get $5) ) ) - ;; CHECK: (func $assembly/index/init (; has Stack IR ;) + ;; CHECK: (func $assembly/index/init ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) @@ -1873,7 +1873,7 @@ ) ) ) - ;; CHECK: (func $assembly/index/NBodySystem#advance (; has Stack IR ;) (param $0 i32) + ;; CHECK: (func $assembly/index/NBodySystem#advance (param $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 f64) ;; CHECK-NEXT: (local $3 i32) @@ -2723,7 +2723,7 @@ ) (local.get $7) ) - ;; CHECK: (func $assembly/index/step (; has Stack IR ;) (result f64) + ;; CHECK: (func $assembly/index/step (result f64) ;; CHECK-NEXT: (local $0 f64) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (local $2 i32) @@ -2933,7 +2933,7 @@ (global.get $global$5) ) ) - ;; CHECK: (func $assembly/index/bench (; has Stack IR ;) (param $0 i32) + ;; CHECK: (func $assembly/index/bench (param $0 i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (block $label$1 ;; CHECK-NEXT: (loop $label$2 @@ -2985,7 +2985,7 @@ ) ) ) - ;; CHECK: (func $assembly/index/getBody (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $assembly/index/getBody (param $0 i32) (result i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (if (result i32) ;; CHECK-NEXT: (i32.lt_u @@ -3065,7 +3065,7 @@ ) ) ) - ;; CHECK: (func $start (; has Stack IR ;) + ;; CHECK: (func $start ;; CHECK-NEXT: (global.set $global$0 ;; CHECK-NEXT: (i32.const 104) ;; CHECK-NEXT: ) @@ -3076,7 +3076,7 @@ (func $start (; 26 ;) (type $0) (call $start:assembly/index) ) - ;; CHECK: (func $null (; has Stack IR ;) + ;; CHECK: (func $null ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $null (; 27 ;) (type $0) diff --git a/test/lit/passes/O_fast-math.wast b/test/lit/passes/O_fast-math.wast index 722f44a05..a964edc99 100644 --- a/test/lit/passes/O_fast-math.wast +++ b/test/lit/passes/O_fast-math.wast @@ -37,7 +37,7 @@ ;; CHECK: (export "abs_sub_zero2" (func $abs_sub_zero2)) - ;; CHECK: (func $div (; has Stack IR ;) (result f32) + ;; CHECK: (func $div (result f32) ;; CHECK-NEXT: (f32.const -nan:0x23017a) ;; CHECK-NEXT: ) (func $div (export "div") (result f32) @@ -46,7 +46,7 @@ (f32.const 1) ) ) - ;; CHECK: (func $mul1 (; has Stack IR ;) (result f32) + ;; CHECK: (func $mul1 (result f32) ;; CHECK-NEXT: (f32.const -nan:0x34546d) ;; CHECK-NEXT: ) (func $mul1 (export "mul1") (result f32) @@ -55,7 +55,7 @@ (f32.const 1) ) ) - ;; CHECK: (func $mul2 (; has Stack IR ;) (result f32) + ;; CHECK: (func $mul2 (result f32) ;; CHECK-NEXT: (f32.const nan:0x400000) ;; CHECK-NEXT: ) (func $mul2 (export "mul2") (result f32) @@ -100,7 +100,7 @@ (f32.const -0) ) ) - ;; CHECK: (func $mul_neg_one1 (; has Stack IR ;) (param $0 f32) (result f32) + ;; CHECK: (func $mul_neg_one1 (param $0 f32) (result f32) ;; CHECK-NEXT: (f32.neg ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -111,7 +111,7 @@ (f32.const -1) ) ) - ;; CHECK: (func $mul_neg_one2 (; has Stack IR ;) (param $0 f64) (result f64) + ;; CHECK: (func $mul_neg_one2 (param $0 f64) (result f64) ;; CHECK-NEXT: (f64.neg ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -122,7 +122,7 @@ (f64.const -1) ) ) - ;; CHECK: (func $abs_sub_zero1 (; has Stack IR ;) (param $0 f32) (result f32) + ;; CHECK: (func $abs_sub_zero1 (param $0 f32) (result f32) ;; CHECK-NEXT: (f32.abs ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -136,7 +136,7 @@ ) ) ) - ;; CHECK: (func $abs_sub_zero2 (; has Stack IR ;) (param $0 f64) (result f64) + ;; CHECK: (func $abs_sub_zero2 (param $0 f64) (result f64) ;; CHECK-NEXT: (f64.abs ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/Oz.wast b/test/lit/passes/Oz.wast index 8c1db3083..eab5a95af 100644 --- a/test/lit/passes/Oz.wast +++ b/test/lit/passes/Oz.wast @@ -37,7 +37,7 @@ ;; CHECK: (export "precompute-simd" (func $precompute-simd)) - ;; CHECK: (func $basics (type $0) (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + ;; CHECK: (func $basics (type $0) (param $0 i32) (param $1 i32) (result i32) ;; CHECK-NEXT: (i32.add ;; CHECK-NEXT: (local.tee $0 ;; CHECK-NEXT: (i32.add @@ -59,7 +59,7 @@ ) (i32.add (local.get $x2) (local.get $y2)) ) - ;; CHECK: (func $8 (type $2) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + ;; CHECK: (func $8 (type $2) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) ;; CHECK-NEXT: (i32.store ;; CHECK-NEXT: (local.tee $0 ;; CHECK-NEXT: (i32.add @@ -131,7 +131,7 @@ ) ) - ;; CHECK: (func $9 (type $1) (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $9 (type $1) (param $0 i32) (result i32) ;; CHECK-NEXT: (i32.mul ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (i32.const -4) @@ -147,7 +147,7 @@ ) ) - ;; CHECK: (func $10 (type $1) (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $10 (type $1) (param $0 i32) (result i32) ;; CHECK-NEXT: (i32.shl ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (i32.const 31) @@ -163,7 +163,7 @@ ) ) - ;; CHECK: (func $11 (type $1) (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK: (func $11 (type $1) (param $0 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (then @@ -201,7 +201,7 @@ ) (i32.const 0) ) - ;; CHECK: (func $12 (type $0) (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + ;; CHECK: (func $12 (type $0) (param $0 i32) (param $1 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (then @@ -239,7 +239,7 @@ ) (i32.const 0) ) - ;; CHECK: (func $13 (type $0) (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + ;; CHECK: (func $13 (type $0) (param $0 i32) (param $1 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (select ;; CHECK-NEXT: (local.get $1) @@ -268,7 +268,7 @@ (i32.const 0) ) - ;; CHECK: (func $14 (type $0) (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + ;; CHECK: (func $14 (type $0) (param $0 i32) (param $1 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (select ;; CHECK-NEXT: (i32.const 0) @@ -297,7 +297,7 @@ (i32.const 0) ) - ;; CHECK: (func $precompute-simd (type $3) (; has Stack IR ;) (result v128) + ;; CHECK: (func $precompute-simd (type $3) (result v128) ;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) ;; CHECK-NEXT: ) (func $precompute-simd (export "precompute-simd") (result v128) diff --git a/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast b/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast index 99ac2c05f..ec31a4118 100644 --- a/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast +++ b/test/lit/passes/asyncify_mod-asyncify-always-and-only-unwind_O.wast @@ -42,7 +42,7 @@ ;; CHECK: (export "asyncify_get_state" (func $asyncify_get_state)) - ;; CHECK: (func $calls-import (; has Stack IR ;) + ;; CHECK: (func $calls-import ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (call $import) ;; CHECK-NEXT: (i32.store @@ -76,7 +76,7 @@ (drop (i32.eqz (i32.const 17))) ) ) -;; CHECK: (func $asyncify_start_unwind (; has Stack IR ;) (param $0 i32) +;; CHECK: (func $asyncify_start_unwind (param $0 i32) ;; CHECK-NEXT: (global.set $__asyncify_state ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) @@ -98,7 +98,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK: (func $asyncify_stop_unwind (; has Stack IR ;) +;; CHECK: (func $asyncify_stop_unwind ;; CHECK-NEXT: (global.set $__asyncify_state ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -117,7 +117,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK: (func $asyncify_start_rewind (; has Stack IR ;) (param $0 i32) +;; CHECK: (func $asyncify_start_rewind (param $0 i32) ;; CHECK-NEXT: (global.set $__asyncify_state ;; CHECK-NEXT: (i32.const 2) ;; CHECK-NEXT: ) @@ -139,6 +139,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK: (func $asyncify_get_state (; has Stack IR ;) (result i32) +;; CHECK: (func $asyncify_get_state (result i32) ;; CHECK-NEXT: (global.get $__asyncify_state) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast b/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast index 38a54ea80..eefdabe34 100644 --- a/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast +++ b/test/lit/passes/asyncify_mod-asyncify-never-unwind_O.wast @@ -41,7 +41,7 @@ ;; CHECK: (export "asyncify_get_state" (func $asyncify_get_state)) - ;; CHECK: (func $calls-import (; has Stack IR ;) + ;; CHECK: (func $calls-import ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.or ;; CHECK-NEXT: (i32.eqz @@ -95,7 +95,7 @@ (drop (i32.eqz (i32.const 17))) ) ) -;; CHECK: (func $asyncify_start_unwind (; has Stack IR ;) (param $0 i32) +;; CHECK: (func $asyncify_start_unwind (param $0 i32) ;; CHECK-NEXT: (global.set $__asyncify_state ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) @@ -117,7 +117,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK: (func $asyncify_stop_unwind (; has Stack IR ;) +;; CHECK: (func $asyncify_stop_unwind ;; CHECK-NEXT: (global.set $__asyncify_state ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) @@ -136,7 +136,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK: (func $asyncify_start_rewind (; has Stack IR ;) (param $0 i32) +;; CHECK: (func $asyncify_start_rewind (param $0 i32) ;; CHECK-NEXT: (global.set $__asyncify_state ;; CHECK-NEXT: (i32.const 2) ;; CHECK-NEXT: ) @@ -158,6 +158,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) -;; CHECK: (func $asyncify_get_state (; has Stack IR ;) (result i32) +;; CHECK: (func $asyncify_get_state (result i32) ;; CHECK-NEXT: (global.get $__asyncify_state) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/flatten_dfo_O3_enable-threads.wast b/test/lit/passes/flatten_dfo_O3_enable-threads.wast index 34142b73f..3e2dfb539 100644 --- a/test/lit/passes/flatten_dfo_O3_enable-threads.wast +++ b/test/lit/passes/flatten_dfo_O3_enable-threads.wast @@ -28,7 +28,7 @@ ;; CHECK: (export "dfo-tee-get" (func $dfo-tee-get)) - ;; CHECK: (func $one (; has Stack IR ;) + ;; CHECK: (func $one ;; CHECK-NEXT: (block $label$3 ;; CHECK-NEXT: (br_if $label$3 ;; CHECK-NEXT: (i32.load @@ -56,7 +56,7 @@ ) (unreachable) ) - ;; CHECK: (func $two (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + ;; CHECK: (func $two (param $0 i32) (param $1 i32) (result i32) ;; CHECK-NEXT: (i32.const 0) ;; CHECK-NEXT: ) (func $two (export "two") (param $var$0 i32) (param $var$1 i32) (result i32) @@ -110,7 +110,7 @@ (nop) (i32.const 0) ) - ;; CHECK: (func $use-var (; has Stack IR ;) (param $0 i64) (param $1 i32) (result f64) + ;; CHECK: (func $use-var (param $0 i64) (param $1 i32) (result f64) ;; CHECK-NEXT: (loop $label$8 ;; CHECK-NEXT: (br_if $label$8 ;; CHECK-NEXT: (local.get $1) @@ -184,7 +184,7 @@ ) (unreachable) ) - ;; CHECK: (func $bad1 (; has Stack IR ;) + ;; CHECK: (func $bad1 ;; CHECK-NEXT: (i32.store ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: (i32.const -16384) @@ -236,7 +236,7 @@ ) ) ) - ;; CHECK: (func $only-dfo (; has Stack IR ;) (param $0 f64) (result f64) + ;; CHECK: (func $only-dfo (param $0 f64) (result f64) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (loop $label$1 ;; CHECK-NEXT: (br $label$1) @@ -270,7 +270,7 @@ (br $label$1) ) ) - ;; CHECK: (func $dfo-tee-get (; has Stack IR ;) (result i32) + ;; CHECK: (func $dfo-tee-get (result i32) ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: ) (func $dfo-tee-get (export "dfo-tee-get") (result i32) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast b/test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast index 142fabeea..2c033e0fe 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast @@ -25,7 +25,7 @@ ;; CHECK: (export "only-dfo" (func $only-dfo)) - ;; CHECK: (func $if-select (; has Stack IR ;) + ;; CHECK: (func $if-select ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $if-select (export "if-select") @@ -47,7 +47,7 @@ ) ) ) - ;; CHECK: (func $unreachable-body-update-zext (; has Stack IR ;) (result f64) + ;; CHECK: (func $unreachable-body-update-zext (result f64) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $unreachable-body-update-zext (export "unreachable-body-update-zext") (result f64) @@ -61,7 +61,7 @@ ) (f64.const -9223372036854775808) ) - ;; CHECK: (func $ssa-const (; has Stack IR ;) (param $0 i32) (param $1 f64) (param $2 f64) (result i32) + ;; CHECK: (func $ssa-const (param $0 i32) (param $1 f64) (param $2 f64) (result i32) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $ssa-const (export "ssa-const") (param $var$0 i32) (param $var$1 f64) (param $var$2 f64) (result i32) @@ -99,7 +99,7 @@ ) ) ) - ;; CHECK: (func $if-nothing (; has Stack IR ;) (param $0 i64) + ;; CHECK: (func $if-nothing (param $0 i64) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $if-nothing (export "if-nothing") (param $var$0 i64) @@ -130,7 +130,7 @@ (unreachable) ) ) - ;; CHECK: (func $only-dfo (; has Stack IR ;) (param $0 f64) (result i32) + ;; CHECK: (func $only-dfo (param $0 f64) (result i32) ;; CHECK-NEXT: (local $1 i32) ;; CHECK-NEXT: (loop $label$1 ;; CHECK-NEXT: (if diff --git a/test/lit/passes/global-effects-O.wast b/test/lit/passes/global-effects-O.wast index c24159eac..c7ba06781 100644 --- a/test/lit/passes/global-effects-O.wast +++ b/test/lit/passes/global-effects-O.wast @@ -56,13 +56,13 @@ ;; CHECK_1: (func $main (type $0) ;; CHECK_1-NEXT: (nop) ;; CHECK_1-NEXT: ) - ;; CHECK_3: (func $main (type $0) (; has Stack IR ;) + ;; CHECK_3: (func $main (type $0) ;; CHECK_3-NEXT: (nop) ;; CHECK_3-NEXT: ) - ;; CHECK_s: (func $main (type $0) (; has Stack IR ;) + ;; CHECK_s: (func $main (type $0) ;; CHECK_s-NEXT: (nop) ;; CHECK_s-NEXT: ) - ;; CHECK_O: (func $main (type $0) (; has Stack IR ;) + ;; CHECK_O: (func $main (type $0) ;; CHECK_O-NEXT: (nop) ;; CHECK_O-NEXT: ) (func $main @@ -119,7 +119,7 @@ ;; CHECK_1-NEXT: (local.get $0) ;; CHECK_1-NEXT: ) ;; CHECK_1-NEXT: ) - ;; CHECK_3: (func $pointless-work (type $1) (; has Stack IR ;) (result i32) + ;; CHECK_3: (func $pointless-work (type $1) (result i32) ;; CHECK_3-NEXT: (local $0 i32) ;; CHECK_3-NEXT: (loop $loop (result i32) ;; CHECK_3-NEXT: (br_if $loop @@ -136,7 +136,7 @@ ;; CHECK_3-NEXT: (local.get $0) ;; CHECK_3-NEXT: ) ;; CHECK_3-NEXT: ) - ;; CHECK_s: (func $pointless-work (type $1) (; has Stack IR ;) (result i32) + ;; CHECK_s: (func $pointless-work (type $1) (result i32) ;; CHECK_s-NEXT: (local $0 i32) ;; CHECK_s-NEXT: (loop $loop (result i32) ;; CHECK_s-NEXT: (br_if $loop @@ -153,7 +153,7 @@ ;; CHECK_s-NEXT: (local.get $0) ;; CHECK_s-NEXT: ) ;; CHECK_s-NEXT: ) - ;; CHECK_O: (func $pointless-work (type $1) (; has Stack IR ;) (result i32) + ;; CHECK_O: (func $pointless-work (type $1) (result i32) ;; CHECK_O-NEXT: (local $0 i32) ;; CHECK_O-NEXT: (loop $loop (result i32) ;; CHECK_O-NEXT: (br_if $loop diff --git a/test/lit/passes/gto_and_cfp_in_O.wast b/test/lit/passes/gto_and_cfp_in_O.wast index a723038eb..b1e9a47df 100644 --- a/test/lit/passes/gto_and_cfp_in_O.wast +++ b/test/lit/passes/gto_and_cfp_in_O.wast @@ -26,7 +26,7 @@ ;; OPEN_WORLD: (export "main" (func $main)) - ;; OPEN_WORLD: (func $by-ref (type $1) (; has Stack IR ;) + ;; OPEN_WORLD: (func $by-ref (type $1) ;; OPEN_WORLD-NEXT: (struct.set $struct 1 ;; OPEN_WORLD-NEXT: (global.get $glob) ;; OPEN_WORLD-NEXT: (i32.const 200) @@ -49,10 +49,10 @@ ;; CHECK: (export "main" (func $main)) - ;; CHECK: (func $main (type $0) (; has Stack IR ;) (result i32) + ;; CHECK: (func $main (type $0) (result i32) ;; CHECK-NEXT: (i32.const 100) ;; CHECK-NEXT: ) - ;; OPEN_WORLD: (func $main (type $2) (; has Stack IR ;) (result i32) + ;; OPEN_WORLD: (func $main (type $2) (result i32) ;; OPEN_WORLD-NEXT: (struct.get $struct 1 ;; OPEN_WORLD-NEXT: (global.get $glob) ;; OPEN_WORLD-NEXT: ) diff --git a/test/lit/passes/type-ssa_and_merging.wast b/test/lit/passes/type-ssa_and_merging.wast index 670de31ac..8928820bf 100644 --- a/test/lit/passes/type-ssa_and_merging.wast +++ b/test/lit/passes/type-ssa_and_merging.wast @@ -33,7 +33,7 @@ ;; NOP: (export "main2" (func $main2)) - ;; NOP: (func $main1 (type $2) (; has Stack IR ;) (result i32) + ;; NOP: (func $main1 (type $2) (result i32) ;; NOP-NEXT: (call $get-a-1 ;; NOP-NEXT: (struct.new $A ;; NOP-NEXT: (i32.const 42) @@ -57,7 +57,7 @@ ) ) - ;; NOP: (func $main2 (type $2) (; has Stack IR ;) (result i32) + ;; NOP: (func $main2 (type $2) (result i32) ;; NOP-NEXT: (call $get-a-2 ;; NOP-NEXT: (struct.new $A ;; NOP-NEXT: (i32.const 1337) @@ -77,7 +77,7 @@ ) ) - ;; NOP: (func $get-a-1 (type $0) (; has Stack IR ;) (param $0 (ref $A)) (result i32) + ;; NOP: (func $get-a-1 (type $0) (param $0 (ref $A)) (result i32) ;; NOP-NEXT: (if ;; NOP-NEXT: (call $import) ;; NOP-NEXT: (then @@ -119,7 +119,7 @@ (struct.get $A 0 (local.get 0)) ) - ;; NOP: (func $get-a-2 (type $0) (; has Stack IR ;) (param $0 (ref $A)) (result i32) + ;; NOP: (func $get-a-2 (type $0) (param $0 (ref $A)) (result i32) ;; NOP-NEXT: (if ;; NOP-NEXT: (call $import) ;; NOP-NEXT: (then diff --git a/test/passes/O.bin.txt b/test/passes/O.bin.txt index d35a4d11c..3302ebcc7 100644 --- a/test/passes/O.bin.txt +++ b/test/passes/O.bin.txt @@ -5,7 +5,7 @@ (export "fac-iter" (func $2)) (export "fac-iter-named" (func $3)) (export "fac-opt" (func $4)) - (func $0 (; has Stack IR ;) (param $0 i64) (result i64) + (func $0 (param $0 i64) (result i64) (if (result i64) (i64.eqz (local.get $0) @@ -26,7 +26,7 @@ ) ) ) - (func $1 (; has Stack IR ;) (param $0 i64) (result i64) + (func $1 (param $0 i64) (result i64) (if (result i64) (i64.eqz (local.get $0) @@ -47,10 +47,10 @@ ) ) ) - (func $2 (; has Stack IR ;) (param $0 i64) (result i64) + (func $2 (param $0 i64) (result i64) (unreachable) ) - (func $3 (; has Stack IR ;) (param $0 i64) (result i64) + (func $3 (param $0 i64) (result i64) (local $1 i64) (local.set $1 (i64.const 1) @@ -81,7 +81,7 @@ ) (local.get $1) ) - (func $4 (; has Stack IR ;) (param $0 i64) (result i64) + (func $4 (param $0 i64) (result i64) (local $1 i64) (local.set $1 (i64.const 1) diff --git a/test/passes/O1_print-stack-ir.txt b/test/passes/O1_print-stack-ir.txt index 0a64713d3..d6cececfc 100644 --- a/test/passes/O1_print-stack-ir.txt +++ b/test/passes/O1_print-stack-ir.txt @@ -28,25 +28,16 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (param $0 i32) (result i32) - (i32.add - (call $stacky-help - (i32.const 0) - ) - (block (result i32) - (local.set $0 - (call $stacky-help - (i32.const 1) - ) - ) - (drop - (call $stacky-help - (i32.const 2) - ) - ) - (i32.eqz - (local.get $0) - ) - ) - ) + i32.const 0 + call $stacky-help + i32.const 1 + call $stacky-help + local.set $0 + i32.const 2 + call $stacky-help + drop + local.get $0 + i32.eqz + i32.add ) ) diff --git a/test/passes/O2_precompute-propagate_print-stack-ir.txt b/test/passes/O2_precompute-propagate_print-stack-ir.txt index b0789141a..119d1cafb 100644 --- a/test/passes/O2_precompute-propagate_print-stack-ir.txt +++ b/test/passes/O2_precompute-propagate_print-stack-ir.txt @@ -15,10 +15,8 @@ (export "func" (func $func)) (func $func (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i64) (result i64) (local $4 i32) - (local.set $3 - (i64.const 2147483647) - ) - (nop) - (i64.const 2147483647) + i64.const 2147483647 + local.set $3 + i64.const 2147483647 ) ) diff --git a/test/passes/O2_print-stack-ir.txt b/test/passes/O2_print-stack-ir.txt index cdfccc3d4..d6cececfc 100644 --- a/test/passes/O2_print-stack-ir.txt +++ b/test/passes/O2_print-stack-ir.txt @@ -2,23 +2,6 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (param $0 i32) (result i32) - i32.const 0 - call $stacky-help - i32.const 1 - call $stacky-help - local.set $0 - i32.const 2 - call $stacky-help - drop - local.get $0 - i32.eqz - i32.add - ) -) -(module - (type $0 (func (param i32) (result i32))) - (export "stacky-help" (func $stacky-help)) - (func $stacky-help (; has Stack IR ;) (param $0 i32) (result i32) (i32.add (call $stacky-help (i32.const 0) @@ -41,3 +24,20 @@ ) ) ) +(module + (type $0 (func (param i32) (result i32))) + (export "stacky-help" (func $stacky-help)) + (func $stacky-help (param $0 i32) (result i32) + i32.const 0 + call $stacky-help + i32.const 1 + call $stacky-help + local.set $0 + i32.const 2 + call $stacky-help + drop + local.get $0 + i32.eqz + i32.add + ) +) diff --git a/test/passes/O3_low-memory-unused_metrics.txt b/test/passes/O3_low-memory-unused_metrics.txt index 547eb1673..fd9245adc 100644 --- a/test/passes/O3_low-memory-unused_metrics.txt +++ b/test/passes/O3_low-memory-unused_metrics.txt @@ -42,7 +42,7 @@ total (import "env" "memset" (func $fimport$97 (param i32 i32 i32) (result i32))) (import "env" "memcpy" (func $fimport$98 (param i32 i32 i32) (result i32))) (export "deflate" (func $0)) - (func $0 (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + (func $0 (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) diff --git a/test/passes/O3_print-stack-ir.txt b/test/passes/O3_print-stack-ir.txt index 569c49966..18aa4053f 100644 --- a/test/passes/O3_print-stack-ir.txt +++ b/test/passes/O3_print-stack-ir.txt @@ -2,21 +2,6 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (param $0 i32) (result i32) - i32.const 0 - call $stacky-help - i32.const 1 - call $stacky-help - i32.const 2 - call $stacky-help - drop - i32.eqz - i32.add - ) -) -(module - (type $0 (func (param i32) (result i32))) - (export "stacky-help" (func $stacky-help)) - (func $stacky-help (; has Stack IR ;) (param $0 i32) (result i32) (i32.add (call $stacky-help (i32.const 0) @@ -39,3 +24,18 @@ ) ) ) +(module + (type $0 (func (param i32) (result i32))) + (export "stacky-help" (func $stacky-help)) + (func $stacky-help (param $0 i32) (result i32) + i32.const 0 + call $stacky-help + i32.const 1 + call $stacky-help + i32.const 2 + call $stacky-help + drop + i32.eqz + i32.add + ) +) diff --git a/test/passes/Os_print-stack-ir_all-features_disable-gc.txt b/test/passes/Os_print-stack-ir_all-features_disable-gc.txt index 569c49966..18aa4053f 100644 --- a/test/passes/Os_print-stack-ir_all-features_disable-gc.txt +++ b/test/passes/Os_print-stack-ir_all-features_disable-gc.txt @@ -2,21 +2,6 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (param $0 i32) (result i32) - i32.const 0 - call $stacky-help - i32.const 1 - call $stacky-help - i32.const 2 - call $stacky-help - drop - i32.eqz - i32.add - ) -) -(module - (type $0 (func (param i32) (result i32))) - (export "stacky-help" (func $stacky-help)) - (func $stacky-help (; has Stack IR ;) (param $0 i32) (result i32) (i32.add (call $stacky-help (i32.const 0) @@ -39,3 +24,18 @@ ) ) ) +(module + (type $0 (func (param i32) (result i32))) + (export "stacky-help" (func $stacky-help)) + (func $stacky-help (param $0 i32) (result i32) + i32.const 0 + call $stacky-help + i32.const 1 + call $stacky-help + i32.const 2 + call $stacky-help + drop + i32.eqz + i32.add + ) +) diff --git a/test/passes/Oz_fuzz-exec_all-features.txt b/test/passes/Oz_fuzz-exec_all-features.txt index c46085be1..b69b9728c 100644 --- a/test/passes/Oz_fuzz-exec_all-features.txt +++ b/test/passes/Oz_fuzz-exec_all-features.txt @@ -81,7 +81,7 @@ (export "static-casts" (func $static-casts)) (export "static-br_on_cast" (func $br_on_cast)) (export "static-br_on_cast_fail" (func $static-br_on_cast_fail)) - (func $structs (type $void_func) (; has Stack IR ;) + (func $structs (type $void_func) (local $0 i32) (call $log (i32.const 0) @@ -98,7 +98,7 @@ (i32.const 100) ) ) - (func $arrays (type $void_func) (; has Stack IR ;) + (func $arrays (type $void_func) (local $0 (ref $bytes)) (local.set $0 (array.new $bytes @@ -139,12 +139,12 @@ ) ) ) - (func $br_on_cast (type $void_func) (; has Stack IR ;) + (func $br_on_cast (type $void_func) (call $log (i32.const 3) ) ) - (func $br_on_failed_cast-1 (type $void_func) (; has Stack IR ;) + (func $br_on_failed_cast-1 (type $void_func) (local $0 (ref $struct)) (local.set $0 (struct.new_default $struct) @@ -166,7 +166,7 @@ ) ) ) - (func $br_on_failed_cast-2 (type $void_func) (; has Stack IR ;) + (func $br_on_failed_cast-2 (type $void_func) (call $log (i32.const 1) ) @@ -174,15 +174,15 @@ (i32.const 999) ) ) - (func $cast-null-anyref-to-gc (type $void_func) (; has Stack IR ;) + (func $cast-null-anyref-to-gc (type $void_func) (call $log (i32.const 0) ) ) - (func $br-on_non_null (type $void_func) (; has Stack IR ;) + (func $br-on_non_null (type $void_func) (nop) ) - (func $br-on_non_null-2 (type $void_func) (; has Stack IR ;) + (func $br-on_non_null-2 (type $void_func) (drop (block (call $log @@ -192,7 +192,7 @@ ) ) ) - (func $cast-on-func (type $void_func) (; has Stack IR ;) + (func $cast-on-func (type $void_func) (call $log (i32.const 0) ) @@ -204,7 +204,7 @@ ) (unreachable) ) - (func $init-array-packed (type $int_func) (; has Stack IR ;) (result i32) + (func $init-array-packed (type $int_func) (result i32) (array.get_u $bytes (array.new $bytes (i32.const -43) @@ -213,7 +213,7 @@ (i32.const 10) ) ) - (func $array-copy (type $void_func) (; has Stack IR ;) + (func $array-copy (type $void_func) (local $0 (ref $bytes)) (local $1 (ref $bytes)) (array.set $bytes @@ -268,7 +268,7 @@ ) ) ) - (func $array.new_fixed (type $void_func) (; has Stack IR ;) + (func $array.new_fixed (type $void_func) (local $0 i32) (local $1 i32) (local.set $0 @@ -287,12 +287,12 @@ (i32.const 50) ) ) - (func $array.new_fixed-packed (type $void_func) (; has Stack IR ;) + (func $array.new_fixed-packed (type $void_func) (call $log (i32.const 8) ) ) - (func $static-casts (type $void_func) (; has Stack IR ;) + (func $static-casts (type $void_func) (call $log (i32.const 1) ) @@ -312,7 +312,7 @@ (i32.const 1) ) ) - (func $static-br_on_cast_fail (type $void_func) (; has Stack IR ;) + (func $static-br_on_cast_fail (type $void_func) (call $log (i32.const -2) ) @@ -380,7 +380,7 @@ ignoring comparison of ExecutionResults! (module (type $0 (func (result i32))) (export "foo" (func $foo)) - (func $foo (type $0) (; has Stack IR ;) (result i32) + (func $foo (type $0) (result i32) (i32.const 0) ) ) diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt index bd977b342..312e67fe7 100644 --- a/test/passes/converge_O3_metrics.bin.txt +++ b/test/passes/converge_O3_metrics.bin.txt @@ -46,13 +46,13 @@ total (elem $0 (i32.const 0) $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $___stdout_write $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $__ZNSt3__211__stdoutbufIcE6xsputnEPKci $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $__ZNSt3__211__stdoutbufIcE8overflowEi) (export "_main" (func $_main)) (export "_malloc" (func $_malloc)) - (func $b0 (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (result i32) + (func $b0 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (result i32) (i32.const 0) ) - (func $_malloc (; has Stack IR ;) (param $0 i32) (result i32) + (func $_malloc (param $0 i32) (result i32) (i32.const 0) ) - (func $_main (; has Stack IR ;) (result i32) + (func $_main (result i32) (local $0 i32) (local $1 i32) (local.set $0 @@ -157,7 +157,7 @@ total ) (i32.const 0) ) - (func $___stdout_write (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $___stdout_write (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (global.set $global$0 (i32.const 32) ) @@ -187,7 +187,7 @@ total ) (i32.const 1) ) - (func $__ZNSt3__211__stdoutbufIcE8overflowEi (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + (func $__ZNSt3__211__stdoutbufIcE8overflowEi (param $0 i32) (param $1 i32) (result i32) (i32.store8 (i32.const 0) (local.get $1) @@ -212,7 +212,7 @@ total ) (i32.const 0) ) - (func $__ZNSt3__211__stdoutbufIcE6xsputnEPKci (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $__ZNSt3__211__stdoutbufIcE6xsputnEPKci (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call_indirect (type $0) (i32.const 0) @@ -277,13 +277,13 @@ total (elem $0 (i32.const 0) $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $___stdout_write $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $__ZNSt3__211__stdoutbufIcE6xsputnEPKci $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $__ZNSt3__211__stdoutbufIcE8overflowEi) (export "_main" (func $_main)) (export "_malloc" (func $_malloc)) - (func $b0 (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (result i32) + (func $b0 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (result i32) (i32.const 0) ) - (func $_malloc (; has Stack IR ;) (param $0 i32) (result i32) + (func $_malloc (param $0 i32) (result i32) (i32.const 0) ) - (func $_main (; has Stack IR ;) (result i32) + (func $_main (result i32) (local $0 i32) (local $1 i32) (local.set $0 @@ -388,7 +388,7 @@ total ) (i32.const 0) ) - (func $___stdout_write (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $___stdout_write (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.store (i32.const 8) (local.get $1) @@ -413,7 +413,7 @@ total ) (i32.const 1) ) - (func $__ZNSt3__211__stdoutbufIcE8overflowEi (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + (func $__ZNSt3__211__stdoutbufIcE8overflowEi (param $0 i32) (param $1 i32) (result i32) (i32.store8 (i32.const 0) (local.get $1) @@ -438,7 +438,7 @@ total ) (i32.const 0) ) - (func $__ZNSt3__211__stdoutbufIcE6xsputnEPKci (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $__ZNSt3__211__stdoutbufIcE6xsputnEPKci (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call_indirect (type $0) (i32.const 0) @@ -503,13 +503,13 @@ total (elem $0 (i32.const 0) $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $___stdout_write $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $__ZNSt3__211__stdoutbufIcE6xsputnEPKci $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $b0 $__ZNSt3__211__stdoutbufIcE8overflowEi) (export "_main" (func $_main)) (export "_malloc" (func $_malloc)) - (func $b0 (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (result i32) + (func $b0 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (param $6 i32) (result i32) (i32.const 0) ) - (func $_malloc (; has Stack IR ;) (param $0 i32) (result i32) + (func $_malloc (param $0 i32) (result i32) (i32.const 0) ) - (func $_main (; has Stack IR ;) (result i32) + (func $_main (result i32) (local $0 i32) (local $1 i32) (local.set $0 @@ -614,7 +614,7 @@ total ) (i32.const 0) ) - (func $___stdout_write (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $___stdout_write (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.store (i32.const 8) (local.get $1) @@ -639,7 +639,7 @@ total ) (i32.const 1) ) - (func $__ZNSt3__211__stdoutbufIcE8overflowEi (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) + (func $__ZNSt3__211__stdoutbufIcE8overflowEi (param $0 i32) (param $1 i32) (result i32) (i32.store8 (i32.const 0) (local.get $1) @@ -664,7 +664,7 @@ total ) (i32.const 0) ) - (func $__ZNSt3__211__stdoutbufIcE6xsputnEPKci (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $__ZNSt3__211__stdoutbufIcE6xsputnEPKci (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call_indirect (type $0) (i32.const 0) diff --git a/test/passes/fuzz-exec_O.txt b/test/passes/fuzz-exec_O.txt index 7bdf8d252..d636cc765 100644 --- a/test/passes/fuzz-exec_O.txt +++ b/test/passes/fuzz-exec_O.txt @@ -8,7 +8,7 @@ (memory $0 1 1) (export "func_0" (func $func_0)) (export "func_1" (func $func_1)) - (func $func_0 (; has Stack IR ;) (result i64) + (func $func_0 (result i64) (block $label$0 (result i64) (br_if $label$0 (i64.const 1234) @@ -18,7 +18,7 @@ ) ) ) - (func $func_1 (; has Stack IR ;) (result i32) + (func $func_1 (result i32) (i32.load16_s offset=22 align=1 (i32.const -1) ) @@ -59,7 +59,7 @@ (export "add4" (func $div)) (export "sub1" (func $div)) (export "sub2" (func $div)) - (func $div (; has Stack IR ;) (result f32) + (func $div (result f32) (f32.const nan:0x400000) ) ) diff --git a/test/passes/remove-unused-brs_generate-stack-ir_print-stack-ir.txt b/test/passes/remove-unused-brs_generate-stack-ir_print-stack-ir.txt index c9cacca39..2eb5aa7da 100644 --- a/test/passes/remove-unused-brs_generate-stack-ir_print-stack-ir.txt +++ b/test/passes/remove-unused-brs_generate-stack-ir_print-stack-ir.txt @@ -1,23 +1,6 @@ (module (type $0 (func (param i64))) (func $0 (param $var$0 i64) - block $label$1 - block $label$2 - loop $label$3 - block $label$4 - unreachable - end - unreachable - end - unreachable - end - unreachable - end - ) -) -(module - (type $0 (func (param i64))) - (func $0 (; has Stack IR ;) (param $var$0 i64) (block $label$1 (br_if $label$1 (block $label$2 @@ -34,3 +17,20 @@ ) ) ) +(module + (type $0 (func (param i64))) + (func $0 (param $var$0 i64) + block $label$1 + block $label$2 + loop $label$3 + block $label$4 + unreachable + end + unreachable + end + unreachable + end + unreachable + end + ) +) diff --git a/test/unit/test_stack_ir.py b/test/unit/test_stack_ir.py index 78086d0cc..191d7eaec 100644 --- a/test/unit/test_stack_ir.py +++ b/test/unit/test_stack_ir.py @@ -7,13 +7,16 @@ class StackIRTest(utils.BinaryenTestCase): # test that stack IR opts make a difference. def test_stack_ir_opts(self): path = self.input_path('stack_ir.wat') - opt = shared.run_process(shared.WASM_OPT + [path, '-O', '--generate-stack-ir', '--optimize-stack-ir', '--print-stack-ir', '-o', 'a.wasm'], capture_output=True).stdout - nonopt = shared.run_process(shared.WASM_OPT + [path, '-O', '--generate-stack-ir', '--print-stack-ir', '-o', 'b.wasm'], capture_output=True).stdout + shared_args = shared.WASM_OPT + [path, '--print-stack-ir'] + # optimize level 2 will only run some of the stack IR opts. level 3 does + # noticeably more. + nonopt = shared.run_process(shared_args + ['-o', 'nonopt.wasm', '--optimize-level=2'], capture_output=True).stdout + yesopt = shared.run_process(shared_args + ['-o', 'yesopt.wasm', '--optimize-level=3'], capture_output=True).stdout # see a difference in the printed stack IR (the optimizations let us # remove a pair of local.set/get) - self.assertNotEqual(opt, nonopt) - self.assertLess(len(opt), len(nonopt)) + self.assertNotEqual(yesopt, nonopt) + self.assertLess(len(yesopt), len(nonopt)) # see a difference in the actual emitted wasm binary. - opt_size = os.path.getsize('a.wasm') - nonopt_size = os.path.getsize('b.wasm') - self.assertLess(opt_size, nonopt_size) + yesopt_size = os.path.getsize('yesopt.wasm') + nonopt_size = os.path.getsize('nonopt.wasm') + self.assertLess(yesopt_size, nonopt_size) |