diff options
author | Thomas Lively <tlively@google.com> | 2023-12-20 14:17:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 14:17:35 -0800 |
commit | fb7d00b336c8d682cbaaf02c96dab64b39d941ba (patch) | |
tree | 8b01240df861436fd0b74d2175155fa334f724bc /test/lit/passes | |
parent | 2b81d39e133ff443c09837c7b0bf77e661d15345 (diff) | |
download | binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.tar.gz binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.tar.bz2 binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.zip |
Drop support for non-standard quoted function names (#6188)
We previously supported a non-standard `(func "name" ...` syntax for declaring
functions exported with the quoted name. Since that is not part of the standard
text format, drop support for it, replacing it with the standard `(func $name
(export "name") ...` syntax instead.
Also replace our other usage of the quoted form in our text output, which was
where we quoted names containing characters that are not allowed to appear in
standard names. To handle that case, adjust our output from `"$name"` to
`$"name"`, which is the standards-track way of supporting such names. Also fix
how we detect non-standard name characters to match the spec.
Update the lit test output generation script to account for these changes,
including by making the `$` prefix on names mandatory. This causes the script to
stop interpreting declarative element segments with the `(elem declare ...`
syntax as being named "declare", so prevent our generated output from regressing
by counting "declare" as a name in the script.
Diffstat (limited to 'test/lit/passes')
-rw-r--r-- | test/lit/passes/O1.wast | 22 | ||||
-rw-r--r-- | test/lit/passes/O1_skip.wast | 6 | ||||
-rw-r--r-- | test/lit/passes/O3_Oz.wast | 32 | ||||
-rw-r--r-- | test/lit/passes/O_fast-math.wast | 154 | ||||
-rw-r--r-- | test/lit/passes/dae-gc-refine-params.wast | 66 | ||||
-rw-r--r-- | test/lit/passes/dae-gc-refine-return.wast | 8 | ||||
-rw-r--r-- | test/lit/passes/dae_all-features.wast | 27 | ||||
-rw-r--r-- | test/lit/passes/flatten_all-features.wast | 26 | ||||
-rw-r--r-- | test/lit/passes/flatten_dfo_O3_enable-threads.wast | 113 | ||||
-rw-r--r-- | test/lit/passes/flatten_i64-to-i32-lowering.wast | 247 | ||||
-rw-r--r-- | test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast | 112 | ||||
-rw-r--r-- | test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast | 87 | ||||
-rw-r--r-- | test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast | 87 | ||||
-rw-r--r-- | test/lit/passes/gto-removals.wast | 12 | ||||
-rw-r--r-- | test/lit/passes/remove-unused-module-elements_all-features.wast | 32 | ||||
-rw-r--r-- | test/lit/passes/stack-check-memory64.wast | 71 | ||||
-rw-r--r-- | test/lit/passes/vacuum_all-features.wast | 190 |
17 files changed, 621 insertions, 671 deletions
diff --git a/test/lit/passes/O1.wast b/test/lit/passes/O1.wast index 516c9b2ee..8ffc29301 100644 --- a/test/lit/passes/O1.wast +++ b/test/lit/passes/O1.wast @@ -9,7 +9,17 @@ ;; CHECK: (memory $0 1 1) (memory $0 1 1) (global $global$0 (mut i32) (i32.const 10)) - (func "foo" (result i32) + ;; CHECK: (export "foo" (func $foo)) + + ;; CHECK: (func $foo (result i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.load align=1 + ;; CHECK-NEXT: (i32.const 4) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $foo (export "foo") (result i32) (i32.load offset=4 align=1 (i32.and (block $label$1 (result i32) @@ -31,13 +41,3 @@ ) -;; CHECK: (export "foo" (func $0)) - -;; CHECK: (func $0 (result i32) -;; CHECK-NEXT: (drop -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.load align=1 -;; CHECK-NEXT: (i32.const 4) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/test/lit/passes/O1_skip.wast b/test/lit/passes/O1_skip.wast index d4eef7c84..2cefecdcf 100644 --- a/test/lit/passes/O1_skip.wast +++ b/test/lit/passes/O1_skip.wast @@ -14,7 +14,7 @@ ;; CHECK: (import "a" "b" (func $log (param i32 i32))) (import "a" "b" (func $log (param i32 i32))) - (func "foo" (param $p i32) + (func $foo (export "foo") (param $p i32) ;; The locals $x and $y can be coalesced into a single local, but as we do not ;; run that pass, they will not be. Other minor optimizations will occur here, ;; such as using a tee. @@ -44,9 +44,9 @@ ) ) ) -;; CHECK: (export "foo" (func $0)) +;; CHECK: (export "foo" (func $foo)) -;; CHECK: (func $0 (; has Stack IR ;) (param $p i32) +;; CHECK: (func $foo (; has Stack IR ;) (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 4dca886ac..48345663e 100644 --- a/test/lit/passes/O3_Oz.wast +++ b/test/lit/passes/O3_Oz.wast @@ -10,7 +10,22 @@ ) ) - (func "export" (param $x i32) (result i32) + ;; CHECK: (type $0 (func (param i32) (result i32))) + + ;; CHECK: (export "export" (func $export)) + + ;; CHECK: (func $export (; has Stack IR ;) (param $0 i32) (result i32) + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i32.add + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $export (export "export") (param $x i32) (result i32) ;; $inline.me is called twice, so we do not always inline it like called- ;; once functions are. -Oz is too cautious to inline such things that may ;; end up increasing total code size, but we are running -O3 -Oz here and so @@ -28,18 +43,3 @@ ) ) ) -;; CHECK: (type $0 (func (param i32) (result i32))) - -;; CHECK: (export "export" (func $1)) - -;; CHECK: (func $1 (; has Stack IR ;) (param $0 i32) (result i32) -;; CHECK-NEXT: (i32.add -;; CHECK-NEXT: (local.tee $0 -;; CHECK-NEXT: (i32.add -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: (i32.const 2) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/test/lit/passes/O_fast-math.wast b/test/lit/passes/O_fast-math.wast index bff7553a3..722f44a05 100644 --- a/test/lit/passes/O_fast-math.wast +++ b/test/lit/passes/O_fast-math.wast @@ -5,73 +5,129 @@ ;; with fast-math we can optimize some of these patterns (module - (func "div" (result f32) + ;; CHECK: (type $0 (func (result f32))) + + ;; CHECK: (type $1 (func (param f32) (result f32))) + + ;; CHECK: (type $2 (func (param f64) (result f64))) + + ;; CHECK: (export "div" (func $div)) + + ;; CHECK: (export "mul1" (func $mul1)) + + ;; CHECK: (export "mul2" (func $mul2)) + + ;; CHECK: (export "add1" (func $mul1)) + + ;; CHECK: (export "add2" (func $mul2)) + + ;; CHECK: (export "add3" (func $mul2)) + + ;; CHECK: (export "add4" (func $mul2)) + + ;; CHECK: (export "sub1" (func $mul1)) + + ;; CHECK: (export "sub2" (func $mul2)) + + ;; CHECK: (export "mul_neg_one1" (func $mul_neg_one1)) + + ;; CHECK: (export "mul_neg_one2" (func $mul_neg_one2)) + + ;; CHECK: (export "abs_sub_zero1" (func $abs_sub_zero1)) + + ;; CHECK: (export "abs_sub_zero2" (func $abs_sub_zero2)) + + ;; CHECK: (func $div (; has Stack IR ;) (result f32) + ;; CHECK-NEXT: (f32.const -nan:0x23017a) + ;; CHECK-NEXT: ) + (func $div (export "div") (result f32) (f32.div (f32.const -nan:0x23017a) (f32.const 1) ) ) - (func "mul1" (result f32) + ;; CHECK: (func $mul1 (; has Stack IR ;) (result f32) + ;; CHECK-NEXT: (f32.const -nan:0x34546d) + ;; CHECK-NEXT: ) + (func $mul1 (export "mul1") (result f32) (f32.mul (f32.const -nan:0x34546d) (f32.const 1) ) ) - (func "mul2" (result f32) + ;; CHECK: (func $mul2 (; has Stack IR ;) (result f32) + ;; CHECK-NEXT: (f32.const nan:0x400000) + ;; CHECK-NEXT: ) + (func $mul2 (export "mul2") (result f32) (f32.mul (f32.const 1) (f32.const -nan:0x34546d) ) ) - (func "add1" (result f32) + (func $add1 (export "add1") (result f32) (f32.add (f32.const -nan:0x34546d) (f32.const -0) ) ) - (func "add2" (result f32) + (func $add2 (export "add2") (result f32) (f32.add (f32.const -0) (f32.const -nan:0x34546d) ) ) - (func "add3" (result f32) + (func $add3 (export "add3") (result f32) (f32.add (f32.const -nan:0x34546d) (f32.const 0) ) ) - (func "add4" (result f32) + (func $add4 (export "add4") (result f32) (f32.add (f32.const 0) (f32.const -nan:0x34546d) ) ) - (func "sub1" (result f32) + (func $sub1 (export "sub1") (result f32) (f32.sub (f32.const -nan:0x34546d) (f32.const 0) ) ) - (func "sub2" (result f32) + (func $sub2 (export "sub2") (result f32) (f32.sub (f32.const -nan:0x34546d) (f32.const -0) ) ) - (func "mul_neg_one1" (param $x f32) (result f32) + ;; CHECK: (func $mul_neg_one1 (; has Stack IR ;) (param $0 f32) (result f32) + ;; CHECK-NEXT: (f32.neg + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $mul_neg_one1 (export "mul_neg_one1") (param $x f32) (result f32) (f32.mul (local.get $x) (f32.const -1) ) ) - (func "mul_neg_one2" (param $x f64) (result f64) + ;; CHECK: (func $mul_neg_one2 (; has Stack IR ;) (param $0 f64) (result f64) + ;; CHECK-NEXT: (f64.neg + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $mul_neg_one2 (export "mul_neg_one2") (param $x f64) (result f64) (f64.mul (local.get $x) (f64.const -1) ) ) - (func "abs_sub_zero1" (param $x f32) (result f32) + ;; CHECK: (func $abs_sub_zero1 (; has Stack IR ;) (param $0 f32) (result f32) + ;; CHECK-NEXT: (f32.abs + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $abs_sub_zero1 (export "abs_sub_zero1") (param $x f32) (result f32) ;; abs(0 - x) ==> abs(x) (f32.abs (f32.sub @@ -80,7 +136,12 @@ ) ) ) - (func "abs_sub_zero2" (param $x f64) (result f64) + ;; CHECK: (func $abs_sub_zero2 (; has Stack IR ;) (param $0 f64) (result f64) + ;; CHECK-NEXT: (f64.abs + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $abs_sub_zero2 (export "abs_sub_zero2") (param $x f64) (result f64) ;; abs(0 - x) ==> abs(x) (f64.abs (f64.sub @@ -90,70 +151,3 @@ ) ) ) -;; CHECK: (type $0 (func (result f32))) - -;; CHECK: (type $1 (func (param f32) (result f32))) - -;; CHECK: (type $2 (func (param f64) (result f64))) - -;; CHECK: (export "div" (func $0)) - -;; CHECK: (export "mul1" (func $1)) - -;; CHECK: (export "mul2" (func $2)) - -;; CHECK: (export "add1" (func $1)) - -;; CHECK: (export "add2" (func $2)) - -;; CHECK: (export "add3" (func $2)) - -;; CHECK: (export "add4" (func $2)) - -;; CHECK: (export "sub1" (func $1)) - -;; CHECK: (export "sub2" (func $2)) - -;; CHECK: (export "mul_neg_one1" (func $9)) - -;; CHECK: (export "mul_neg_one2" (func $10)) - -;; CHECK: (export "abs_sub_zero1" (func $11)) - -;; CHECK: (export "abs_sub_zero2" (func $12)) - -;; CHECK: (func $0 (; has Stack IR ;) (result f32) -;; CHECK-NEXT: (f32.const -nan:0x23017a) -;; CHECK-NEXT: ) - -;; CHECK: (func $1 (; has Stack IR ;) (result f32) -;; CHECK-NEXT: (f32.const -nan:0x34546d) -;; CHECK-NEXT: ) - -;; CHECK: (func $2 (; has Stack IR ;) (result f32) -;; CHECK-NEXT: (f32.const nan:0x400000) -;; CHECK-NEXT: ) - -;; CHECK: (func $9 (; has Stack IR ;) (param $0 f32) (result f32) -;; CHECK-NEXT: (f32.neg -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) - -;; CHECK: (func $10 (; has Stack IR ;) (param $0 f64) (result f64) -;; CHECK-NEXT: (f64.neg -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) - -;; CHECK: (func $11 (; has Stack IR ;) (param $0 f32) (result f32) -;; CHECK-NEXT: (f32.abs -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) - -;; CHECK: (func $12 (; has Stack IR ;) (param $0 f64) (result f64) -;; CHECK-NEXT: (f64.abs -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) diff --git a/test/lit/passes/dae-gc-refine-params.wast b/test/lit/passes/dae-gc-refine-params.wast index 2f55e4012..51e97456c 100644 --- a/test/lit/passes/dae-gc-refine-params.wast +++ b/test/lit/passes/dae-gc-refine-params.wast @@ -21,12 +21,12 @@ ;; CHECK: (func $call-various-params-no (type $0) ;; CHECK-NEXT: (call $various-params-no - ;; CHECK-NEXT: (call $get_{}) - ;; CHECK-NEXT: (call $get_{i32}) + ;; CHECK-NEXT: (call $"get_{}") + ;; CHECK-NEXT: (call $"get_{i32}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $various-params-no - ;; CHECK-NEXT: (call $get_{i32}) - ;; CHECK-NEXT: (call $get_{f64}) + ;; CHECK-NEXT: (call $"get_{i32}") + ;; CHECK-NEXT: (call $"get_{f64}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $call-various-params-no @@ -59,35 +59,26 @@ (drop (local.get $y)) ) - ;; CHECK: (func $get_{} (type $8) (result (ref null ${})) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) (func $get_{} (result (ref null ${})) (unreachable) ) - ;; CHECK: (func $get_{i32} (type $5) (result (ref null ${i32})) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) (func $get_{i32} (result (ref null ${i32})) (unreachable) ) - ;; CHECK: (func $get_{f64} (type $10) (result (ref null ${f64})) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) (func $get_{f64} (result (ref null ${f64})) (unreachable) ) ;; CHECK: (func $call-various-params-yes (type $0) ;; CHECK-NEXT: (call $various-params-yes - ;; CHECK-NEXT: (call $get_null_{i32}) + ;; CHECK-NEXT: (call $"get_null_{i32}") ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: (call $get_null_{i32}) + ;; CHECK-NEXT: (call $"get_null_{i32}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $various-params-yes - ;; CHECK-NEXT: (call $get_null_{i32}) + ;; CHECK-NEXT: (call $"get_null_{i32}") ;; CHECK-NEXT: (i32.const 1) - ;; CHECK-NEXT: (call $get_null_{i32_i64}) + ;; CHECK-NEXT: (call $"get_null_{i32_i64}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $call-various-params-yes @@ -127,12 +118,12 @@ ;; CHECK: (func $call-various-params-set (type $0) ;; CHECK-NEXT: (call $various-params-set - ;; CHECK-NEXT: (call $get_null_{i32}) - ;; CHECK-NEXT: (call $get_null_{i32}) + ;; CHECK-NEXT: (call $"get_null_{i32}") + ;; CHECK-NEXT: (call $"get_null_{i32}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $various-params-set - ;; CHECK-NEXT: (call $get_null_{i32}) - ;; CHECK-NEXT: (call $get_null_{i32_i64}) + ;; CHECK-NEXT: (call $"get_null_{i32}") + ;; CHECK-NEXT: (call $"get_null_{i32_i64}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $call-various-params-set @@ -169,7 +160,7 @@ ;; CHECK-NEXT: (local.get $2) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (local.set $y - ;; CHECK-NEXT: (call $get_null_{i32_i64}) + ;; CHECK-NEXT: (call $"get_null_{i32_i64}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.get $y) @@ -198,7 +189,7 @@ ;; CHECK: (func $call-various-params-tee (type $0) ;; CHECK-NEXT: (call $various-params-tee - ;; CHECK-NEXT: (call $get_null_{i32}) + ;; CHECK-NEXT: (call $"get_null_{i32}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $call-various-params-tee @@ -214,7 +205,7 @@ ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (block (result (ref null ${i32})) ;; CHECK-NEXT: (local.tee $x - ;; CHECK-NEXT: (call $get_null_{i32_i64}) + ;; CHECK-NEXT: (call $"get_null_{i32_i64}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -237,7 +228,7 @@ ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (call $get_null_{i32}) + ;; CHECK-NEXT: (call $"get_null_{i32}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $various-params-null ;; CHECK-NEXT: (ref.as_non_null @@ -288,10 +279,10 @@ ;; CHECK: (func $call-various-params-middle (type $0) ;; CHECK-NEXT: (call $various-params-middle - ;; CHECK-NEXT: (call $get_null_{i32_i64}) + ;; CHECK-NEXT: (call $"get_null_{i32_i64}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (call $various-params-middle - ;; CHECK-NEXT: (call $get_null_{i32_f32}) + ;; CHECK-NEXT: (call $"get_null_{i32_f32}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $call-various-params-middle @@ -399,13 +390,6 @@ (drop (local.get $x)) ) - ;; CHECK: (func $get_null_{i32} (type $5) (result (ref null ${i32})) - ;; CHECK-NEXT: (select (result (ref null ${i32})) - ;; CHECK-NEXT: (ref.null none) - ;; CHECK-NEXT: (struct.new_default ${i32}) - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) (func $get_null_{i32} (result (ref null ${i32})) ;; Helper function that returns a null value of ${i32}. We use this instead of ;; a direct ref.null because those can be rewritten by LUBFinder. @@ -416,13 +400,6 @@ ) ) - ;; CHECK: (func $get_null_{i32_i64} (type $16) (result (ref null ${i32_i64})) - ;; CHECK-NEXT: (select (result (ref null ${i32_i64})) - ;; CHECK-NEXT: (ref.null none) - ;; CHECK-NEXT: (struct.new_default ${i32_i64}) - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) (func $get_null_{i32_i64} (result (ref null ${i32_i64})) (select (ref.null none) @@ -431,13 +408,6 @@ ) ) - ;; CHECK: (func $get_null_{i32_f32} (type $17) (result (ref null ${i32_f32})) - ;; CHECK-NEXT: (select (result (ref null ${i32_f32})) - ;; CHECK-NEXT: (ref.null none) - ;; CHECK-NEXT: (struct.new_default ${i32_f32}) - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) (func $get_null_{i32_f32} (result (ref null ${i32_f32})) (select (ref.null none) diff --git a/test/lit/passes/dae-gc-refine-return.wast b/test/lit/passes/dae-gc-refine-return.wast index 806683a62..aa474d7f3 100644 --- a/test/lit/passes/dae-gc-refine-return.wast +++ b/test/lit/passes/dae-gc-refine-return.wast @@ -395,9 +395,9 @@ (unreachable) ) ;; CHECK: (func $tail-caller-call_ref-yes (type $return_{}) (result (ref ${})) - ;; CHECK-NEXT: (local $return_{} (ref null $return_{})) + ;; CHECK-NEXT: (local $"return_{}" (ref null $return_{})) ;; CHECK-NEXT: (return_call_ref $return_{} - ;; CHECK-NEXT: (local.get $return_{}) + ;; CHECK-NEXT: (local.get $"return_{}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $tail-caller-call_ref-yes (result anyref) @@ -407,7 +407,7 @@ ) ;; CHECK: (func $tail-caller-call_ref-no (type $2) (result anyref) ;; CHECK-NEXT: (local $any anyref) - ;; CHECK-NEXT: (local $return_{} (ref null $return_{})) + ;; CHECK-NEXT: (local $"return_{}" (ref null $return_{})) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.const 1) ;; CHECK-NEXT: (return @@ -415,7 +415,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (return_call_ref $return_{} - ;; CHECK-NEXT: (local.get $return_{}) + ;; CHECK-NEXT: (local.get $"return_{}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) (func $tail-caller-call_ref-no (result anyref) diff --git a/test/lit/passes/dae_all-features.wast b/test/lit/passes/dae_all-features.wast index dee38f646..17626c953 100644 --- a/test/lit/passes/dae_all-features.wast +++ b/test/lit/passes/dae_all-features.wast @@ -361,21 +361,20 @@ ) ) (module ;; both operations at once: remove params and return value - (func "a" + ;; CHECK: (type $0 (func)) + + ;; CHECK: (export "a" (func $a)) + + ;; CHECK: (func $a (type $0) + ;; CHECK-NEXT: (call $b) + ;; CHECK-NEXT: ) + (func $a (export "a") (drop (call $b (i32.const 1) ) ) ) - ;; CHECK: (type $0 (func)) - - ;; CHECK: (export "a" (func $0)) - - ;; CHECK: (func $0 (type $0) - ;; CHECK-NEXT: (call $b) - ;; CHECK-NEXT: ) - ;; CHECK: (func $b (type $0) ;; CHECK-NEXT: (local $0 i32) ;; CHECK-NEXT: (drop @@ -467,7 +466,7 @@ ;; CHECK: (elem declare func $0) - ;; CHECK: (export "export" (func $1)) + ;; CHECK: (export "export" (func $export)) ;; CHECK: (func $0 (type $0) (param $0 funcref) (param $1 i32) (param $2 f64) (result i64) ;; CHECK-NEXT: (nop) @@ -477,15 +476,15 @@ (nop) (unreachable) ) - (func "export" (param $0 f32) (result funcref) + ;; CHECK: (func $export (type $1) (param $0 f32) (result funcref) + ;; CHECK-NEXT: (ref.func $0) + ;; CHECK-NEXT: ) + (func $export (export "export") (param $0 f32) (result funcref) ;; a ref.func should prevent us from changing the type of a function, as it ;; may escape (ref.func $0) ) ) -;; CHECK: (func $1 (type $1) (param $0 f32) (result funcref) -;; CHECK-NEXT: (ref.func $0) -;; CHECK-NEXT: ) (module ;; CHECK: (type $i64 (func (param i64))) (type $i64 (func (param i64))) diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast index 5ae10ac14..3ce849686 100644 --- a/test/lit/passes/flatten_all-features.wast +++ b/test/lit/passes/flatten_all-features.wast @@ -3481,7 +3481,7 @@ ;; CHECK: (type $1 (func (result i32))) - ;; CHECK: (export "test" (func $1)) + ;; CHECK: (export "test" (func $test)) ;; CHECK: (func $0 (type $0) (param $0 i64) (param $1 f32) ;; CHECK-NEXT: (nop) @@ -3489,7 +3489,18 @@ (func $0 (param $0 i64) (param $1 f32) (nop) ) - (func "test" (result i32) + ;; CHECK: (func $test (type $1) (result i32) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (return + ;; CHECK-NEXT: (i32.const -111) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $0 + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $test (export "test") (result i32) (call $0 (unreachable) ;; the unreachable should be handled properly, and not be ;; reordered with the return @@ -3501,17 +3512,6 @@ ) ;; non-nullable temp vars we add must be handled properly, as non-nullable ;; locals are not allowed -;; CHECK: (func $1 (type $1) (result i32) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: (return -;; CHECK-NEXT: (i32.const -111) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (call $0 -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) (module (type $none_=>_none (func)) ;; CHECK: (type $0 (func (result funcref))) diff --git a/test/lit/passes/flatten_dfo_O3_enable-threads.wast b/test/lit/passes/flatten_dfo_O3_enable-threads.wast index 7aa7df592..55bf54dc9 100644 --- a/test/lit/passes/flatten_dfo_O3_enable-threads.wast +++ b/test/lit/passes/flatten_dfo_O3_enable-threads.wast @@ -16,7 +16,29 @@ ;; CHECK: (memory $0 (shared 1 1)) (memory $0 (shared 1 1)) - (func "one" + ;; CHECK: (export "one" (func $one)) + + ;; CHECK: (export "two" (func $two)) + + ;; CHECK: (export "use-var" (func $use-var)) + + ;; CHECK: (export "bad1" (func $bad1)) + + ;; CHECK: (export "only-dfo" (func $only-dfo)) + + ;; CHECK: (export "dfo-tee-get" (func $dfo-tee-get)) + + ;; CHECK: (func $one (; has Stack IR ;) + ;; CHECK-NEXT: (block $label$3 + ;; CHECK-NEXT: (br_if $label$3 + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (i32.const 3060) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $one (export "one") (loop $label$2 (br_if $label$2 (block $label$3 (result i32) @@ -34,7 +56,10 @@ ) (unreachable) ) - (func "two" (param $var$0 i32) (param $var$1 i32) (result i32) + ;; CHECK: (func $two (; has Stack IR ;) (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) (nop) (nop) (nop) @@ -81,7 +106,15 @@ (nop) (i32.const 0) ) - (func "use-var" (param $var$0 i64) (param $var$1 i32) (result f64) + ;; CHECK: (func $use-var (; has Stack IR ;) (param $0 i64) (param $1 i32) (result f64) + ;; CHECK-NEXT: (loop $label$8 + ;; CHECK-NEXT: (br_if $label$8 + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $use-var (export "use-var") (param $var$0 i64) (param $var$1 i32) (result f64) (local $var$2 i32) (block $label$1 (br_table $label$1 $label$1 $label$1 $label$1 $label$1 $label$1 $label$1 $label$1 $label$1 $label$1 @@ -133,7 +166,13 @@ ) (unreachable) ) - (func "bad1" + ;; CHECK: (func $bad1 (; has Stack IR ;) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (i32.const -16384) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $bad1 (export "bad1") (local $var$2 i32) (local $var$4 i32) (block $label$1 @@ -175,7 +214,13 @@ ) ) ) - (func "only-dfo" (param $var$0 f64) (result f64) + ;; CHECK: (func $only-dfo (; has Stack IR ;) (param $0 f64) (result f64) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (loop $label$1 + ;; CHECK-NEXT: (br $label$1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $only-dfo (export "only-dfo") (param $var$0 f64) (result f64) (local $var$1 i32) (local $var$2 i32) (loop $label$1 @@ -199,7 +244,10 @@ (br $label$1) ) ) - (func "dfo-tee-get" (result i32) + ;; CHECK: (func $dfo-tee-get (; has Stack IR ;) (result i32) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + (func $dfo-tee-get (export "dfo-tee-get") (result i32) (local $0 i32) (if (result i32) (local.tee $0 @@ -217,56 +265,3 @@ ) ) -;; CHECK: (export "one" (func $0)) - -;; CHECK: (export "two" (func $1)) - -;; CHECK: (export "use-var" (func $2)) - -;; CHECK: (export "bad1" (func $3)) - -;; CHECK: (export "only-dfo" (func $4)) - -;; CHECK: (export "dfo-tee-get" (func $5)) - -;; CHECK: (func $0 (; has Stack IR ;) -;; CHECK-NEXT: (block $label$3 -;; CHECK-NEXT: (br_if $label$3 -;; CHECK-NEXT: (i32.load -;; CHECK-NEXT: (i32.const 3060) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) - -;; CHECK: (func $1 (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32) -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) - -;; CHECK: (func $2 (; has Stack IR ;) (param $0 i64) (param $1 i32) (result f64) -;; CHECK-NEXT: (loop $label$8 -;; CHECK-NEXT: (br_if $label$8 -;; CHECK-NEXT: (local.get $1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) - -;; CHECK: (func $3 (; has Stack IR ;) -;; CHECK-NEXT: (i32.store -;; CHECK-NEXT: (i32.const 1) -;; CHECK-NEXT: (i32.const -16384) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) - -;; CHECK: (func $4 (; has Stack IR ;) (param $0 f64) (result f64) -;; CHECK-NEXT: (local $1 i32) -;; CHECK-NEXT: (loop $label$1 -;; CHECK-NEXT: (br $label$1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) - -;; CHECK: (func $5 (; has Stack IR ;) (result i32) -;; CHECK-NEXT: (i32.const 1) -;; CHECK-NEXT: ) diff --git a/test/lit/passes/flatten_i64-to-i32-lowering.wast b/test/lit/passes/flatten_i64-to-i32-lowering.wast index ade1d1e58..16ebaf882 100644 --- a/test/lit/passes/flatten_i64-to-i32-lowering.wast +++ b/test/lit/passes/flatten_i64-to-i32-lowering.wast @@ -472,19 +472,96 @@ ;; CHECK: (global $i64toi32_i32$HIGH_BITS (mut i32) (i32.const 0)) - ;; CHECK: (export "exp" (func $1)) + ;; CHECK: (export "exp" (func $exp)) - ;; CHECK: (export "unreach" (func $2)) + ;; CHECK: (export "unreach" (func $unreach)) ;; CHECK: (func $call (type $1) (param $0 i32) (param $0$hi i32) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $call (param i64)) - (func "exp" + ;; CHECK: (func $exp (type $0) + ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $0$hi i32) + ;; CHECK-NEXT: (local $i64toi32_i32$0 i32) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (global.get $f$hi) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.get $f) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0$hi + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $call + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (local.get $0$hi) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (global.set $f + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (i32.const 287454020) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1432778632) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $f$hi + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $exp (export "exp") (call $call (global.get $f)) (global.set $f (i64.const 0x1122334455667788)) ) - (func "unreach" + ;; CHECK: (func $unreach (type $0) + ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $0$hi i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (local $1$hi i32) + ;; CHECK-NEXT: (local $i64toi32_i32$0 i32) + ;; CHECK-NEXT: (block $label$1 + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (local.get $0$hi) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $1$hi + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (global.set $f + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (local.get $1$hi) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $f$hi + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $unreach (export "unreach") (global.set $f (block $label$1 (result i64) (unreachable) @@ -492,84 +569,6 @@ ) ) ) -;; CHECK: (func $1 (type $0) -;; CHECK-NEXT: (local $0 i32) -;; CHECK-NEXT: (local $0$hi i32) -;; CHECK-NEXT: (local $i64toi32_i32$0 i32) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (local.set $0 -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (global.get $f$hi) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.get $f) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.set $0$hi -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (call $call -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (local.get $0$hi) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (global.set $f -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (i32.const 287454020) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.const 1432778632) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $f$hi -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) - -;; CHECK: (func $2 (type $0) -;; CHECK-NEXT: (local $0 i32) -;; CHECK-NEXT: (local $0$hi i32) -;; CHECK-NEXT: (local $1 i32) -;; CHECK-NEXT: (local $1$hi i32) -;; CHECK-NEXT: (local $i64toi32_i32$0 i32) -;; CHECK-NEXT: (block $label$1 -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (local.set $1 -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (local.get $0$hi) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.set $1$hi -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (global.set $f -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (local.get $1$hi) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $f$hi -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) (module ;; CHECK: (type $0 (func (param i32 i32))) @@ -581,57 +580,57 @@ ;; CHECK: (global $i64toi32_i32$HIGH_BITS (mut i32) (i32.const 0)) - ;; CHECK: (export "exp" (func $1)) + ;; CHECK: (export "exp" (func $exp)) ;; CHECK: (func $call (type $0) (param $0 i32) (param $0$hi i32) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $call (param i64)) - (func "exp" + ;; CHECK: (func $exp (type $1) + ;; CHECK-NEXT: (local $0 i32) + ;; CHECK-NEXT: (local $0$hi i32) + ;; CHECK-NEXT: (local $i64toi32_i32$0 i32) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (global.get $f$hi) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.get $f) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0$hi + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (call $call + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (local.get $0$hi) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (global.set $f + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (local.set $i64toi32_i32$0 + ;; CHECK-NEXT: (i32.const 287454020) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1432778632) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $f$hi + ;; CHECK-NEXT: (local.get $i64toi32_i32$0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $exp (export "exp") (call $call (global.get $f)) (global.set $f (i64.const 0x1122334455667788)) ) ) -;; CHECK: (func $1 (type $1) -;; CHECK-NEXT: (local $0 i32) -;; CHECK-NEXT: (local $0$hi i32) -;; CHECK-NEXT: (local $i64toi32_i32$0 i32) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (local.set $0 -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (global.get $f$hi) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.get $f) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.set $0$hi -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (call $call -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (local.get $0$hi) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (global.set $f -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (local.set $i64toi32_i32$0 -;; CHECK-NEXT: (i32.const 287454020) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.const 1432778632) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $f$hi -;; CHECK-NEXT: (local.get $i64toi32_i32$0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) (module (type $i64_f64_i32_=>_none (func (param i64 f64 i32))) ;; CHECK: (type $0 (func)) 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 db92b688d..011ea86e9 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_dfo_O3.wast @@ -5,7 +5,30 @@ (module (memory 1) - (func "if-select" + ;; CHECK: (type $0 (func)) + + ;; CHECK: (type $1 (func (result f64))) + + ;; CHECK: (type $2 (func (param i32 f64 f64) (result i32))) + + ;; CHECK: (type $3 (func (param i64))) + + ;; CHECK: (type $4 (func (param f64) (result i32))) + + ;; CHECK: (export "if-select" (func $if-select)) + + ;; CHECK: (export "unreachable-body-update-zext" (func $unreachable-body-update-zext)) + + ;; CHECK: (export "ssa-const" (func $ssa-const)) + + ;; CHECK: (export "if-nothing" (func $if-nothing)) + + ;; CHECK: (export "only-dfo" (func $only-dfo)) + + ;; CHECK: (func $if-select (; has Stack IR ;) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $if-select (export "if-select") (local $var$0 i32) (nop) (drop @@ -20,7 +43,10 @@ ) ) ) - (func "unreachable-body-update-zext" (result f64) + ;; CHECK: (func $unreachable-body-update-zext (; has Stack IR ;) (result f64) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $unreachable-body-update-zext (export "unreachable-body-update-zext") (result f64) (if (i32.eqz (i32.const 0) @@ -29,7 +55,10 @@ ) (f64.const -9223372036854775808) ) - (func "ssa-const" (param $var$0 i32) (param $var$1 f64) (param $var$2 f64) (result i32) + ;; CHECK: (func $ssa-const (; has Stack IR ;) (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) (block $label$1 (result i32) (block $label$2 (if @@ -59,7 +88,10 @@ ) ) ) - (func "if-nothing" (param $var$0 i64) + ;; CHECK: (func $if-nothing (; has Stack IR ;) (param $0 i64) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + (func $if-nothing (export "if-nothing") (param $var$0 i64) (local $var$1 i32) (local $var$2 i32) (block $label$1 @@ -83,7 +115,24 @@ (unreachable) ) ) - (func "only-dfo" (param $var$0 f64) (result i32) + ;; CHECK: (func $only-dfo (; has Stack IR ;) (param $0 f64) (result i32) + ;; CHECK-NEXT: (local $1 i32) + ;; CHECK-NEXT: (loop $label$1 + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.eqz + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (local.set $1 + ;; CHECK-NEXT: (i32.const -2147483648) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (br $label$1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const -2766) + ;; CHECK-NEXT: ) + (func $only-dfo (export "only-dfo") (param $var$0 f64) (result i32) (local $var$1 i32) (local $var$2 i32) (local $var$3 i32) @@ -116,56 +165,3 @@ ) ) -;; CHECK: (type $0 (func)) - -;; CHECK: (type $1 (func (result f64))) - -;; CHECK: (type $2 (func (param i32 f64 f64) (result i32))) - -;; CHECK: (type $3 (func (param i64))) - -;; CHECK: (type $4 (func (param f64) (result i32))) - -;; CHECK: (export "if-select" (func $0)) - -;; CHECK: (export "unreachable-body-update-zext" (func $1)) - -;; CHECK: (export "ssa-const" (func $2)) - -;; CHECK: (export "if-nothing" (func $3)) - -;; CHECK: (export "only-dfo" (func $4)) - -;; CHECK: (func $0 (; has Stack IR ;) -;; CHECK-NEXT: (nop) -;; CHECK-NEXT: ) - -;; CHECK: (func $1 (; has Stack IR ;) (result f64) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) - -;; CHECK: (func $2 (; has Stack IR ;) (param $0 i32) (param $1 f64) (param $2 f64) (result i32) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) - -;; CHECK: (func $3 (; has Stack IR ;) (param $0 i64) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) - -;; CHECK: (func $4 (; has Stack IR ;) (param $0 f64) (result i32) -;; CHECK-NEXT: (local $1 i32) -;; CHECK-NEXT: (loop $label$1 -;; CHECK-NEXT: (if -;; CHECK-NEXT: (i32.eqz -;; CHECK-NEXT: (local.get $1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (local.set $1 -;; CHECK-NEXT: (i32.const -2147483648) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (br $label$1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.const -2766) -;; CHECK-NEXT: ) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast index 2b17886b7..0bcc36de2 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast @@ -33,7 +33,7 @@ ;; CHECK: (memory $0 (shared 1 1)) (memory $0 (shared 1 1)) ;; Figure 1a from the Souper paper https://arxiv.org/pdf/1711.04422.pdf - ;; CHECK: (export "replaced-print-internal" (func $55)) + ;; CHECK: (export "replaced-print-internal" (func $replaced-print-internal)) ;; CHECK: (func $figure-1a (param $a i64) (param $x i64) (param $y i64) (result i32) ;; CHECK-NEXT: (local $i i32) @@ -3827,48 +3827,7 @@ ) ) ) - (func "replaced-print-internal" (param $var$0 i32) - (local $var$1 i32) - (local $var$2 i32) - (local $var$3 i32) - (if - (local.tee $var$0 - (i32.add - (local.get $var$0) - (i32.const -7) - ) - ) - (block $label$2 - (block $label$3 - (local.set $var$1 - (local.get $var$0) - ) - (br_if $label$3 - (local.tee $var$3 - (i32.const 12) - ) - ) - (unreachable) - ) - (br_if $label$2 - (i32.eqz - (local.get $var$1) - ) - ) - (if - (i32.ne - (i32.load - (i32.const 0) - ) - (local.get $var$0) - ) - (unreachable) - ) - (unreachable) - ) - ) - ) - ;; CHECK: (func $55 (param $var$0 i32) + ;; CHECK: (func $replaced-print-internal (param $var$0 i32) ;; CHECK-NEXT: (local $var$1 i32) ;; CHECK-NEXT: (local $var$2 i32) ;; CHECK-NEXT: (local $var$3 i32) @@ -3944,7 +3903,47 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - + (func $replaced-print-internal (export "replaced-print-internal") (param $var$0 i32) + (local $var$1 i32) + (local $var$2 i32) + (local $var$3 i32) + (if + (local.tee $var$0 + (i32.add + (local.get $var$0) + (i32.const -7) + ) + ) + (block $label$2 + (block $label$3 + (local.set $var$1 + (local.get $var$0) + ) + (br_if $label$3 + (local.tee $var$3 + (i32.const 12) + ) + ) + (unreachable) + ) + (br_if $label$2 + (i32.eqz + (local.get $var$1) + ) + ) + (if + (i32.ne + (i32.load + (i32.const 0) + ) + (local.get $var$0) + ) + (unreachable) + ) + (unreachable) + ) + ) + ) ;; CHECK: (func $multiple-uses-to-non-expression (param $x i32) ;; CHECK-NEXT: (local $temp i32) ;; CHECK-NEXT: (local $2 i32) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast index e53bd44b4..61430d653 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast @@ -33,7 +33,7 @@ ;; CHECK: (memory $0 (shared 1 1)) (memory $0 (shared 1 1)) ;; Figure 1a from the Souper paper https://arxiv.org/pdf/1711.04422.pdf - ;; CHECK: (export "replaced-print-internal" (func $56)) + ;; CHECK: (export "replaced-print-internal" (func $replaced-print-internal)) ;; CHECK: (func $figure-1a (param $a i64) (param $x i64) (param $y i64) (result i32) ;; CHECK-NEXT: (local $i i32) @@ -3895,48 +3895,7 @@ ) ) ) - (func "replaced-print-internal" (param $var$0 i32) - (local $var$1 i32) - (local $var$2 i32) - (local $var$3 i32) - (if - (local.tee $var$0 - (i32.add - (local.get $var$0) - (i32.const -7) - ) - ) - (block $label$2 - (block $label$3 - (local.set $var$1 - (local.get $var$0) - ) - (br_if $label$3 - (local.tee $var$3 - (i32.const 12) - ) - ) - (unreachable) - ) - (br_if $label$2 - (i32.eqz - (local.get $var$1) - ) - ) - (if - (i32.ne - (i32.load - (i32.const 0) - ) - (local.get $var$0) - ) - (unreachable) - ) - (unreachable) - ) - ) - ) - ;; CHECK: (func $56 (param $var$0 i32) + ;; CHECK: (func $replaced-print-internal (param $var$0 i32) ;; CHECK-NEXT: (local $var$1 i32) ;; CHECK-NEXT: (local $var$2 i32) ;; CHECK-NEXT: (local $var$3 i32) @@ -4012,7 +3971,47 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - + (func $replaced-print-internal (export "replaced-print-internal") (param $var$0 i32) + (local $var$1 i32) + (local $var$2 i32) + (local $var$3 i32) + (if + (local.tee $var$0 + (i32.add + (local.get $var$0) + (i32.const -7) + ) + ) + (block $label$2 + (block $label$3 + (local.set $var$1 + (local.get $var$0) + ) + (br_if $label$3 + (local.tee $var$3 + (i32.const 12) + ) + ) + (unreachable) + ) + (br_if $label$2 + (i32.eqz + (local.get $var$1) + ) + ) + (if + (i32.ne + (i32.load + (i32.const 0) + ) + (local.get $var$0) + ) + (unreachable) + ) + (unreachable) + ) + ) + ) ;; CHECK: (func $multiple-uses-to-non-expression (param $x i32) ;; CHECK-NEXT: (local $temp i32) ;; CHECK-NEXT: (local $2 i32) diff --git a/test/lit/passes/gto-removals.wast b/test/lit/passes/gto-removals.wast index 07bd3fa45..ec4cc38df 100644 --- a/test/lit/passes/gto-removals.wast +++ b/test/lit/passes/gto-removals.wast @@ -807,14 +807,14 @@ ;; CHECK: (type $4 (func (param (ref null ${mut:i8})))) - ;; CHECK: (func $unreachable-set (type $4) (param ${mut:i8} (ref null ${mut:i8})) + ;; CHECK: (func $unreachable-set (type $4) (param $"{mut:i8}" (ref null ${mut:i8})) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (block (result (ref null ${mut:i8})) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (call $helper-i32) ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (local.get ${mut:i8}) + ;; CHECK-NEXT: (local.get $"{mut:i8}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -831,13 +831,13 @@ ) ) - ;; CHECK: (func $unreachable-set-2 (type $4) (param ${mut:i8} (ref null ${mut:i8})) + ;; CHECK: (func $unreachable-set-2 (type $4) (param $"{mut:i8}" (ref null ${mut:i8})) ;; CHECK-NEXT: (block $block ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (block ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.get ${mut:i8}) + ;; CHECK-NEXT: (local.get $"{mut:i8}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (br $block) @@ -858,13 +858,13 @@ ) ) - ;; CHECK: (func $unreachable-set-2b (type $4) (param ${mut:i8} (ref null ${mut:i8})) + ;; CHECK: (func $unreachable-set-2b (type $4) (param $"{mut:i8}" (ref null ${mut:i8})) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_non_null ;; CHECK-NEXT: (block ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (local.get ${mut:i8}) + ;; CHECK-NEXT: (local.get $"{mut:i8}") ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (unreachable) diff --git a/test/lit/passes/remove-unused-module-elements_all-features.wast b/test/lit/passes/remove-unused-module-elements_all-features.wast index efa9ece60..385433189 100644 --- a/test/lit/passes/remove-unused-module-elements_all-features.wast +++ b/test/lit/passes/remove-unused-module-elements_all-features.wast @@ -732,7 +732,22 @@ (memory $B 1 1) (memory $C-unused 1 1) - (func "func" + ;; CHECK: (export "func" (func $func)) + + ;; CHECK: (func $func (type $0) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (v128.load64_splat $A + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (v128.load16_lane $B 0 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $func (export "func") (drop (v128.load64_splat $A (i32.const 0) @@ -747,21 +762,6 @@ ) ) -;; CHECK: (export "func" (func $0)) - -;; CHECK: (func $0 (type $0) -;; CHECK-NEXT: (drop -;; CHECK-NEXT: (v128.load64_splat $A -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (drop -;; CHECK-NEXT: (v128.load16_lane $B 0 -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) (module ;; When we export a function that calls another, we can export the called ;; function, skipping the one in the middle. The exports of $middle and diff --git a/test/lit/passes/stack-check-memory64.wast b/test/lit/passes/stack-check-memory64.wast index fc0db8d20..201910f36 100644 --- a/test/lit/passes/stack-check-memory64.wast +++ b/test/lit/passes/stack-check-memory64.wast @@ -11,48 +11,47 @@ ;; CHECK: (global $sp (mut i64) (i64.const 0)) (global $sp (mut i64) (i64.const 0)) - (func "use_stack" (result i64) - (global.set $sp (i64.const 42)) - (global.get $sp) - ) -) -;; CHECK: (global $__stack_base (mut i64) (i64.const 0)) - -;; CHECK: (global $__stack_limit (mut i64) (i64.const 0)) + ;; CHECK: (global $__stack_base (mut i64) (i64.const 0)) -;; CHECK: (memory $0 i64 0 65536) + ;; CHECK: (global $__stack_limit (mut i64) (i64.const 0)) -;; CHECK: (data $0 (i64.const 0) "") + ;; CHECK: (memory $0 i64 0 65536) -;; CHECK: (export "use_stack" (func $0)) + ;; CHECK: (data $0 (i64.const 0) "") -;; CHECK: (export "__set_stack_limits" (func $__set_stack_limits)) + ;; CHECK: (export "use_stack" (func $use_stack)) -;; CHECK: (func $0 (result i64) -;; CHECK-NEXT: (local $0 i64) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (if -;; CHECK-NEXT: (i32.or -;; CHECK-NEXT: (i64.gt_u -;; CHECK-NEXT: (local.tee $0 -;; CHECK-NEXT: (i64.const 42) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.get $__stack_base) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i64.lt_u -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: (global.get $__stack_limit) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $sp -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.get $sp) -;; CHECK-NEXT: ) + ;; CHECK: (export "__set_stack_limits" (func $__set_stack_limits)) + ;; CHECK: (func $use_stack (result i64) + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (i32.or + ;; CHECK-NEXT: (i64.gt_u + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (i64.const 42) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.get $__stack_base) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.lt_u + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (global.get $__stack_limit) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $sp + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.get $sp) + ;; CHECK-NEXT: ) + (func $use_stack (export "use_stack") (result i64) + (global.set $sp (i64.const 42)) + (global.get $sp) + ) +) ;; CHECK: (func $__set_stack_limits (param $0 i64) (param $1 i64) ;; CHECK-NEXT: (global.set $__stack_base ;; CHECK-NEXT: (local.get $0) diff --git a/test/lit/passes/vacuum_all-features.wast b/test/lit/passes/vacuum_all-features.wast index 9b06624cf..b228d13ee 100644 --- a/test/lit/passes/vacuum_all-features.wast +++ b/test/lit/passes/vacuum_all-features.wast @@ -1040,7 +1040,7 @@ (global $global$1 (mut i32) (i32.const 0)) ;; CHECK: (memory $0 1 1) - ;; CHECK: (export "compress" (func $3)) + ;; CHECK: (export "compress" (func $compress)) ;; CHECK: (func $_deflate (type $0) (param $0 i32) (result i32) ;; CHECK-NEXT: (call $_deflate @@ -1066,7 +1066,100 @@ (func $_deflateEnd (param i32) (result i32) (call $_deflateEnd (local.get $0)) ) - (func "compress" (param $0 i32) (param $1 i32) (param $2 i32) + ;; CHECK: (func $compress (type $1) (param $0 i32) (param $1 i32) (param $2 i32) + ;; CHECK-NEXT: (local $3 i32) + ;; CHECK-NEXT: (local.set $3 + ;; CHECK-NEXT: (global.get $global$1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (i32.sub + ;; CHECK-NEXT: (global.get $global$1) + ;; CHECK-NEXT: (i32.const -64) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=4 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 100000) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=12 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=16 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.load + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=32 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=36 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store offset=40 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (if + ;; CHECK-NEXT: (call $_deflateInit2_ + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (return) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (if (result i32) + ;; CHECK-NEXT: (i32.eq + ;; CHECK-NEXT: (local.tee $0 + ;; CHECK-NEXT: (call $_deflate + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (i32.store + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (i32.load offset=20 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (local.set $0 + ;; CHECK-NEXT: (call $_deflateEnd + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (block (result i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (call $_deflateEnd + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (global.set $global$1 + ;; CHECK-NEXT: (local.get $3) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $compress (export "compress") (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local.set $3 (global.get $global$1) @@ -1165,99 +1258,6 @@ ) ) -;; CHECK: (func $3 (type $1) (param $0 i32) (param $1 i32) (param $2 i32) -;; CHECK-NEXT: (local $3 i32) -;; CHECK-NEXT: (local.set $3 -;; CHECK-NEXT: (global.get $global$1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $global$1 -;; CHECK-NEXT: (i32.sub -;; CHECK-NEXT: (global.get $global$1) -;; CHECK-NEXT: (i32.const -64) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (local.get $2) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store offset=4 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (i32.const 100000) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store offset=12 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (local.get $0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store offset=16 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (i32.load -;; CHECK-NEXT: (local.get $1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store offset=32 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store offset=36 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.store offset=40 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (if -;; CHECK-NEXT: (call $_deflateInit2_ -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block -;; CHECK-NEXT: (global.set $global$1 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (return) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (drop -;; CHECK-NEXT: (if (result i32) -;; CHECK-NEXT: (i32.eq -;; CHECK-NEXT: (local.tee $0 -;; CHECK-NEXT: (call $_deflate -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.const 1) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (i32.store -;; CHECK-NEXT: (local.get $1) -;; CHECK-NEXT: (i32.load offset=20 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (local.set $0 -;; CHECK-NEXT: (call $_deflateEnd -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $global$1 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (block (result i32) -;; CHECK-NEXT: (drop -;; CHECK-NEXT: (call $_deflateEnd -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (global.set $global$1 -;; CHECK-NEXT: (local.get $3) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (i32.const 0) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) (module (type $A (struct (field (mut i32)))) ;; CHECK: (type $0 (func)) |