diff options
Diffstat (limited to 'test')
16 files changed, 3020 insertions, 4768 deletions
diff --git a/test/passes/asyncify.txt b/test/passes/asyncify.txt index f19b764fa..3c121c029 100644 --- a/test/passes/asyncify.txt +++ b/test/passes/asyncify.txt @@ -12,44 +12,31 @@ (func $do_sleep (; 0 ;) (local $0 i32) (local $1 i32) - (block - (local.set $0 - (global.get $sleeping) + (local.set $0 + (global.get $sleeping) + ) + (local.set $1 + (i32.eqz + (local.get $0) ) - (local.set $1 - (i32.eqz - (local.get $0) + ) + (if + (local.get $1) + (block $block + (global.set $sleeping + (i32.const 1) ) - ) - (if - (local.get $1) - (block - (block $block - (global.set $sleeping - (i32.const 1) - ) - (nop) - (call $asyncify_start_unwind - (i32.const 4) - ) - (nop) - ) - (nop) + (call $asyncify_start_unwind + (i32.const 4) ) - (block - (block $block0 - (global.set $sleeping - (i32.const 0) - ) - (nop) - (call $asyncify_stop_rewind) - (nop) - ) - (nop) + ) + (block $block0 + (global.set $sleeping + (i32.const 0) ) + (call $asyncify_stop_rewind) ) ) - (nop) ) (func $work (; 1 ;) (local $0 i32) @@ -90,63 +77,44 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $stuff) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (call $stuff) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (nop) - (if - (if (result i32) + (block + (call $do_sleep) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $do_sleep) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (block - (nop) - (call $stuff) - (nop) - ) ) - (nop) - (nop) ) (if (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (nop) + (call $stuff) ) ) ) @@ -214,38 +182,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $work) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $work) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -273,28 +232,16 @@ (nop) ) (func $second_event (; 4 ;) - (block - (call $asyncify_stop_unwind) - (nop) - (call $asyncify_start_rewind - (i32.const 4) - ) - (nop) - (call $work) - (nop) + (call $asyncify_stop_unwind) + (call $asyncify_start_rewind + (i32.const 4) ) - (nop) + (call $work) ) (func $never_sleep (; 5 ;) - (block - (call $stuff) - (nop) - (call $stuff) - (nop) - (call $stuff) - (nop) - ) - (nop) + (call $stuff) + (call $stuff) + (call $stuff) ) (func $asyncify_start_unwind (; 6 ;) (param $0 i32) (global.set $__asyncify_state @@ -420,38 +367,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -604,7 +542,6 @@ (local.set $temp (local.get $1) ) - (nop) (local.set $2 (local.get $temp) ) @@ -615,7 +552,6 @@ ) (nop) (nop) - (nop) ) (unreachable) ) @@ -776,14 +712,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (drop - (local.get $0) - ) - (nop) + (drop + (local.get $0) ) ) - (nop) ) ) (return) @@ -838,7 +770,6 @@ (drop (local.get $0) ) - (nop) ) (func $many-locals (; 7 ;) (param $x i32) (result i32) (local $y i32) @@ -960,49 +891,39 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (loop $l - (block - (local.set $2 - (local.get $y) - ) - (local.set $3 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (local.set $x - (local.get $3) - ) - (nop) - (local.set $4 - (local.get $x) - ) - (local.set $5 - (i32.div_s - (local.get $4) - (i32.const 3) - ) - ) - (local.set $y - (local.get $5) - ) - (nop) - (local.set $6 - (local.get $y) - ) - (br_if $l - (local.get $6) - ) - (nop) + (loop $l + (local.set $2 + (local.get $y) + ) + (local.set $3 + (i32.add + (local.get $2) + (i32.const 1) ) - (nop) ) - (nop) + (local.set $x + (local.get $3) + ) + (local.set $4 + (local.get $x) + ) + (local.set $5 + (i32.div_s + (local.get $4) + (i32.const 3) + ) + ) + (local.set $y + (local.get $5) + ) + (local.set $6 + (local.get $y) + ) + (br_if $l + (local.get $6) + ) ) ) - (nop) (if (if (result i32) (i32.eq @@ -1034,7 +955,6 @@ (i32.const 0) ) (block - (nop) (local.set $7 (local.get $y) ) @@ -1044,7 +964,6 @@ ) ) (nop) - (nop) ) (unreachable) ) @@ -1194,67 +1113,49 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (local.set $1 + (local.get $x) + ) + ) + (if + (i32.or + (local.get $1) (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (local.set $1 - (local.get $x) + (i32.const 2) ) ) (if - (i32.or - (local.get $1) + (if (result i32) (i32.eq (global.get $__asyncify_state) - (i32.const 2) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $3) + (i32.const 0) ) ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $3) - (i32.const 0) - ) - ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) + (call $import) (if (i32.eq (global.get $__asyncify_state) + (i32.const 1) + ) + (br $__asyncify_unwind (i32.const 0) ) - (nop) ) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) ) ) (return) @@ -1376,127 +1277,100 @@ ) ) (block + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (local.set $1 + (local.get $x) + ) + ) (block (if (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (local.set $1 - (local.get $x) + (local.set $2 + (local.get $1) ) ) - (block - (if + (if + (i32.or + (local.get $2) (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (local.set $2 - (local.get $1) + (i32.const 2) ) ) (if - (i32.or - (local.get $2) + (if (result i32) (i32.eq (global.get $__asyncify_state) - (i32.const 2) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $4) + (i32.const 0) ) ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $4) - (i32.const 0) - ) - ) - (block - (call $import3 - (i32.const 1) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) + (call $import3 + (i32.const 1) ) (if (i32.eq (global.get $__asyncify_state) + (i32.const 1) + ) + (br $__asyncify_unwind (i32.const 0) ) - (nop) ) ) ) + ) + (if + (i32.or + (i32.eqz + (local.get $2) + ) + (i32.eq + (global.get $__asyncify_state) + (i32.const 2) + ) + ) (if - (i32.or - (i32.eqz - (local.get $2) - ) + (if (result i32) (i32.eq (global.get $__asyncify_state) - (i32.const 2) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $4) + (i32.const 1) ) ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $4) - (i32.const 1) - ) - ) - (block - (call $import3 - (i32.const 2) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 1) - ) - ) - ) + (call $import3 + (i32.const 2) ) (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) + ) + (br $__asyncify_unwind + (i32.const 1) ) - (nop) ) ) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) ) ) (return) @@ -1682,40 +1556,31 @@ (i32.const 2) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $6) + (i32.const 0) + ) + ) + (block + (call $import3 + (i32.const 2) + ) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $6) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import3 - (i32.const 2) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -1726,14 +1591,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (nop) - (return - (i32.const 3) - ) + (return + (i32.const 3) ) ) - (nop) ) (unreachable) ) @@ -1909,41 +1770,32 @@ (i32.const 2) ) ) - (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $6) + (i32.const 0) + ) + ) + (block + (call $import3 (i32.const 1) - (i32.eq - (local.get $6) - (i32.const 0) - ) ) - (block - (call $import3 + (if + (i32.eq + (global.get $__asyncify_state) (i32.const 1) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) + (br $__asyncify_unwind + (i32.const 0) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) ) ) (if @@ -1973,14 +1825,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (nop) - (return - (i32.const 3) - ) + (return + (i32.const 3) ) ) - (nop) ) (unreachable) ) @@ -2121,79 +1969,32 @@ ) ) ) - (block - (loop $l + (loop $l + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $5) + (i32.const 0) + ) + ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $5) - (i32.const 0) - ) - ) - (block - (call $import3 - (i32.const 1) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) + (call $import3 + (i32.const 1) ) (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (block - (nop) - (local.set $1 - (local.get $x) - ) - (local.set $2 - (i32.add - (local.get $1) - (i32.const 1) - ) - ) - (local.set $x - (local.get $2) - ) - (nop) - (local.set $3 - (local.get $x) - ) - (br_if $l - (local.get $3) - ) - (nop) + (br $__asyncify_unwind + (i32.const 0) ) ) - (nop) - (nop) - (nop) - (nop) - (nop) - (nop) - (nop) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) (if @@ -2201,8 +2002,31 @@ (global.get $__asyncify_state) (i32.const 0) ) - (nop) + (block + (local.set $1 + (local.get $x) + ) + (local.set $2 + (i32.add + (local.get $1) + (i32.const 1) + ) + ) + (local.set $x + (local.get $2) + ) + (local.set $3 + (local.get $x) + ) + (br_if $l + (local.get $3) + ) + ) ) + (nop) + (nop) + (nop) + (nop) ) ) (return) @@ -2321,58 +2145,45 @@ ) ) ) - (block - (loop $l - (if - (if (result i32) + (loop $l + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $2) + (i32.const 0) + ) + ) + (block + (local.set $3 + (call $import2) + ) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $2) + (br $__asyncify_unwind (i32.const 0) ) - ) - (block - (local.set $3 - (call $import2) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - (local.set $0 - (local.get $3) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (block - (br_if $l - (local.get $0) + (local.set $0 + (local.get $3) ) - (nop) ) ) - (nop) ) (if (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (nop) + (br_if $l + (local.get $0) + ) ) ) ) @@ -2457,95 +2268,69 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (call $boring) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (nop) - (if - (if (result i32) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) ) - (if + ) + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (nop) - (call $boring) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 1) ) ) - (nop) - (nop) - (if - (if (result i32) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $1) (i32.const 1) ) - ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 1) - ) + (br $__asyncify_unwind + (i32.const 1) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -2614,95 +2399,69 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring-deep) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (call $boring-deep) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (nop) - (if - (if (result i32) + (block + (call $import-deep) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import-deep) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) ) - (if + ) + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (nop) - (call $boring) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 1) ) ) - (nop) - (nop) - (if - (if (result i32) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $1) (i32.const 1) ) - ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 1) - ) + (br $__asyncify_unwind + (i32.const 1) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -2731,7 +2490,6 @@ ) (func $boring-deep (; 17 ;) (call $boring) - (nop) ) (func $import-deep (; 18 ;) (local $0 i32) @@ -2771,38 +2529,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) diff --git a/test/passes/asyncify_mod-asyncify-always-and-only-unwind.txt b/test/passes/asyncify_mod-asyncify-always-and-only-unwind.txt index 49c3ed7ed..f5c1ed1c0 100644 --- a/test/passes/asyncify_mod-asyncify-always-and-only-unwind.txt +++ b/test/passes/asyncify_mod-asyncify-always-and-only-unwind.txt @@ -44,35 +44,26 @@ ) ) ) - (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $1) - (i32.const 0) - ) - ) - (block - (call $import) - (if - (i32.const 1) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if + (i32.const 1) + (br $__asyncify_unwind + (i32.const 0) + ) + ) ) ) ) @@ -216,7 +207,6 @@ (local.set $temp (local.get $1) ) - (nop) (local.set $2 (local.get $temp) ) @@ -227,7 +217,6 @@ ) (nop) (nop) - (nop) ) (unreachable) ) @@ -379,14 +368,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (drop - (local.get $0) - ) - (nop) + (drop + (local.get $0) ) ) - (nop) ) ) (return) @@ -441,7 +426,6 @@ (drop (local.get $0) ) - (nop) ) (func $asyncify_start_unwind (; 7 ;) (param $0 i32) (global.set $__asyncify_state diff --git a/test/passes/asyncify_mod-asyncify-never-unwind.txt b/test/passes/asyncify_mod-asyncify-never-unwind.txt index 1806e1fcd..b0ba19de0 100644 --- a/test/passes/asyncify_mod-asyncify-never-unwind.txt +++ b/test/passes/asyncify_mod-asyncify-never-unwind.txt @@ -50,35 +50,26 @@ ) ) ) - (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $1) - (i32.const 0) - ) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) ) - (block - (call $import) - (if - (i32.const 0) - (br $__asyncify_unwind - (i32.const 0) - ) - ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (if - (i32.eq - (global.get $__asyncify_state) + (block + (call $import) + (if (i32.const 0) + (br $__asyncify_unwind + (i32.const 0) + ) ) - (nop) ) ) ) @@ -228,7 +219,6 @@ (local.set $temp (local.get $1) ) - (nop) (local.set $2 (local.get $temp) ) @@ -239,7 +229,6 @@ ) (nop) (nop) - (nop) ) (unreachable) ) @@ -397,14 +386,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (drop - (local.get $0) - ) - (nop) + (drop + (local.get $0) ) ) - (nop) ) ) (return) @@ -459,7 +444,6 @@ (drop (local.get $0) ) - (nop) ) (func $asyncify_start_unwind (; 7 ;) (param $0 i32) (global.set $__asyncify_state diff --git a/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt b/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt index dc92b497d..2df8ccae6 100644 --- a/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt +++ b/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt @@ -20,17 +20,14 @@ (global.get $__asyncify_state) ) (block - (block - (call $import) - (if - (i32.ne - (global.get $__asyncify_state) - (local.get $0) - ) - (unreachable) + (call $import) + (if + (i32.ne + (global.get $__asyncify_state) + (local.get $0) ) + (unreachable) ) - (nop) ) ) (func $calls-import2-drop (; 4 ;) @@ -59,7 +56,6 @@ (drop (local.get $0) ) - (nop) ) ) (func $returns (; 5 ;) (result i32) @@ -93,7 +89,6 @@ (local.set $x (local.get $1) ) - (nop) (local.set $2 (local.get $x) ) @@ -131,7 +126,6 @@ (unreachable) ) ) - (nop) ) ) (func $asyncify_start_unwind (; 7 ;) (param $0 i32) diff --git a/test/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.txt b/test/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.txt index f15153c45..538060f41 100644 --- a/test/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.txt +++ b/test/passes/asyncify_pass-arg=asyncify-blacklist@foo,bar.txt @@ -11,11 +11,9 @@ (export "asyncify_stop_rewind" (func $asyncify_stop_rewind)) (func $foo (; 1 ;) (call $import) - (nop) ) (func $bar (; 2 ;) (call $import) - (nop) ) (func $baz (; 3 ;) (local $0 i32) @@ -55,38 +53,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -115,7 +104,6 @@ ) (func $other1 (; 4 ;) (call $foo) - (nop) ) (func $other2 (; 5 ;) (local $0 i32) @@ -155,38 +143,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $baz) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $baz) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) diff --git a/test/passes/asyncify_pass-arg=asyncify-ignore-imports.txt b/test/passes/asyncify_pass-arg=asyncify-ignore-imports.txt index 46f9730f4..d38e97626 100644 --- a/test/passes/asyncify_pass-arg=asyncify-ignore-imports.txt +++ b/test/passes/asyncify_pass-arg=asyncify-ignore-imports.txt @@ -16,7 +16,6 @@ (export "asyncify_stop_rewind" (func $asyncify_stop_rewind)) (func $calls-import (; 3 ;) (call $import) - (nop) ) (func $calls-import2-drop (; 4 ;) (local $0 i32) @@ -26,31 +25,21 @@ (drop (local.get $0) ) - (nop) ) (func $calls-import2-if-else (; 5 ;) (param $x i32) (local $1 i32) - (block - (local.set $1 - (local.get $x) + (local.set $1 + (local.get $x) + ) + (if + (local.get $1) + (call $import3 + (i32.const 1) ) - (if - (local.get $1) - (block - (call $import3 - (i32.const 1) - ) - (nop) - ) - (block - (call $import3 - (i32.const 2) - ) - (nop) - ) + (call $import3 + (i32.const 2) ) ) - (nop) ) (func $calls-indirect (; 6 ;) (param $x i32) (local $1 i32) @@ -155,13 +144,6 @@ ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) ) ) (return) diff --git a/test/passes/asyncify_pass-arg=asyncify-ignore-indirect.txt b/test/passes/asyncify_pass-arg=asyncify-ignore-indirect.txt index b793820ac..7b75800bd 100644 --- a/test/passes/asyncify_pass-arg=asyncify-ignore-indirect.txt +++ b/test/passes/asyncify_pass-arg=asyncify-ignore-indirect.txt @@ -52,38 +52,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -208,14 +199,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (drop - (local.get $0) - ) - (nop) + (drop + (local.get $0) ) ) - (nop) ) ) (return) @@ -333,127 +320,100 @@ ) ) (block + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (local.set $1 + (local.get $x) + ) + ) (block (if (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (local.set $1 - (local.get $x) + (local.set $2 + (local.get $1) ) ) - (block - (if + (if + (i32.or + (local.get $2) (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (local.set $2 - (local.get $1) + (i32.const 2) ) ) (if - (i32.or - (local.get $2) + (if (result i32) (i32.eq (global.get $__asyncify_state) - (i32.const 2) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $4) + (i32.const 0) ) ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $4) - (i32.const 0) - ) - ) - (block - (call $import3 - (i32.const 1) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) + (call $import3 + (i32.const 1) ) (if (i32.eq (global.get $__asyncify_state) + (i32.const 1) + ) + (br $__asyncify_unwind (i32.const 0) ) - (nop) ) ) ) + ) + (if + (i32.or + (i32.eqz + (local.get $2) + ) + (i32.eq + (global.get $__asyncify_state) + (i32.const 2) + ) + ) (if - (i32.or - (i32.eqz - (local.get $2) - ) + (if (result i32) (i32.eq (global.get $__asyncify_state) - (i32.const 2) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $4) + (i32.const 1) ) ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $4) - (i32.const 1) - ) - ) - (block - (call $import3 - (i32.const 2) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 1) - ) - ) - ) + (call $import3 + (i32.const 2) ) (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) + ) + (br $__asyncify_unwind + (i32.const 1) ) - (nop) ) ) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) ) ) (return) @@ -514,7 +474,6 @@ (call_indirect (type $none_=>_none) (local.get $1) ) - (nop) ) (func $asyncify_start_unwind (; 7 ;) (param $0 i32) (global.set $__asyncify_state diff --git a/test/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.txt b/test/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.txt index aa1efa769..a6a0a8b1d 100644 --- a/test/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.txt +++ b/test/passes/asyncify_pass-arg=asyncify-imports@env.import,env.import2.txt @@ -12,44 +12,31 @@ (func $do_sleep (; 0 ;) (local $0 i32) (local $1 i32) - (block - (local.set $0 - (global.get $sleeping) + (local.set $0 + (global.get $sleeping) + ) + (local.set $1 + (i32.eqz + (local.get $0) ) - (local.set $1 - (i32.eqz - (local.get $0) + ) + (if + (local.get $1) + (block $block + (global.set $sleeping + (i32.const 1) ) - ) - (if - (local.get $1) - (block - (block $block - (global.set $sleeping - (i32.const 1) - ) - (nop) - (call $asyncify_start_unwind - (i32.const 4) - ) - (nop) - ) - (nop) + (call $asyncify_start_unwind + (i32.const 4) ) - (block - (block $block0 - (global.set $sleeping - (i32.const 0) - ) - (nop) - (call $asyncify_stop_rewind) - (nop) - ) - (nop) + ) + (block $block0 + (global.set $sleeping + (i32.const 0) ) + (call $asyncify_stop_rewind) ) ) - (nop) ) (func $work (; 1 ;) (local $0 i32) @@ -90,63 +77,44 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $stuff) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (call $stuff) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (nop) - (if - (if (result i32) + (block + (call $do_sleep) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $do_sleep) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (block - (nop) - (call $stuff) - (nop) - ) ) - (nop) - (nop) ) (if (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (nop) + (call $stuff) ) ) ) @@ -214,38 +182,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $work) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $work) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -273,26 +232,15 @@ (nop) ) (func $second_event (; 4 ;) - (block - (call $asyncify_start_rewind - (i32.const 4) - ) - (nop) - (call $work) - (nop) + (call $asyncify_start_rewind + (i32.const 4) ) - (nop) + (call $work) ) (func $never_sleep (; 5 ;) - (block - (call $stuff) - (nop) - (call $stuff) - (nop) - (call $stuff) - (nop) - ) - (nop) + (call $stuff) + (call $stuff) + (call $stuff) ) (func $asyncify_start_unwind (; 6 ;) (param $0 i32) (global.set $__asyncify_state @@ -418,38 +366,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -602,7 +541,6 @@ (local.set $temp (local.get $1) ) - (nop) (local.set $2 (local.get $temp) ) @@ -613,7 +551,6 @@ ) (nop) (nop) - (nop) ) (unreachable) ) @@ -774,14 +711,10 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (drop - (local.get $0) - ) - (nop) + (drop + (local.get $0) ) ) - (nop) ) ) (return) @@ -836,7 +769,6 @@ (drop (local.get $0) ) - (nop) ) (func $many-locals (; 7 ;) (param $x i32) (result i32) (local $y i32) @@ -958,49 +890,39 @@ (global.get $__asyncify_state) (i32.const 0) ) - (block - (loop $l - (block - (local.set $2 - (local.get $y) - ) - (local.set $3 - (i32.add - (local.get $2) - (i32.const 1) - ) - ) - (local.set $x - (local.get $3) - ) - (nop) - (local.set $4 - (local.get $x) - ) - (local.set $5 - (i32.div_s - (local.get $4) - (i32.const 3) - ) - ) - (local.set $y - (local.get $5) - ) - (nop) - (local.set $6 - (local.get $y) - ) - (br_if $l - (local.get $6) - ) - (nop) + (loop $l + (local.set $2 + (local.get $y) + ) + (local.set $3 + (i32.add + (local.get $2) + (i32.const 1) + ) + ) + (local.set $x + (local.get $3) + ) + (local.set $4 + (local.get $x) + ) + (local.set $5 + (i32.div_s + (local.get $4) + (i32.const 3) ) - (nop) ) - (nop) + (local.set $y + (local.get $5) + ) + (local.set $6 + (local.get $y) + ) + (br_if $l + (local.get $6) + ) ) ) - (nop) (if (if (result i32) (i32.eq @@ -1032,7 +954,6 @@ (i32.const 0) ) (block - (nop) (local.set $7 (local.get $y) ) @@ -1042,7 +963,6 @@ ) ) (nop) - (nop) ) (unreachable) ) @@ -1192,67 +1112,49 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (local.set $1 + (local.get $x) + ) + ) + (if + (i32.or + (local.get $1) (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (local.set $1 - (local.get $x) + (i32.const 2) ) ) (if - (i32.or - (local.get $1) + (if (result i32) (i32.eq (global.get $__asyncify_state) - (i32.const 2) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $3) + (i32.const 0) ) ) (block - (if - (if (result i32) - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $3) - (i32.const 0) - ) - ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) + (call $import) (if (i32.eq (global.get $__asyncify_state) + (i32.const 1) + ) + (br $__asyncify_unwind (i32.const 0) ) - (nop) ) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) ) ) (return) @@ -1303,27 +1205,18 @@ ) (func $calls-import2-if-else (; 9 ;) (param $x i32) (local $1 i32) - (block - (local.set $1 - (local.get $x) + (local.set $1 + (local.get $x) + ) + (if + (local.get $1) + (call $import3 + (i32.const 1) ) - (if - (local.get $1) - (block - (call $import3 - (i32.const 1) - ) - (nop) - ) - (block - (call $import3 - (i32.const 2) - ) - (nop) - ) + (call $import3 + (i32.const 2) ) ) - (nop) ) (func $calls-import2-if-else-oneside (; 10 ;) (param $x i32) (result i32) (local $1 i32) @@ -1338,15 +1231,11 @@ (return (i32.const 1) ) - (block - (call $import3 - (i32.const 2) - ) - (nop) + (call $import3 + (i32.const 2) ) ) ) - (nop) (return (i32.const 3) ) @@ -1361,18 +1250,14 @@ ) (if (local.get $1) - (block - (call $import3 - (i32.const 1) - ) - (nop) + (call $import3 + (i32.const 1) ) (return (i32.const 2) ) ) ) - (nop) (return (i32.const 3) ) @@ -1382,35 +1267,28 @@ (local $2 i32) (local $3 i32) (loop $l - (block - (call $import3 + (call $import3 + (i32.const 1) + ) + (local.set $1 + (local.get $x) + ) + (local.set $2 + (i32.add + (local.get $1) (i32.const 1) ) - (nop) - (local.set $1 - (local.get $x) - ) - (local.set $2 - (i32.add - (local.get $1) - (i32.const 1) - ) - ) - (local.set $x - (local.get $2) - ) - (nop) - (local.set $3 - (local.get $x) - ) - (br_if $l - (local.get $3) - ) - (nop) ) - (nop) + (local.set $x + (local.get $2) + ) + (local.set $3 + (local.get $x) + ) + (br_if $l + (local.get $3) + ) ) - (nop) ) (func $calls-loop2 (; 13 ;) (local $0 i32) @@ -1474,58 +1352,45 @@ ) ) ) - (block - (loop $l - (if - (if (result i32) + (loop $l + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $2) + (i32.const 0) + ) + ) + (block + (local.set $3 + (call $import2) + ) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $2) + (br $__asyncify_unwind (i32.const 0) ) - ) - (block - (local.set $3 - (call $import2) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - (local.set $0 - (local.get $3) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (block - (br_if $l - (local.get $0) + (local.set $0 + (local.get $3) ) - (nop) ) ) - (nop) ) (if (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (nop) + (br_if $l + (local.get $0) + ) ) ) ) @@ -1610,95 +1475,69 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (call $boring) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (nop) - (if - (if (result i32) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) ) - (if + ) + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (nop) - (call $boring) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 1) ) ) - (nop) - (nop) - (if - (if (result i32) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $1) (i32.const 1) ) - ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 1) - ) + (br $__asyncify_unwind + (i32.const 1) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -1767,95 +1606,69 @@ ) ) (block - (block - (if + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring-deep) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (call $boring-deep) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) ) ) - (nop) - (if - (if (result i32) + (block + (call $import-deep) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import-deep) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) ) - (if + ) + (if + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (call $boring) + ) + (if + (if (result i32) (i32.eq (global.get $__asyncify_state) (i32.const 0) ) - (block - (nop) - (call $boring) - (nop) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 1) ) ) - (nop) - (nop) - (if - (if (result i32) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) - ) - (i32.const 1) - (i32.eq - (local.get $1) (i32.const 1) ) - ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 1) - ) + (br $__asyncify_unwind + (i32.const 1) ) ) ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -1884,7 +1697,6 @@ ) (func $boring-deep (; 17 ;) (call $boring) - (nop) ) (func $import-deep (; 18 ;) (local $0 i32) @@ -1924,38 +1736,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) diff --git a/test/passes/asyncify_pass-arg=asyncify-whitelist@foo,bar.txt b/test/passes/asyncify_pass-arg=asyncify-whitelist@foo,bar.txt index 27f728dc7..d8512cd7e 100644 --- a/test/passes/asyncify_pass-arg=asyncify-whitelist@foo,bar.txt +++ b/test/passes/asyncify_pass-arg=asyncify-whitelist@foo,bar.txt @@ -47,38 +47,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -143,38 +134,29 @@ ) ) ) - (block - (if - (if (result i32) + (if + (if (result i32) + (i32.eq + (global.get $__asyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 0) + ) + ) + (block + (call $import) + (if (i32.eq (global.get $__asyncify_state) - (i32.const 0) + (i32.const 1) ) - (i32.const 1) - (i32.eq - (local.get $1) + (br $__asyncify_unwind (i32.const 0) ) ) - (block - (call $import) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 1) - ) - (br $__asyncify_unwind - (i32.const 0) - ) - ) - ) - ) - (if - (i32.eq - (global.get $__asyncify_state) - (i32.const 0) - ) - (nop) ) ) ) @@ -203,15 +185,12 @@ ) (func $baz (; 3 ;) (call $import) - (nop) ) (func $other1 (; 4 ;) (call $foo) - (nop) ) (func $other2 (; 5 ;) (call $baz) - (nop) ) (func $asyncify_start_unwind (; 6 ;) (param $0 i32) (global.set $__asyncify_state diff --git a/test/passes/flatten.bin.txt b/test/passes/flatten.bin.txt index 554c6d6f9..b415de02a 100644 --- a/test/passes/flatten.bin.txt +++ b/test/passes/flatten.bin.txt @@ -103,7 +103,6 @@ (block $label$1 (nop) (unreachable) - (unreachable) ) (unreachable) ) @@ -142,15 +141,12 @@ (local.set $7 (f32.const 5.5) ) - (nop) (local.set $5 (i64.const 6) ) - (nop) (local.set $8 (f64.const 8) ) - (nop) (local.set $9 (local.get $0) ) diff --git a/test/passes/flatten.txt b/test/passes/flatten.txt index b4cb5289a..7d7eb80dd 100644 --- a/test/passes/flatten.txt +++ b/test/passes/flatten.txt @@ -20,7 +20,6 @@ (drop (local.get $0) ) - (nop) ) (func $a2 (; 1 ;) (result i32) (local $0 i32) @@ -77,7 +76,6 @@ (drop (local.get $2) ) - (nop) ) (func $a5 (; 4 ;) (result i32) (local $0 i32) @@ -304,7 +302,6 @@ (br_if $outer (i32.const -1) ) - (nop) (local.set $0 (i32.add (i32.const 0) @@ -361,7 +358,6 @@ (drop (local.get $2) ) - (nop) (local.set $x (i32.const 2) ) @@ -380,7 +376,6 @@ (drop (local.get $4) ) - (nop) (local.set $x (i32.const 5) ) @@ -399,7 +394,6 @@ (drop (local.get $6) ) - (nop) (local.set $x (i32.const 6) ) @@ -424,7 +418,6 @@ (drop (local.get $9) ) - (nop) (local.set $1 (i32.const 8) ) @@ -441,14 +434,10 @@ (func $a11 (; 10 ;) (if (i32.const 0) - (block - (drop - (i32.const 1) - ) - (nop) + (drop + (i32.const 1) ) ) - (nop) ) (func $a12 (; 11 ;) (result i32) (local $0 i32) @@ -550,14 +539,10 @@ ) (if (local.get $0) - (block - (unreachable) - (unreachable) - ) + (unreachable) (block (block $label$3 (unreachable) - (unreachable) ) (local.set $2 (local.get $1) @@ -565,7 +550,6 @@ (drop (local.get $2) ) - (nop) ) ) ) @@ -591,7 +575,6 @@ (local.set $x (i32.const 0) ) - (nop) (local.set $2 (i32.const 0) ) @@ -616,7 +599,6 @@ (drop (local.get $6) ) - (nop) (local.set $5 (i32.const 0) ) @@ -668,7 +650,6 @@ (local $0 i32) (local $1 i32) (block $label$1 - (unreachable) (local.set $0 (i32.const 1) ) @@ -694,7 +675,6 @@ (func $a19 (; 18 ;) (result f32) (block $label$0 (block $label$1 - (unreachable) (return (f32.const 4289944320) ) @@ -723,633 +703,510 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block - (block $out - (br $out) - (unreachable) + (block $out + (br $out) + (unreachable) + (drop + (i32.const 0) + ) + (if + (i32.const 1) (drop - (i32.const 0) + (i32.const 2) ) - (nop) - (if - (i32.const 1) - (block - (drop - (i32.const 2) - ) - (nop) + ) + (br_table $out $out $out $out + (i32.const 3) + ) + (unreachable) + (call $code-to-kill) + ) + (if + (i32.const 0) + (block + (block $out1 + (unreachable) + (drop + (i32.const 0) ) ) - (nop) - (br_table $out $out $out $out - (i32.const 3) - ) (unreachable) - (call $code-to-kill) - (nop) ) - (nop) - (if - (i32.const 0) - (block - (block $out1 - (unreachable) - (unreachable) - (drop - (i32.const 0) - ) - (nop) - ) + ) + (if + (i32.const 0) + (block + (block $out3 + (return) (unreachable) - ) - ) - (nop) - (if - (i32.const 0) - (block - (block $out3 - (return) - (unreachable) - (drop - (i32.const 0) - ) - (nop) + (drop + (i32.const 0) ) - (unreachable) - ) - ) - (nop) - (block $out4 - (br_table $out4 $out4 $out4 $out4 - (i32.const 4) ) (unreachable) - (drop - (i32.const 0) - ) - (nop) ) - (nop) - (block $out5 - (br_if $out5 - (i32.const 3) - ) - (nop) - (drop - (i32.const 0) - ) - (nop) + ) + (block $out4 + (br_table $out4 $out4 $out4 $out4 + (i32.const 4) ) - (nop) - (if + (unreachable) + (drop (i32.const 0) - (block - (block $block4 - (if - (i32.const 0) - (block - (block $out8 - (unreachable) - (unreachable) - (drop - (i32.const 0) - ) - (nop) - ) + ) + ) + (block $out5 + (br_if $out5 + (i32.const 3) + ) + (drop + (i32.const 0) + ) + ) + (if + (i32.const 0) + (block + (block $block4 + (if + (i32.const 0) + (block + (block $out8 (unreachable) - ) - (block - (block $out9 - (unreachable) - (unreachable) - (drop - (i32.const 0) - ) - (nop) + (drop + (i32.const 0) ) - (unreachable) ) + (unreachable) ) - (unreachable) - (drop - (i32.const 0) + (block + (block $out9 + (unreachable) + (drop + (i32.const 0) + ) + ) + (unreachable) ) - (nop) ) (unreachable) + (drop + (i32.const 0) + ) ) + (unreachable) ) - (nop) - (if - (i32.const 0) - (block - (block $out11 - (unreachable) - (unreachable) - (unreachable) - (drop - (i32.const 0) - ) - (nop) - (unreachable) - (unreachable) - ) - (local.set $2 - (local.get $1) - ) + ) + (if + (i32.const 0) + (block + (block $out11 + (unreachable) + (unreachable) (drop - (local.get $2) + (i32.const 0) ) - (nop) + (unreachable) + ) + (local.set $2 + (local.get $1) + ) + (drop + (local.get $2) ) ) - (nop) - (if - (i32.const 0) - (block - (block $out13 - (unreachable) - (unreachable) - (unreachable) - (drop - (i32.const 0) - ) - (nop) - (unreachable) - (unreachable) - ) - (local.set $4 - (local.get $3) - ) + ) + (if + (i32.const 0) + (block + (block $out13 + (unreachable) + (unreachable) (drop - (local.get $4) + (i32.const 0) ) - (nop) + (unreachable) + ) + (local.set $4 + (local.get $3) + ) + (drop + (local.get $4) ) ) - (nop) - (if - (i32.const 0) - (block - (block $out15 - (unreachable) - (unreachable) - (unreachable) - (unreachable) - (drop - (i32.const 0) - ) - (nop) - (unreachable) - (unreachable) - ) - (local.set $6 - (local.get $5) - ) + ) + (if + (i32.const 0) + (block + (block $out15 + (unreachable) + (unreachable) (drop - (local.get $6) + (i32.const 0) ) - (nop) + (unreachable) + ) + (local.set $6 + (local.get $5) + ) + (drop + (local.get $6) ) ) - (nop) - (block $out16 - (block $in - (br_if $out16 - (i32.const 1) - ) - (nop) + ) + (block $out16 + (block $in + (br_if $out16 + (i32.const 1) ) - (nop) - (unreachable) - (unreachable) ) - (nop) - (if - (i32.const 0) - (block - (block $block11 - (block $out18 - (block $in19 - (br_if $in19 - (i32.const 1) - ) - (nop) + (unreachable) + ) + (if + (i32.const 0) + (block + (block $block11 + (block $out18 + (block $in19 + (br_if $in19 + (i32.const 1) ) - (nop) - (unreachable) - (unreachable) ) (unreachable) - (drop - (i32.const 10) - ) - (nop) ) (unreachable) - ) - ) - (nop) - (block $out20 - (block $in21 - (br_table $out20 $in21 - (i32.const 1) + (drop + (i32.const 10) ) - (unreachable) ) - (nop) - (unreachable) (unreachable) ) - (nop) - (block $out22 - (block $in23 - (br_table $in23 $out22 - (i32.const 1) - ) - (unreachable) + ) + (block $out20 + (block $in21 + (br_table $out20 $in21 + (i32.const 1) ) - (nop) (unreachable) + ) + (unreachable) + ) + (block $out22 + (block $in23 + (br_table $in23 $out22 + (i32.const 1) + ) (unreachable) ) - (nop) - (if - (i32.const 0) - (block - (block $block13 - (block $out25 - (block $in26 - (br_table $in26 $in26 - (i32.const 1) - ) - (unreachable) + (unreachable) + ) + (if + (i32.const 0) + (block + (block $block13 + (block $out25 + (block $in26 + (br_table $in26 $in26 + (i32.const 1) ) - (nop) - (unreachable) (unreachable) ) (unreachable) - (drop - (i32.const 10) - ) - (nop) ) (unreachable) + (drop + (i32.const 10) + ) ) + (unreachable) ) - (nop) - (if - (i32.const 0) - (block - (block $block15 - (drop - (i32.const 10) - ) - (nop) - (drop - (i32.const 42) - ) - (nop) - (unreachable) - (unreachable) - (unreachable) - (return - (unreachable) - ) - (unreachable) - (unreachable) - (unreachable) - (return) + ) + (if + (i32.const 0) + (block + (block $block15 + (drop + (i32.const 10) + ) + (drop + (i32.const 42) + ) + (unreachable) + (return (unreachable) ) (unreachable) + (unreachable) + (return) + (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 0) - (block - (loop $loop-in18 - (unreachable) - (unreachable) - ) + ) + (if + (i32.const 0) + (block + (loop $loop-in18 (unreachable) ) + (unreachable) ) - (nop) - (block $out29 - (loop $in30 - (block - (br_if $out29 - (i32.const 1) - ) - (nop) - (unreachable) - (unreachable) + ) + (block $out29 + (loop $in30 + (block + (br_if $out29 + (i32.const 1) ) (unreachable) ) (unreachable) ) - (nop) - (if - (i32.const 0) - (block - (block $block20 - (loop $in32 - (block - (br_if $in32 - (i32.const 1) - ) - (nop) - (unreachable) - (unreachable) + (unreachable) + ) + (if + (i32.const 0) + (block + (block $block20 + (loop $in32 + (block + (br_if $in32 + (i32.const 1) ) (unreachable) ) (unreachable) - (drop - (i32.const 10) - ) - (nop) ) (unreachable) - ) - ) - (nop) - (if - (i32.const 1) - (block - (unreachable) - (call $call-me - (i32.const 123) - (unreachable) + (drop + (i32.const 10) ) - (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 2) - (block - (unreachable) - (call $call-me - (unreachable) - (i32.const 0) - ) + ) + (if + (i32.const 1) + (block + (call $call-me + (i32.const 123) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 3) - (block - (unreachable) - (unreachable) - (call $call-me - (unreachable) - (unreachable) - ) + ) + (if + (i32.const 2) + (block + (call $call-me (unreachable) + (i32.const 0) ) + (unreachable) ) - (nop) - (if - (i32.const -1) - (block + ) + (if + (i32.const 3) + (block + (call $call-me (unreachable) - (call_indirect (type $i32_i32_=>_none) - (i32.const 123) - (i32.const 456) - (unreachable) - ) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const -2) - (block - (unreachable) - (call_indirect (type $i32_i32_=>_none) - (i32.const 139) - (unreachable) - (i32.const 0) - ) + ) + (if + (i32.const -1) + (block + (call_indirect (type $i32_i32_=>_none) + (i32.const 123) + (i32.const 456) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const -3) - (block - (unreachable) - (unreachable) - (call_indirect (type $i32_i32_=>_none) - (i32.const 246) - (unreachable) - (unreachable) - ) + ) + (if + (i32.const -2) + (block + (call_indirect (type $i32_i32_=>_none) + (i32.const 139) (unreachable) + (i32.const 0) ) + (unreachable) ) - (nop) - (if - (i32.const -4) - (block - (unreachable) - (unreachable) + ) + (if + (i32.const -3) + (block + (call_indirect (type $i32_i32_=>_none) + (i32.const 246) (unreachable) - (call_indirect (type $i32_i32_=>_none) - (unreachable) - (unreachable) - (unreachable) - ) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 11) - (block + ) + (if + (i32.const -4) + (block + (call_indirect (type $i32_i32_=>_none) (unreachable) (unreachable) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 22) - (block + ) + (if + (i32.const 11) + (block + (unreachable) + (unreachable) + ) + ) + (if + (i32.const 22) + (block + (i32.load (unreachable) - (i32.load - (unreachable) - ) - (drop - (unreachable) - ) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 33) - (block - (unreachable) - (i32.store - (i32.const 0) - (unreachable) - ) + ) + (if + (i32.const 33) + (block + (i32.store + (i32.const 0) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 44) - (block - (unreachable) - (i32.store - (unreachable) - (i32.const 0) - ) + ) + (if + (i32.const 44) + (block + (i32.store (unreachable) + (i32.const 0) ) + (unreachable) ) - (nop) - (if - (i32.const 55) - (block - (unreachable) + ) + (if + (i32.const 55) + (block + (i32.store (unreachable) - (i32.store - (unreachable) - (unreachable) - ) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 66) - (block + ) + (if + (i32.const 66) + (block + (i32.eqz (unreachable) - (i32.eqz - (unreachable) - ) - (drop - (unreachable) - ) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 77) - (block + ) + (if + (i32.const 77) + (block + (i32.add (unreachable) - (i32.add - (unreachable) - (i32.const 0) - ) - (drop - (unreachable) - ) + (i32.const 0) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 88) - (block + ) + (if + (i32.const 88) + (block + (i32.add + (i32.const 0) (unreachable) - (i32.add - (i32.const 0) - (unreachable) - ) - (drop - (unreachable) - ) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 99) - (block - (unreachable) + ) + (if + (i32.const 99) + (block + (i32.add (unreachable) - (i32.add - (unreachable) - (unreachable) - ) (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 100) - (block + ) + (if + (i32.const 100) + (block + (select + (i32.const 123) + (i32.const 456) (unreachable) - (select - (i32.const 123) - (i32.const 456) - (unreachable) - ) - (drop - (unreachable) - ) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 101) - (block + ) + (if + (i32.const 101) + (block + (select + (i32.const 123) (unreachable) - (select - (i32.const 123) - (unreachable) - (i32.const 456) - ) - (drop - (unreachable) - ) + (i32.const 456) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (if - (i32.const 102) - (block + ) + (if + (i32.const 102) + (block + (select (unreachable) - (select - (unreachable) - (i32.const 123) - (i32.const 456) - ) - (drop - (unreachable) - ) + (i32.const 123) + (i32.const 456) + ) + (drop (unreachable) ) + (unreachable) ) - (nop) - (drop - (i32.const 1337) - ) - (nop) ) - (nop) + (drop + (i32.const 1337) + ) ) (func $killer (; 21 ;) (block (unreachable) - (unreachable) (drop (i32.const 1000) ) - (nop) ) (unreachable) ) @@ -1357,7 +1214,6 @@ (drop (i32.const 2000) ) - (nop) ) (func $typed-block-none-then-unreachable (; 23 ;) (result i32) (local $0 i32) @@ -1371,7 +1227,6 @@ (br $switch$0) (unreachable) ) - (nop) (return (i32.const 1) ) @@ -1399,9 +1254,7 @@ ) (unreachable) ) - (nop) ) - (nop) (local.set $1 (local.get $$$0) ) @@ -1412,7 +1265,6 @@ (br $switch$7) (unreachable) ) - (nop) (local.set $2 (local.get $$$0) ) @@ -1421,7 +1273,6 @@ ) (unreachable) ) - (nop) (return (i32.const 0) ) @@ -1438,18 +1289,15 @@ (local $0 i32) (block (unreachable) - (unreachable) (local.set $0 (global.get $x) ) (drop (local.get $0) ) - (nop) (global.set $x (i32.const 1) ) - (nop) ) (unreachable) ) @@ -1504,15 +1352,12 @@ (block $label$0 (block $label$3 (nop) - (unreachable) (br_table $label$3 (unreachable) ) (unreachable) (unreachable) - (unreachable) ) - (nop) (local.set $0 (i32.const 19) ) @@ -1530,15 +1375,12 @@ (block $label$0 (block $label$2 (nop) - (unreachable) (br_if $label$2 (unreachable) ) (unreachable) (unreachable) - (unreachable) ) - (nop) (local.set $0 (i32.const 19) ) @@ -1582,7 +1424,6 @@ (local $5 i32) (block $label$0 (block $label$1 - (unreachable) (local.set $1 (i32.const 4104) ) @@ -1686,7 +1527,6 @@ (local.get $10) ) (nop) - (nop) (local.set $11 (local.get $2) ) @@ -1697,7 +1537,6 @@ (local.set $13 (local.get $12) ) - (unreachable) (i64.mul (local.get $13) (unreachable) @@ -1775,7 +1614,6 @@ (drop (local.get $0) ) - (nop) (br $out) (i32.add (i32.const 1) @@ -1809,11 +1647,9 @@ (drop (i32.const 2) ) - (nop) (drop (i32.const 3) ) - (nop) (local.set $1 (i32.const 4) ) @@ -1830,7 +1666,6 @@ (drop (local.get $3) ) - (nop) (block $in (block $switch-in (local.set $4 @@ -1853,7 +1688,6 @@ (drop (local.get $7) ) - (nop) (local.set $5 (i32.const 3) ) @@ -1875,7 +1709,6 @@ (drop (local.get $9) ) - (nop) (loop $loop-in (local.set $10 (i32.const 5) @@ -1893,7 +1726,6 @@ (drop (local.get $12) ) - (nop) (if (i32.const 6) (local.set $13 @@ -1915,7 +1747,6 @@ (drop (local.get $15) ) - (nop) (local.set $16 (select (i32.const 9) @@ -1926,7 +1757,6 @@ (drop (local.get $16) ) - (nop) (br $out) (select (unreachable) @@ -1979,7 +1809,6 @@ (drop (local.get $19) ) - (nop) (if (i32.const 11) (local.set $20 @@ -2002,7 +1831,6 @@ (drop (local.get $22) ) - (nop) (if (i32.const 11) (local.set $23 @@ -2025,7 +1853,6 @@ (drop (local.get $25) ) - (nop) (if (i32.const 11) (local.set $26 @@ -2060,7 +1887,6 @@ (drop (local.get $30) ) - (nop) (return) (i32.add (i32.const 1) @@ -2070,7 +1896,6 @@ (unreachable) ) (unreachable) - (unreachable) (i32.add (i32.const 1) (unreachable) @@ -2122,7 +1947,6 @@ (drop (local.get $36) ) - (nop) (block $temp (local.set $37 (i32.const 1) @@ -2143,9 +1967,7 @@ (drop (local.get $39) ) - (nop) ) - (nop) ) (func $flatten-return-value (; 35 ;) (result i32) (local $0 i32) @@ -2210,83 +2032,69 @@ ) (if (local.get $8) - (block - (block $block44 - (block $label$78 - (local.set $430 - (i32.const 0) - ) - (nop) - ) - (nop) - (local.set $9 - (local.get $430) + (block $block44 + (block $label$78 + (local.set $430 + (i32.const 0) ) - (local.set $432 - (local.get $9) - ) - (nop) ) - (nop) + (local.set $9 + (local.get $430) + ) + (local.set $432 + (local.get $9) + ) ) - (block - (block $block45 - (block $label$79 - (local.set $10 - (local.get $9) - ) - (local.set $11 - (local.get $5) - ) - (local.set $12 + (block $block45 + (block $label$79 + (local.set $10 + (local.get $9) + ) + (local.set $11 + (local.get $5) + ) + (local.set $12 + (local.get $12) + ) + (local.set $13 + (i32.mul (local.get $12) + (i32.const 12) ) - (local.set $13 - (i32.mul - (local.get $12) - (i32.const 12) - ) - ) - (local.set $14 - (i32.add - (local.get $11) - (local.get $13) - ) - ) - (local.set $15 - (i32.load16_u offset=2 - (local.get $14) - ) - ) - (local.set $16 - (i32.lt_u - (local.get $10) - (local.get $15) - ) + ) + (local.set $14 + (i32.add + (local.get $11) + (local.get $13) ) - (local.set $431 - (local.get $16) + ) + (local.set $15 + (i32.load16_u offset=2 + (local.get $14) ) - (nop) ) - (nop) - (local.set $17 - (local.get $431) + (local.set $16 + (i32.lt_u + (local.get $10) + (local.get $15) + ) ) - (local.set $432 - (local.get $17) + (local.set $431 + (local.get $16) ) - (nop) ) - (nop) + (local.set $17 + (local.get $431) + ) + (local.set $432 + (local.get $17) + ) ) ) ) - (nop) (local.set $433 (i32.const 1) ) - (nop) (local.set $18 (local.get $432) ) @@ -2309,7 +2117,6 @@ (drop (local.get $22) ) - (nop) ) (func $outer-block-typed (; 37 ;) (param $var$0 i32) (result i32) (local $1 i32) @@ -2375,7 +2182,6 @@ (drop (local.get $5) ) - (nop) (local.set $4 (i32.const 1) ) @@ -2389,13 +2195,11 @@ ) (func $switch-unreachable (; 39 ;) (block $label$3 - (unreachable) (br_table $label$3 (unreachable) ) (unreachable) ) - (nop) ) (func $br_if_order (; 40 ;) (param $x i32) (result i32) (local $1 i32) @@ -2472,8 +2276,6 @@ (drop (local.get $2) ) - (nop) - (unreachable) (unreachable) (drop (unreachable) @@ -2494,7 +2296,6 @@ (drop (local.get $4) ) - (nop) ) (unreachable) ) diff --git a/test/passes/flatten_i64-to-i32-lowering.txt b/test/passes/flatten_i64-to-i32-lowering.txt index a151142dc..0fb98cb83 100644 --- a/test/passes/flatten_i64-to-i32-lowering.txt +++ b/test/passes/flatten_i64-to-i32-lowering.txt @@ -83,7 +83,6 @@ ) (func $unreachable-select-i64 (; 2 ;) (result i32) (local $i64toi32_i32$0 i32) - (unreachable) (block (drop (block (result i32) @@ -102,7 +101,6 @@ ) (func $unreachable-select-i64-b (; 3 ;) (result i32) (local $i64toi32_i32$0 i32) - (unreachable) (block (unreachable) (drop @@ -122,7 +120,6 @@ (func $unreachable-select-i64-c (; 4 ;) (result i32) (local $i64toi32_i32$0 i32) (local $i64toi32_i32$1 i32) - (unreachable) (block (drop (block (result i32) @@ -159,263 +156,250 @@ (local $i64toi32_i32$1 i32) (local $i64toi32_i32$2 i32) (block - (block - (local.set $0 - (block (result i32) - (local.set $i64toi32_i32$2 - (i32.const 0) - ) - (local.set $i64toi32_i32$0 - (i32.load - (local.get $i64toi32_i32$2) - ) + (local.set $0 + (block (result i32) + (local.set $i64toi32_i32$2 + (i32.const 0) + ) + (local.set $i64toi32_i32$0 + (i32.load + (local.get $i64toi32_i32$2) ) - (local.set $i64toi32_i32$1 - (i32.load offset=4 - (local.get $i64toi32_i32$2) - ) + ) + (local.set $i64toi32_i32$1 + (i32.load offset=4 + (local.get $i64toi32_i32$2) ) - (local.get $i64toi32_i32$0) ) + (local.get $i64toi32_i32$0) ) - (local.set $0$hi - (local.get $i64toi32_i32$1) + ) + (local.set $0$hi + (local.get $i64toi32_i32$1) + ) + ) + (drop + (block (result i32) + (local.set $i64toi32_i32$1 + (local.get $0$hi) ) + (local.get $0) ) - (drop + ) + (block + (local.set $1 (block (result i32) - (local.set $i64toi32_i32$1 - (local.get $0$hi) + (local.set $i64toi32_i32$2 + (i32.const 0) ) - (local.get $0) - ) - ) - (nop) - (block - (local.set $1 - (block (result i32) - (local.set $i64toi32_i32$2 - (i32.const 0) - ) - (local.set $i64toi32_i32$1 - (i32.load - (local.get $i64toi32_i32$2) - ) + (local.set $i64toi32_i32$1 + (i32.load + (local.get $i64toi32_i32$2) ) - (local.set $i64toi32_i32$0 - (i32.load offset=4 - (local.get $i64toi32_i32$2) - ) + ) + (local.set $i64toi32_i32$0 + (i32.load offset=4 + (local.get $i64toi32_i32$2) ) - (local.get $i64toi32_i32$1) ) + (local.get $i64toi32_i32$1) ) - (local.set $1$hi - (local.get $i64toi32_i32$0) + ) + (local.set $1$hi + (local.get $i64toi32_i32$0) + ) + ) + (drop + (block (result i32) + (local.set $i64toi32_i32$0 + (local.get $1$hi) ) + (local.get $1) ) - (drop + ) + (block + (local.set $2 (block (result i32) - (local.set $i64toi32_i32$0 - (local.get $1$hi) + (local.set $i64toi32_i32$2 + (i32.const 0) ) - (local.get $1) - ) - ) - (nop) - (block - (local.set $2 - (block (result i32) - (local.set $i64toi32_i32$2 - (i32.const 0) - ) - (local.set $i64toi32_i32$0 - (i32.load align=2 - (local.get $i64toi32_i32$2) - ) + (local.set $i64toi32_i32$0 + (i32.load align=2 + (local.get $i64toi32_i32$2) ) - (local.set $i64toi32_i32$1 - (i32.load offset=4 align=2 - (local.get $i64toi32_i32$2) - ) + ) + (local.set $i64toi32_i32$1 + (i32.load offset=4 align=2 + (local.get $i64toi32_i32$2) ) - (local.get $i64toi32_i32$0) ) + (local.get $i64toi32_i32$0) ) - (local.set $2$hi - (local.get $i64toi32_i32$1) + ) + (local.set $2$hi + (local.get $i64toi32_i32$1) + ) + ) + (drop + (block (result i32) + (local.set $i64toi32_i32$1 + (local.get $2$hi) ) + (local.get $2) ) - (drop + ) + (block + (local.set $3 (block (result i32) - (local.set $i64toi32_i32$1 - (local.get $2$hi) + (local.set $i64toi32_i32$2 + (i32.const 0) ) - (local.get $2) - ) - ) - (nop) - (block - (local.set $3 - (block (result i32) - (local.set $i64toi32_i32$2 - (i32.const 0) - ) - (local.set $i64toi32_i32$1 - (i32.load align=1 - (local.get $i64toi32_i32$2) - ) + (local.set $i64toi32_i32$1 + (i32.load align=1 + (local.get $i64toi32_i32$2) ) - (local.set $i64toi32_i32$0 - (i32.load offset=4 align=1 - (local.get $i64toi32_i32$2) - ) + ) + (local.set $i64toi32_i32$0 + (i32.load offset=4 align=1 + (local.get $i64toi32_i32$2) ) - (local.get $i64toi32_i32$1) ) + (local.get $i64toi32_i32$1) ) - (local.set $3$hi - (local.get $i64toi32_i32$0) + ) + (local.set $3$hi + (local.get $i64toi32_i32$0) + ) + ) + (drop + (block (result i32) + (local.set $i64toi32_i32$0 + (local.get $3$hi) ) + (local.get $3) ) - (drop + ) + (block + (local.set $4 (block (result i32) - (local.set $i64toi32_i32$0 - (local.get $3$hi) + (local.set $i64toi32_i32$2 + (i32.const 0) ) - (local.get $3) - ) - ) - (nop) - (block - (local.set $4 - (block (result i32) - (local.set $i64toi32_i32$2 - (i32.const 0) - ) - (local.set $i64toi32_i32$0 - (i32.load - (local.get $i64toi32_i32$2) - ) + (local.set $i64toi32_i32$0 + (i32.load + (local.get $i64toi32_i32$2) ) - (local.set $i64toi32_i32$1 - (i32.load offset=4 - (local.get $i64toi32_i32$2) - ) + ) + (local.set $i64toi32_i32$1 + (i32.load offset=4 + (local.get $i64toi32_i32$2) ) - (local.get $i64toi32_i32$0) ) + (local.get $i64toi32_i32$0) ) - (local.set $4$hi - (local.get $i64toi32_i32$1) + ) + (local.set $4$hi + (local.get $i64toi32_i32$1) + ) + ) + (drop + (block (result i32) + (local.set $i64toi32_i32$1 + (local.get $4$hi) ) + (local.get $4) ) - (drop + ) + (block + (local.set $i64toi32_i32$0 + (i32.const 0) + ) + (i32.store + (local.get $i64toi32_i32$0) (block (result i32) (local.set $i64toi32_i32$1 - (local.get $4$hi) + (i32.const 0) ) - (local.get $4) + (i32.const 1) ) ) - (nop) - (block - (local.set $i64toi32_i32$0 - (i32.const 0) - ) - (i32.store - (local.get $i64toi32_i32$0) - (block (result i32) - (local.set $i64toi32_i32$1 - (i32.const 0) - ) - (i32.const 1) - ) - ) - (i32.store offset=4 - (local.get $i64toi32_i32$0) - (local.get $i64toi32_i32$1) - ) + (i32.store offset=4 + (local.get $i64toi32_i32$0) + (local.get $i64toi32_i32$1) ) - (nop) - (block - (local.set $i64toi32_i32$0 - (i32.const 0) - ) - (i32.store - (local.get $i64toi32_i32$0) - (block (result i32) - (local.set $i64toi32_i32$1 - (i32.const 0) - ) - (i32.const 2) + ) + (block + (local.set $i64toi32_i32$0 + (i32.const 0) + ) + (i32.store + (local.get $i64toi32_i32$0) + (block (result i32) + (local.set $i64toi32_i32$1 + (i32.const 0) ) - ) - (i32.store offset=4 - (local.get $i64toi32_i32$0) - (local.get $i64toi32_i32$1) + (i32.const 2) ) ) - (nop) - (block - (local.set $i64toi32_i32$0 - (i32.const 0) - ) - (i32.store align=2 - (local.get $i64toi32_i32$0) - (block (result i32) - (local.set $i64toi32_i32$1 - (i32.const 0) - ) - (i32.const 3) + (i32.store offset=4 + (local.get $i64toi32_i32$0) + (local.get $i64toi32_i32$1) + ) + ) + (block + (local.set $i64toi32_i32$0 + (i32.const 0) + ) + (i32.store align=2 + (local.get $i64toi32_i32$0) + (block (result i32) + (local.set $i64toi32_i32$1 + (i32.const 0) ) - ) - (i32.store offset=4 align=2 - (local.get $i64toi32_i32$0) - (local.get $i64toi32_i32$1) + (i32.const 3) ) ) - (nop) - (block - (local.set $i64toi32_i32$0 - (i32.const 0) - ) - (i32.store align=1 - (local.get $i64toi32_i32$0) - (block (result i32) - (local.set $i64toi32_i32$1 - (i32.const 0) - ) - (i32.const 4) + (i32.store offset=4 align=2 + (local.get $i64toi32_i32$0) + (local.get $i64toi32_i32$1) + ) + ) + (block + (local.set $i64toi32_i32$0 + (i32.const 0) + ) + (i32.store align=1 + (local.get $i64toi32_i32$0) + (block (result i32) + (local.set $i64toi32_i32$1 + (i32.const 0) ) - ) - (i32.store offset=4 align=1 - (local.get $i64toi32_i32$0) - (local.get $i64toi32_i32$1) + (i32.const 4) ) ) - (nop) - (block - (local.set $i64toi32_i32$0 - (i32.const 0) - ) - (i32.store - (local.get $i64toi32_i32$0) - (block (result i32) - (local.set $i64toi32_i32$1 - (i32.const 0) - ) - (i32.const 5) + (i32.store offset=4 align=1 + (local.get $i64toi32_i32$0) + (local.get $i64toi32_i32$1) + ) + ) + (block + (local.set $i64toi32_i32$0 + (i32.const 0) + ) + (i32.store + (local.get $i64toi32_i32$0) + (block (result i32) + (local.set $i64toi32_i32$1 + (i32.const 0) ) - ) - (i32.store offset=4 - (local.get $i64toi32_i32$0) - (local.get $i64toi32_i32$1) + (i32.const 5) ) ) - (nop) + (i32.store offset=4 + (local.get $i64toi32_i32$0) + (local.get $i64toi32_i32$1) + ) ) - (nop) ) ) (module @@ -436,45 +420,40 @@ (local $0$hi i32) (local $i64toi32_i32$0 i32) (block - (block - (local.set $0 - (block (result i32) - (local.set $i64toi32_i32$0 - (global.get $f$hi) - ) - (global.get $f) + (local.set $0 + (block (result i32) + (local.set $i64toi32_i32$0 + (global.get $f$hi) ) + (global.get $f) ) - (local.set $0$hi - (local.get $i64toi32_i32$0) + ) + (local.set $0$hi + (local.get $i64toi32_i32$0) + ) + ) + (call $call + (block (result i32) + (local.set $i64toi32_i32$0 + (local.get $0$hi) ) + (local.get $0) ) - (call $call + (local.get $i64toi32_i32$0) + ) + (block + (global.set $f (block (result i32) (local.set $i64toi32_i32$0 - (local.get $0$hi) + (i32.const 287454020) ) - (local.get $0) + (i32.const 1432778632) ) - (local.get $i64toi32_i32$0) ) - (nop) - (block - (global.set $f - (block (result i32) - (local.set $i64toi32_i32$0 - (i32.const 287454020) - ) - (i32.const 1432778632) - ) - ) - (global.set $f$hi - (local.get $i64toi32_i32$0) - ) + (global.set $f$hi + (local.get $i64toi32_i32$0) ) - (nop) ) - (nop) ) (func $2 (; 2 ;) (local $0 i32) @@ -484,7 +463,6 @@ (local $i64toi32_i32$0 i32) (block $label$1 (unreachable) - (unreachable) ) (block (local.set $1 @@ -512,7 +490,6 @@ (local.get $i64toi32_i32$0) ) ) - (nop) ) ) (module @@ -532,44 +509,39 @@ (local $0$hi i32) (local $i64toi32_i32$0 i32) (block - (block - (local.set $0 - (block (result i32) - (local.set $i64toi32_i32$0 - (global.get $f$hi) - ) - (global.get $f) + (local.set $0 + (block (result i32) + (local.set $i64toi32_i32$0 + (global.get $f$hi) ) + (global.get $f) ) - (local.set $0$hi - (local.get $i64toi32_i32$0) + ) + (local.set $0$hi + (local.get $i64toi32_i32$0) + ) + ) + (call $call + (block (result i32) + (local.set $i64toi32_i32$0 + (local.get $0$hi) ) + (local.get $0) ) - (call $call + (local.get $i64toi32_i32$0) + ) + (block + (global.set $f (block (result i32) (local.set $i64toi32_i32$0 - (local.get $0$hi) + (i32.const 287454020) ) - (local.get $0) + (i32.const 1432778632) ) - (local.get $i64toi32_i32$0) ) - (nop) - (block - (global.set $f - (block (result i32) - (local.set $i64toi32_i32$0 - (i32.const 287454020) - ) - (i32.const 1432778632) - ) - ) - (global.set $f$hi - (local.get $i64toi32_i32$0) - ) + (global.set $f$hi + (local.get $i64toi32_i32$0) ) - (nop) ) - (nop) ) ) diff --git a/test/passes/flatten_local-cse.txt b/test/passes/flatten_local-cse.txt index 4c1e08b8d..f576ccefe 100644 --- a/test/passes/flatten_local-cse.txt +++ b/test/passes/flatten_local-cse.txt @@ -26,118 +26,104 @@ (local $17 i32) (local $18 i32) (local $19 i32) - (block - (local.set $2 - (i32.add - (i32.const 1) - (i32.const 2) - ) - ) - (drop - (local.get $2) - ) - (nop) - (local.set $3 - (local.get $2) - ) - (drop - (local.get $2) - ) - (nop) - (if - (i32.const 0) - (nop) - ) - (nop) - (local.set $4 - (i32.add - (i32.const 1) - (i32.const 2) - ) - ) - (drop - (local.get $4) - ) - (nop) - (local.set $5 - (local.get $x) - ) - (local.set $6 - (local.get $y) - ) - (local.set $7 - (i32.add - (local.get $x) - (local.get $y) - ) - ) - (drop - (local.get $7) - ) - (nop) - (local.set $8 - (local.get $x) - ) - (local.set $9 - (local.get $y) - ) - (local.set $10 - (local.get $7) - ) - (drop - (local.get $7) + (local.set $2 + (i32.add + (i32.const 1) + (i32.const 2) ) + ) + (drop + (local.get $2) + ) + (local.set $3 + (local.get $2) + ) + (drop + (local.get $2) + ) + (if + (i32.const 0) (nop) - (local.set $11 - (local.get $x) - ) - (local.set $12 - (local.get $y) - ) - (local.set $13 - (local.get $7) - ) - (drop - (local.get $7) + ) + (local.set $4 + (i32.add + (i32.const 1) + (i32.const 2) ) - (nop) - (call $basics) - (nop) - (local.set $14 + ) + (drop + (local.get $4) + ) + (local.set $5 + (local.get $x) + ) + (local.set $6 + (local.get $y) + ) + (local.set $7 + (i32.add (local.get $x) - ) - (local.set $15 (local.get $y) ) - (local.set $16 - (local.get $7) - ) - (drop - (local.get $7) - ) - (nop) - (local.set $x - (i32.const 100) - ) - (nop) - (local.set $17 + ) + (drop + (local.get $7) + ) + (local.set $8 + (local.get $x) + ) + (local.set $9 + (local.get $y) + ) + (local.set $10 + (local.get $7) + ) + (drop + (local.get $7) + ) + (local.set $11 + (local.get $x) + ) + (local.set $12 + (local.get $y) + ) + (local.set $13 + (local.get $7) + ) + (drop + (local.get $7) + ) + (call $basics) + (local.set $14 + (local.get $x) + ) + (local.set $15 + (local.get $y) + ) + (local.set $16 + (local.get $7) + ) + (drop + (local.get $7) + ) + (local.set $x + (i32.const 100) + ) + (local.set $17 + (local.get $x) + ) + (local.set $18 + (local.get $y) + ) + (local.set $19 + (i32.add (local.get $x) - ) - (local.set $18 (local.get $y) ) - (local.set $19 - (i32.add - (local.get $x) - (local.get $y) - ) - ) - (drop - (local.get $19) - ) - (nop) ) - (nop) + (drop + (local.get $19) + ) ) (func $recursive1 (; 1 ;) (local $x i32) @@ -147,42 +133,36 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block - (local.set $2 - (i32.add - (i32.const 2) - (i32.const 3) - ) - ) - (local.set $3 - (i32.add - (i32.const 1) - (local.get $2) - ) - ) - (drop - (local.get $3) - ) - (nop) - (local.set $4 - (local.get $2) - ) - (local.set $5 - (local.get $3) - ) - (drop - (local.get $3) + (local.set $2 + (i32.add + (i32.const 2) + (i32.const 3) ) - (nop) - (local.set $6 - (local.get $2) - ) - (drop + ) + (local.set $3 + (i32.add + (i32.const 1) (local.get $2) ) - (nop) ) - (nop) + (drop + (local.get $3) + ) + (local.set $4 + (local.get $2) + ) + (local.set $5 + (local.get $3) + ) + (drop + (local.get $3) + ) + (local.set $6 + (local.get $2) + ) + (drop + (local.get $2) + ) ) (func $recursive2 (; 2 ;) (local $x i32) @@ -192,42 +172,36 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block - (local.set $2 - (i32.add - (i32.const 2) - (i32.const 3) - ) + (local.set $2 + (i32.add + (i32.const 2) + (i32.const 3) ) - (local.set $3 - (i32.add - (i32.const 1) - (local.get $2) - ) - ) - (drop - (local.get $3) - ) - (nop) - (local.set $4 - (local.get $2) - ) - (drop - (local.get $2) - ) - (nop) - (local.set $5 + ) + (local.set $3 + (i32.add + (i32.const 1) (local.get $2) ) - (local.set $6 - (local.get $3) - ) - (drop - (local.get $3) - ) - (nop) ) - (nop) + (drop + (local.get $3) + ) + (local.set $4 + (local.get $2) + ) + (drop + (local.get $2) + ) + (local.set $5 + (local.get $2) + ) + (local.set $6 + (local.get $3) + ) + (drop + (local.get $3) + ) ) (func $self (; 3 ;) (local $x i32) @@ -236,60 +210,50 @@ (local $3 i32) (local $4 i32) (local $5 i32) - (block - (local.set $2 - (i32.add - (i32.const 2) - (i32.const 3) - ) - ) - (local.set $3 - (local.get $2) - ) - (local.set $4 - (i32.add - (local.get $2) - (local.get $2) - ) + (local.set $2 + (i32.add + (i32.const 2) + (i32.const 3) ) - (drop - (local.get $4) - ) - (nop) - (local.set $5 + ) + (local.set $3 + (local.get $2) + ) + (local.set $4 + (i32.add (local.get $2) - ) - (drop (local.get $2) ) - (nop) ) - (nop) + (drop + (local.get $4) + ) + (local.set $5 + (local.get $2) + ) + (drop + (local.get $2) + ) ) (func $loads (; 4 ;) (local $0 i32) (local $1 i32) - (block - (local.set $0 - (i32.load - (i32.const 10) - ) - ) - (drop - (local.get $0) + (local.set $0 + (i32.load + (i32.const 10) ) - (nop) - (local.set $1 - (i32.load - (i32.const 10) - ) - ) - (drop - (local.get $1) + ) + (drop + (local.get $0) + ) + (local.set $1 + (i32.load + (i32.const 10) ) - (nop) ) - (nop) + (drop + (local.get $1) + ) ) (func $8 (; 5 ;) (param $var$0 i32) (result i32) (local $var$1 i32) @@ -359,7 +323,6 @@ (local.get $5) (local.get $11) ) - (nop) (local.set $12 (local.get $var$1) ) @@ -399,7 +362,6 @@ (local.get $var$1) (local.get $19) ) - (nop) (local.set $20 (i32.const 0) ) @@ -426,28 +388,24 @@ (local.set $x (local.get $y) ) - (nop) (local.set $3 (local.get $x) ) (local.set $y (local.get $x) ) - (nop) (local.set $4 (local.get $x) ) (local.set $x (local.get $x) ) - (nop) (local.set $5 (local.get $x) ) (local.set $y (local.get $x) ) - (nop) (local.set $6 (local.get $x) ) @@ -480,42 +438,36 @@ (local.set $x (local.get $y) ) - (nop) (local.set $4 (local.get $z) ) (local.set $y (local.get $z) ) - (nop) (local.set $5 (local.get $x) ) (local.set $z (local.get $x) ) - (nop) (local.set $6 (local.get $y) ) (local.set $x (local.get $y) ) - (nop) (local.set $7 (local.get $z) ) (local.set $y (local.get $z) ) - (nop) (local.set $8 (local.get $x) ) (local.set $z (local.get $x) ) - (nop) (local.set $9 (local.get $x) ) @@ -547,35 +499,30 @@ (local.set $x (local.get $y) ) - (nop) (local.set $4 (local.get $z) ) (local.set $y (local.get $z) ) - (nop) (local.set $5 (local.get $y) ) (local.set $z (local.get $y) ) - (nop) (local.set $6 (local.get $y) ) (local.set $y (local.get $y) ) - (nop) (local.set $7 (local.get $y) ) (local.set $z (local.get $y) ) - (nop) (local.set $8 (local.get $y) ) @@ -620,7 +567,6 @@ (local.set $var$2 (local.get $5) ) - (nop) (local.set $6 (f32.const 1) ) @@ -646,48 +592,41 @@ (local $4 i32) (local $5 i32) (local $6 i32) - (block - (block $label$1 - (local.set $3 - (i32.const 128) - ) - (br_if $label$1 - (i32.const 0) - ) - (local.set $4 - (local.get $3) - ) - (local.set $3 - (i32.const 0) - ) - (br_if $label$1 - (local.get $4) - ) - (local.set $5 - (local.get $3) - ) - (drop - (local.get $3) - ) - (nop) - (local.set $3 - (i32.const -14051) - ) + (block $label$1 + (local.set $3 + (i32.const 128) ) - (local.set $6 + (br_if $label$1 + (i32.const 0) + ) + (local.set $4 + (local.get $3) + ) + (local.set $3 + (i32.const 0) + ) + (br_if $label$1 + (local.get $4) + ) + (local.set $5 (local.get $3) ) - (if + (drop (local.get $3) - (block - (global.set $global$0 - (i32.const 0) - ) - (nop) - ) + ) + (local.set $3 + (i32.const -14051) + ) + ) + (local.set $6 + (local.get $3) + ) + (if + (local.get $3) + (global.set $global$0 + (i32.const 0) ) ) - (nop) ) (func $1 (; 1 ;) (call $0 @@ -695,7 +634,6 @@ (f32.const -nan:0x7fc91a) (i32.const -46) ) - (nop) ) (func $2 (; 2 ;) (param $var$0 i32) (param $var$1 f64) (result i32) (local $2 i32) @@ -708,13 +646,9 @@ ) (if (local.get $2) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) ) - (nop) (local.set $3 (i32.const 0) ) @@ -735,31 +669,26 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (block - (local.set $1 - (local.get $var$0) - ) - (local.set $2 - (i32.eqz - (local.get $var$0) - ) - ) - (call $out - (local.get $2) - ) - (nop) - (local.set $3 + (local.set $1 + (local.get $var$0) + ) + (local.set $2 + (i32.eqz (local.get $var$0) ) - (local.set $4 - (local.get $2) - ) - (call $out - (local.get $2) - ) - (nop) ) - (nop) + (call $out + (local.get $2) + ) + (local.set $3 + (local.get $var$0) + ) + (local.set $4 + (local.get $2) + ) + (call $out + (local.get $2) + ) ) ) (module @@ -783,18 +712,15 @@ (local.set $temp (local.get $1) ) - (nop) (local.set $temp (i64.const 9999) ) - (nop) (local.set $2 (local.get $1) ) (local.set $temp (local.get $1) ) - (nop) (local.set $3 (local.get $temp) ) @@ -815,29 +741,23 @@ (local $2 i32) (local $3 i32) (local $4 i32) - (block - (local.set $2 - (global.get $glob) - ) - (local.set $x - (local.get $2) - ) - (nop) - (local.set $3 - (local.get $x) - ) - (local.set $y - (local.get $x) - ) - (nop) - (local.set $4 - (local.get $x) - ) - (local.set $y - (local.get $x) - ) - (nop) + (local.set $2 + (global.get $glob) + ) + (local.set $x + (local.get $2) + ) + (local.set $3 + (local.get $x) + ) + (local.set $y + (local.get $x) + ) + (local.set $4 + (local.get $x) + ) + (local.set $y + (local.get $x) ) - (nop) ) ) diff --git a/test/passes/flatten_rereloop.txt b/test/passes/flatten_rereloop.txt index 654c844a6..20c99108a 100644 --- a/test/passes/flatten_rereloop.txt +++ b/test/passes/flatten_rereloop.txt @@ -517,7 +517,7 @@ (local $8 i32) (local $9 i32) (local $10 i32) - (block $block$21$break + (block $block$18$break (block (local.set $4 (local.get $x) @@ -537,11 +537,11 @@ (br $shape$2$continue) ) ) - (br $block$21$break) + (br $block$18$break) ) ) (block - (block $block$24$break + (block $block$21$break (loop $shape$4$continue (block (call $trivial) @@ -558,7 +558,7 @@ (if (local.get $7) (br $shape$4$continue) - (br $block$24$break) + (br $block$21$break) ) ) ) @@ -972,7 +972,7 @@ ) ) (block - (block $block$9$break + (block $block$8$break (block (call $switch (i32.const 1) @@ -989,13 +989,13 @@ ) (block $switch$3$leave (block $switch$3$default - (block $switch$3$case$9 - (br_table $switch$3$case$9 $switch$3$case$9 $switch$3$case$9 $switch$3$default + (block $switch$3$case$8 + (br_table $switch$3$case$8 $switch$3$case$8 $switch$3$case$8 $switch$3$default (local.get $6) ) ) (block - (br $block$9$break) + (br $block$8$break) ) ) (block @@ -1004,7 +1004,7 @@ (i32.const 2) ) (block - (br $block$9$break) + (br $block$8$break) ) ) ) diff --git a/test/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.txt b/test/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.txt index 2116e0e42..8677d9ed3 100644 --- a/test/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.txt +++ b/test/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.txt @@ -1472,8 +1472,6 @@ infer %4 (nop) (nop) (nop) - (nop) - (nop) (local.set $12 (i64.eq (local.get $a) @@ -1488,7 +1486,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $15 (i32.and (local.get $12) @@ -1543,8 +1540,6 @@ infer %4 (nop) (nop) (nop) - (nop) - (nop) (local.set $15 (i64.eq (local.get $a) @@ -1559,7 +1554,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $18 (i32.and (local.get $15) @@ -1573,10 +1567,7 @@ infer %4 ) (unreachable) ) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) ) (unreachable) @@ -1612,7 +1603,6 @@ infer %4 (i32.const 1) ) ) - (nop) ) (block (nop) @@ -1623,12 +1613,10 @@ infer %4 (i32.const 2) ) ) - (nop) ) ) ) (nop) - (nop) (local.set $8 (i32.and (local.get $x) @@ -1660,147 +1648,124 @@ infer %4 (local $11 i32) (local $12 i32) (local $13 i32) - (block - (nop) - (nop) - (nop) - (local.set $x - (i32.ge_s - (local.get $x) - (local.get $y) - ) - ) - (nop) - (nop) - (nop) - (nop) - (local.set $x - (i32.ge_u - (local.get $x) - (local.get $y) - ) + (nop) + (nop) + (nop) + (local.set $x + (i32.ge_s + (local.get $x) + (local.get $y) ) - (nop) - (nop) - (nop) - (nop) - (local.set $x - (i32.gt_s - (local.get $x) - (local.get $y) - ) + ) + (nop) + (nop) + (nop) + (local.set $x + (i32.ge_u + (local.get $x) + (local.get $y) ) - (nop) - (nop) - (nop) - (nop) - (local.set $x - (i32.gt_u - (local.get $x) - (local.get $y) - ) + ) + (nop) + (nop) + (nop) + (local.set $x + (i32.gt_s + (local.get $x) + (local.get $y) ) - (nop) ) (nop) + (nop) + (nop) + (local.set $x + (i32.gt_u + (local.get $x) + (local.get $y) + ) + ) ) (func $various-conditions-1 (; 4 ;) (param $x i32) (local $1 i32) (local $2 i32) (local $3 i32) - (block - (nop) - (if - (local.get $x) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 1) - ) + (nop) + (if + (local.get $x) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 1) ) - (nop) ) ) ) - (nop) ) (func $various-conditions-2 (; 5 ;) (param $x i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) - (block - (nop) - (local.set $2 - (i32.lt_s - (local.get $x) - (i32.const 0) - ) + (nop) + (local.set $2 + (i32.lt_s + (local.get $x) + (i32.const 0) ) - (if - (local.get $2) - (block - (nop) - (nop) - (local.set $x - (i32.sub - (local.get $x) - (i32.const 2) - ) + ) + (if + (local.get $2) + (block + (nop) + (nop) + (local.set $x + (i32.sub + (local.get $x) + (i32.const 2) ) - (nop) ) ) ) - (nop) ) (func $various-conditions-3 (; 6 ;) (param $x i32) (local $1 i32) (local $2 i32) (local $3 i32) - (block - (local.set $1 - (i32.reinterpret_f32 - (f32.const 0) - ) + (local.set $1 + (i32.reinterpret_f32 + (f32.const 0) ) - (if - (local.get $1) - (block - (nop) - (nop) - (local.set $x - (i32.sub - (local.get $x) - (i32.const 4) - ) + ) + (if + (local.get $1) + (block + (nop) + (nop) + (local.set $x + (i32.sub + (local.get $x) + (i32.const 4) ) - (nop) ) ) ) - (nop) ) (func $various-conditions-4 (; 7 ;) (param $x i32) (local $1 i32) (local $2 i32) - (block + (if (unreachable) - (if - (unreachable) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) ) ) @@ -1817,52 +1782,48 @@ infer %4 (local $9 i32) (local $10 i32) (local $11 i32) - (block - (nop) - (local.set $3 - (i32.eqz - (local.get $x) - ) + (nop) + (local.set $3 + (i32.eqz + (local.get $x) ) - (if - (local.get $3) - (block - (nop) - (local.set $5 - (i32.ctz - (local.get $y) - ) + ) + (if + (local.get $3) + (block + (nop) + (local.set $5 + (i32.ctz + (local.get $y) ) - (nop) - (local.set $7 - (i32.clz - (local.get $x) - ) + ) + (nop) + (local.set $7 + (i32.clz + (local.get $x) ) - (nop) - (local.set $9 - (i32.popcnt - (local.get $y) - ) + ) + (nop) + (local.set $9 + (i32.popcnt + (local.get $y) ) - (local.set $10 - (i32.sub - (local.get $7) - (local.get $9) - ) + ) + (local.set $10 + (i32.sub + (local.get $7) + (local.get $9) ) - (nop) - (local.set $x - (i32.add - (local.get $5) - (local.get $10) - ) + ) + (nop) + (local.set $x + (i32.add + (local.get $5) + (local.get $10) ) - (nop) ) ) ) - (nop) ) (func $unary-condition (; 9 ;) (param $x i32) (local $1 i32) @@ -1870,35 +1831,31 @@ infer %4 (local $3 i32) (local $4 i32) (local $5 i32) - (block - (nop) - (local.set $2 - (i32.gt_u - (local.get $x) - (i32.const 1) - ) + (nop) + (local.set $2 + (i32.gt_u + (local.get $x) + (i32.const 1) ) - (local.set $3 - (i32.ctz - (local.get $2) - ) + ) + (local.set $3 + (i32.ctz + (local.get $2) ) - (if - (local.get $3) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 2) - ) + ) + (if + (local.get $3) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 2) ) - (nop) ) ) ) - (nop) ) (func $unary-condition-2 (; 10 ;) (param $x i32) (local $1 i32) @@ -1906,35 +1863,31 @@ infer %4 (local $3 i32) (local $4 i32) (local $5 i32) - (block - (nop) - (local.set $2 - (i32.gt_u - (local.get $x) - (i32.const 1) - ) + (nop) + (local.set $2 + (i32.gt_u + (local.get $x) + (i32.const 1) ) - (local.set $3 - (i32.eqz - (local.get $2) - ) + ) + (local.set $3 + (i32.eqz + (local.get $2) ) - (if - (local.get $3) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 2) - ) + ) + (if + (local.get $3) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 2) ) - (nop) ) ) ) - (nop) ) (func $if-else-cond (; 11 ;) (param $x i32) (result i32) (local $1 i32) @@ -1967,7 +1920,6 @@ infer %4 (i32.const 1) ) ) - (nop) ) (block (nop) @@ -1978,12 +1930,10 @@ infer %4 (i32.const 2) ) ) - (nop) ) ) ) (nop) - (nop) (local.set $8 (i32.and (local.get $x) @@ -2094,23 +2044,16 @@ infer %4 (nop) (if (local.get $2) - (block - (local.set $x - (i32.const 1) - ) - (nop) + (local.set $x + (i32.const 1) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) (nop) - (nop) ) (nop) (return @@ -2195,25 +2138,21 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $y) ) (nop) (nop) - (nop) (local.set $x (i32.add (local.get $x) (i32.const 2) ) ) - (nop) ) (nop) (nop) (nop) - (nop) ) (local.set $10 (i32.add @@ -2237,20 +2176,16 @@ infer %4 (i32.const 1) ) (nop) - (nop) (br_if $out (local.get $y) ) - (nop) (local.set $x (i32.const 2) ) - (nop) ) (nop) (nop) (nop) - (nop) ) (local.set $6 (i32.add @@ -2270,16 +2205,12 @@ infer %4 (block (if (i32.const 0) - (block - (local.set $x - (f64.const 1) - ) - (nop) + (local.set $x + (f64.const 1) ) ) (nop) (nop) - (nop) ) (nop) (return @@ -2345,7 +2276,6 @@ infer %4 (local.get $y) ) ) - (nop) ) (block (nop) @@ -2357,13 +2287,11 @@ infer %4 (local.get $y) ) ) - (nop) ) ) ) (nop) (nop) - (nop) ) (nop) (return @@ -2426,7 +2354,6 @@ infer %4 (i32.const 1) ) (nop) - (nop) (return (local.get $x) ) @@ -2434,16 +2361,12 @@ infer %4 ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) @@ -2469,22 +2392,16 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) - (unreachable) (unreachable) ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) @@ -2512,29 +2429,23 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (br $out) (unreachable) ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) (unreachable) ) (nop) - (nop) (return (local.get $x) ) @@ -2562,7 +2473,6 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (br_table $out $out $out (i32.const 1) ) @@ -2570,23 +2480,18 @@ infer %4 ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) (unreachable) ) (nop) - (nop) (return (local.get $x) ) @@ -2610,37 +2515,27 @@ infer %4 (nop) (if (local.get $x) - (block - (block $block - (local.set $x - (i32.const 1) - ) - (nop) - (nop) - (br_if $out - (local.get $x) - ) - (nop) - ) - (nop) - ) - (block + (block $block (local.set $x - (i32.const 2) + (i32.const 1) ) (nop) + (br_if $out + (local.get $x) + ) + ) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) (unreachable) ) (nop) - (nop) (return (local.get $x) ) @@ -2656,109 +2551,88 @@ infer %4 (local $5 i32) (local $6 i32) (local $7 i32) - (block - (block $label$1 - (block $label$2 - (block $label$3 - (block - (nop) - (if - (local.get $2) + (block $label$1 + (block $label$2 + (block $label$3 + (block + (nop) + (if + (local.get $2) + (block (block - (block - (nop) - (if - (local.get $0) - (block - (block $block - (local.set $1 - (i32.const -8531) - ) - (nop) - (br $label$3) - (unreachable) + (nop) + (if + (local.get $0) + (block + (block $block + (local.set $1 + (i32.const -8531) ) + (br $label$3) (unreachable) ) - (block - (block $block3 - (local.set $1 - (i32.const -8531) - ) - (nop) - (br $label$1) - (unreachable) + (unreachable) + ) + (block + (block $block3 + (local.set $1 + (i32.const -8531) ) + (br $label$1) (unreachable) ) + (unreachable) ) ) - (unreachable) ) + (unreachable) ) ) - (nop) - (br $label$2) - (unreachable) ) - (nop) - (local.set $6 - (i32.load - (i32.const 0) - ) - ) - (drop - (local.get $6) - ) - (nop) - (br $label$1) + (br $label$2) (unreachable) ) - (nop) - (nop) - (i32.store16 - (i32.const 1) - (local.get $1) + (local.set $6 + (i32.load + (i32.const 0) + ) ) - (nop) - (unreachable) + (drop + (local.get $6) + ) + (br $label$1) (unreachable) ) (nop) (i32.store16 - (i32.const 0) - (i32.const -8531) + (i32.const 1) + (local.get $1) ) - (nop) + (unreachable) + ) + (i32.store16 + (i32.const 0) + (i32.const -8531) ) - (nop) ) (func $in-unreachable-operations (; 31 ;) (param $x i32) (param $y i32) (result i32) (local $2 i32) (local $3 i32) (block $block (unreachable) - (unreachable) (block (nop) (if (local.get $x) - (block - (local.set $x - (i32.const 1) - ) - (nop) + (local.set $x + (i32.const 1) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) @@ -2789,15 +2663,11 @@ infer %4 ) (unreachable) ) - (nop) - (unreachable) (unreachable) ) - (nop) (br $label$1) (unreachable) ) - (nop) (local.set $var$0 (i32.const 8) ) @@ -2811,22 +2681,17 @@ infer %4 (local.get $3) (f64.const 0) ) - (nop) (br $label$1) (unreachable) ) - (nop) - (unreachable) (unreachable) ) (nop) - (nop) (i32.store (local.get $var$0) (i32.const 16) ) (nop) - (nop) ) (local.set $6 (i32.const 1) @@ -2902,7 +2767,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -2911,7 +2775,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -2920,7 +2783,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -2929,7 +2791,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -2938,7 +2799,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -2947,7 +2807,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -2956,7 +2815,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -2965,7 +2823,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -2974,7 +2831,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -2983,7 +2839,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -2992,7 +2847,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3001,7 +2855,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3010,7 +2863,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3019,7 +2871,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3028,7 +2879,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3037,7 +2887,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3046,7 +2895,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3055,7 +2903,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3064,7 +2911,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3073,7 +2919,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3082,7 +2927,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3091,7 +2935,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3100,7 +2943,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3109,7 +2951,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3118,7 +2959,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3127,7 +2967,6 @@ infer %4 ) (nop) (nop) - (nop) ) (nop) (return @@ -3170,85 +3009,74 @@ infer %4 (if (local.get $5) (block - (block - (nop) - (local.set $7 - (i64.eqz - (local.get $x) - ) + (nop) + (local.set $7 + (i64.eqz + (local.get $x) ) - (if - (local.get $7) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.add - (local.get $x) - (local.get $y) - ) + ) + (if + (local.get $7) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.add + (local.get $x) + (local.get $y) ) - (nop) ) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.sub - (local.get $x) - (local.get $y) - ) + ) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.sub + (local.get $x) + (local.get $y) ) - (nop) ) ) ) - (nop) ) (block - (block - (nop) - (local.set $15 - (i64.eqz - (local.get $y) - ) + (nop) + (local.set $15 + (i64.eqz + (local.get $y) ) - (if - (local.get $15) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.mul - (local.get $x) - (local.get $y) - ) + ) + (if + (local.get $15) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.mul + (local.get $x) + (local.get $y) ) - (nop) ) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.div_s - (local.get $x) - (local.get $y) - ) + ) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.div_s + (local.get $x) + (local.get $y) ) - (nop) ) ) ) - (nop) ) ) ) (nop) - (nop) (return (local.get $t) ) @@ -3269,17 +3097,14 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy (nop) ) (nop) (nop) - (nop) (local.set $4 (i32.add (local.get $x) @@ -3310,37 +3135,29 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (nop) - (local.set $y - (i32.add - (local.get $y) - (i32.const 4) - ) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) (nop) + (nop) + (local.set $y + (i32.add + (local.get $y) + (i32.const 4) + ) + ) ) (nop) (nop) - (nop) (local.set $8 (i32.add (local.get $x) @@ -3372,42 +3189,33 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (nop) - (local.set $y - (i32.add - (local.get $y) - (i32.const 4) - ) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) - (nop) - (br_if $loopy + ) + (nop) + (nop) + (local.set $y + (i32.add (local.get $y) + (i32.const 4) ) - (nop) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3437,33 +3245,25 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $7 (i32.add (local.get $x) @@ -3493,37 +3293,28 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (local.set $y - (i32.const 2) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) + ) + (local.set $y + (i32.const 2) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $7 (i32.add (local.get $x) @@ -3554,36 +3345,27 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (nop) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) (nop) + (nop) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $8 (i32.add (local.get $x) @@ -3613,37 +3395,28 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (local.set $y - (i32.const 5) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) + ) + (local.set $y + (i32.const 5) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $7 (i32.add (local.get $x) @@ -3679,42 +3452,31 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (local.set $z - (local.get $x) - ) - (nop) - (nop) - (local.set $w - (local.get $y) - ) - (nop) - (local.set $x - (i32.const 1) - ) - (nop) - (local.set $y - (i32.const 4) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) - ) - (nop) + (nop) + (local.set $z + (local.get $x) ) (nop) + (local.set $w + (local.get $y) + ) + (local.set $x + (i32.const 1) + ) + (local.set $y + (i32.const 4) + ) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3760,39 +3522,29 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (local.set $t - (local.get $x) - ) - (nop) - (nop) - (local.set $x - (local.get $y) - ) - (nop) - (nop) - (local.set $y - (local.get $t) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) - ) - (nop) + (nop) + (local.set $t + (local.get $x) + ) + (nop) + (local.set $x + (local.get $y) ) (nop) + (local.set $y + (local.get $t) + ) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3824,39 +3576,29 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 1) ) - (nop) (loop $loopy - (block - (nop) - (local.set $t - (local.get $x) - ) - (nop) - (nop) - (local.set $x - (local.get $y) - ) - (nop) - (nop) - (local.set $y - (local.get $t) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) - ) - (nop) + (nop) + (local.set $t + (local.get $x) + ) + (nop) + (local.set $x + (local.get $y) ) (nop) + (local.set $y + (local.get $t) + ) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3887,46 +3629,34 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (loop $loopy - (block - (local.set $x - (i32.const 4) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) - ) - (nop) - (local.set $y - (i32.const 5) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) - ) - (nop) - (local.set $z - (i32.const 6) - ) - (nop) + (local.set $x + (i32.const 4) ) (nop) + (br_if $loopy + (local.get $t) + ) + (local.set $y + (i32.const 5) + ) + (nop) + (br_if $loopy + (local.get $t) + ) + (local.set $z + (i32.const 6) + ) ) (nop) (nop) (nop) - (nop) (local.set $9 (select (local.get $x) @@ -3964,61 +3694,49 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 4) - ) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) - ) - (nop) - (nop) - (nop) - (local.set $y - (i32.add - (local.get $y) - (i32.const 5) - ) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 4) ) - (nop) - (nop) - (nop) - (local.set $z - (i32.add - (local.get $z) - (i32.const 6) - ) + ) + (nop) + (br_if $loopy + (local.get $t) + ) + (nop) + (nop) + (local.set $y + (i32.add + (local.get $y) + (i32.const 5) ) - (nop) ) (nop) + (br_if $loopy + (local.get $t) + ) + (nop) + (nop) + (local.set $z + (i32.add + (local.get $z) + (i32.const 6) + ) + ) ) (nop) (nop) (nop) - (nop) (local.set $15 (select (local.get $x) @@ -4056,15 +3774,12 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (loop $loopy (block $out (nop) @@ -4076,13 +3791,11 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $y (i32.add (local.get $y) @@ -4090,29 +3803,24 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $z (i32.add (local.get $z) (i32.const 6) ) ) - (nop) (br $loopy) (unreachable) ) - (nop) ) (nop) (nop) (nop) - (nop) (local.set $15 (select (local.get $x) @@ -4150,15 +3858,12 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (block $out (loop $loopy (block @@ -4171,13 +3876,11 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $y (i32.add (local.get $y) @@ -4185,20 +3888,17 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $z (i32.add (local.get $z) (i32.const 6) ) ) - (nop) (br $loopy) (unreachable) ) @@ -4209,7 +3909,6 @@ infer %4 (nop) (nop) (nop) - (nop) (local.set $15 (select (local.get $x) @@ -4236,59 +3935,46 @@ infer %4 (local $9 f64) (local $10 f64) (local $11 f64) - (block - (nop) - (if - (local.get $var$2) - (block - (loop $label$2 + (nop) + (if + (local.get $var$2) + (block + (loop $label$2 + (block (block - (block - (block $label$3 - (if - (i32.const 0) - (block - (unreachable) - (unreachable) - ) - ) - (nop) - (nop) - (nop) - ) - (local.set $6 - (i32.const 0) - ) + (block $label$3 (if - (local.get $6) - (block - (unreachable) - (unreachable) - ) + (i32.const 0) + (unreachable) ) + (nop) + (nop) ) - (nop) - (nop) - (br_if $label$2 - (local.get $var$2) + (local.set $6 + (i32.const 0) + ) + (if + (local.get $6) + (unreachable) ) - (nop) - (nop) ) (nop) - (local.set $10 - (f64.const 0) + (br_if $label$2 + (local.get $var$2) ) + (nop) ) (nop) - (drop - (local.get $10) + (local.set $10 + (f64.const 0) ) - (nop) + ) + (nop) + (drop + (local.get $10) ) ) ) - (nop) ) (func $loop-unreachable (; 50 ;) (local $var$0 i32) @@ -4312,18 +3998,13 @@ infer %4 (block $label$4 (if (i32.const 1337) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) (nop) (nop) - (nop) ) (nop) (nop) - (nop) (loop $label$6 (block $label$7 (nop) @@ -4338,7 +4019,6 @@ infer %4 (local.get $6) ) (nop) - (nop) (local.set $6 (local.get $var$0) ) @@ -4349,25 +4029,19 @@ infer %4 (drop (local.get $6) ) - (nop) - (unreachable) (unreachable) ) (nop) (br_if $label$6 (local.get $6) ) - (nop) ) - (nop) ) (nop) (nop) - (nop) ) (nop) (nop) - (nop) (br $label$1) (unreachable) ) @@ -4406,10 +4080,7 @@ infer %4 (nop) (if (local.get $var$0) - (block - (unreachable) - (unreachable) - ) + (unreachable) (block (block $block (block @@ -4440,7 +4111,6 @@ infer %4 ) ) (nop) - (nop) ) (nop) (local.set $14 @@ -4451,8 +4121,6 @@ infer %4 ) (nop) (nop) - (nop) - (unreachable) (unreachable) ) (nop) @@ -4482,7 +4150,6 @@ infer %4 (nop) (nop) (nop) - (nop) ) (local.set $8 (i32.add @@ -4516,7 +4183,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $temp) @@ -4527,7 +4193,6 @@ infer %4 (nop) (nop) (nop) - (nop) ) (local.set $10 (i32.sub @@ -4596,78 +4261,62 @@ infer %4 (local $11 i32) (local $12 i32) (local $13 i32) - (block - (nop) - (nop) - (local.set $var$0 - (i32.add - (local.get $var$0) - (i32.const -7) - ) - ) - (nop) - (if + (nop) + (nop) + (local.set $var$0 + (i32.add (local.get $var$0) + (i32.const -7) + ) + ) + (nop) + (if + (local.get $var$0) + (block $label$2 + (block $label$3 + (nop) + (local.set $var$1 + (local.get $var$0) + ) + (nop) + (local.set $8 + (i32.const 12) + ) + (br_if $label$3 + (local.get $8) + ) + (unreachable) + ) + (nop) + (local.set $10 + (i32.eqz + (local.get $var$1) + ) + ) + (br_if $label$2 + (local.get $10) + ) (block - (block $label$2 - (block $label$3 - (nop) - (local.set $var$1 - (local.get $var$0) - ) - (nop) - (nop) - (local.set $8 - (i32.const 12) - ) - (br_if $label$3 - (local.get $8) - ) - (nop) - (unreachable) - (unreachable) - ) - (nop) - (nop) - (local.set $10 - (i32.eqz - (local.get $var$1) - ) - ) - (br_if $label$2 - (local.get $10) + (local.set $11 + (i32.load + (i32.const 0) ) - (nop) - (block - (local.set $11 - (i32.load - (i32.const 0) - ) - ) - (nop) - (local.set $13 - (i32.ne - (local.get $11) - (local.get $var$0) - ) - ) - (if - (local.get $13) - (block - (unreachable) - (unreachable) - ) - ) + ) + (nop) + (local.set $13 + (i32.ne + (local.get $11) + (local.get $var$0) ) - (nop) - (unreachable) + ) + (if + (local.get $13) (unreachable) ) - (nop) ) + (unreachable) ) ) - (nop) ) (func $multiple-uses-to-non-expression (; 56 ;) (param $x i32) (local $temp i32) @@ -4676,36 +4325,30 @@ infer %4 (local $4 i32) (local $5 i32) (local $6 i32) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 10) - ) - ) - (nop) - (nop) - (i32.store - (i32.const 1) + (nop) + (nop) + (local.set $x + (i32.add (local.get $x) + (i32.const 10) ) - (nop) - (nop) - (local.set $6 - (i32.add - (local.get $x) - (i32.const 20) - ) - ) - (i32.store - (i32.const 2) - (local.get $6) - ) - (nop) ) (nop) + (i32.store + (i32.const 1) + (local.get $x) + ) + (nop) + (local.set $6 + (i32.add + (local.get $x) + (i32.const 20) + ) + ) + (i32.store + (i32.const 2) + (local.get $6) + ) ) (func $nested-phi-forwarding (; 57 ;) (param $var$0 i32) (result i32) (local $var$1 i32) @@ -4721,51 +4364,38 @@ infer %4 (block $label$1 (block $label$2 (loop $label$3 - (block - (block $label$4 - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (nop) - (br_table $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$8 $label$2 $label$2 $label$2 $label$6 $label$2 $label$2 $label$7 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$5 $label$4 - (local.get $var$0) - ) - (unreachable) - ) + (block $label$4 + (block $label$5 + (block $label$6 + (block $label$7 + (block $label$8 (nop) - (local.set $var$1 - (i32.const 1) + (br_table $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$8 $label$2 $label$2 $label$2 $label$6 $label$2 $label$2 $label$7 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$5 $label$4 + (local.get $var$0) ) - (nop) + (unreachable) + ) + (local.set $var$1 + (i32.const 1) ) - (nop) - (br $label$4) - (unreachable) ) - (nop) - (unreachable) + (br $label$4) (unreachable) ) - (nop) - (br $label$1) (unreachable) ) - (nop) - (local.set $var$2 - (i32.const 1) - ) - (nop) - (br_if $label$3 - (local.get $var$2) - ) - (nop) + (br $label$1) + (unreachable) + ) + (local.set $var$2 + (i32.const 1) ) (nop) + (br_if $label$3 + (local.get $var$2) + ) ) - (nop) ) - (nop) (block $label$9 (nop) (local.set $6 @@ -4777,20 +4407,15 @@ infer %4 (br_if $label$9 (local.get $6) ) - (nop) ) - (nop) - (unreachable) (unreachable) ) (nop) - (nop) (i32.store offset=176 (i32.const 0) (local.get $var$2) ) (nop) - (nop) ) (local.set $9 (i32.const 0) @@ -4807,51 +4432,44 @@ infer %4 (local $6 i32) (local $7 i32) (local $8 i32) - (block - (block $label$1 - (local.set $2 - (i32.load - (i32.const -8) - ) - ) - (local.set $3 - (i32.const 1) - ) - (br_if $label$1 - (local.get $2) - ) - (nop) - (drop - (local.get $3) - ) - (nop) - (local.set $5 - (i32.load - (i32.const -16) - ) - ) - (nop) - (local.set $3 - (i32.eqz - (local.get $5) - ) + (block $label$1 + (local.set $2 + (i32.load + (i32.const -8) ) ) + (local.set $3 + (i32.const 1) + ) + (br_if $label$1 + (local.get $2) + ) (nop) - (local.set $8 - (i32.ctz - (local.get $3) + (drop + (local.get $3) + ) + (local.set $5 + (i32.load + (i32.const -16) ) ) - (if - (local.get $8) - (block - (unreachable) - (unreachable) + (nop) + (local.set $3 + (i32.eqz + (local.get $5) ) ) ) (nop) + (local.set $8 + (i32.ctz + (local.get $3) + ) + ) + (if + (local.get $8) + (unreachable) + ) ) (func $zext-numGets-hasAnotherUse (; 59 ;) (param $var$0 i32) (param $var$1 i32) (local $temp i32) @@ -4864,61 +4482,52 @@ infer %4 (local $9 i32) (local $10 i32) (local $11 i32) - (block - (block $label$1 - (local.set $3 - (i32.load - (i32.const -8) - ) - ) - (local.set $4 - (i32.const 1) - ) - (br_if $label$1 - (local.get $3) - ) - (nop) - (drop - (local.get $4) - ) - (nop) - (local.set $6 - (i32.load - (i32.const -16) - ) - ) - (nop) - (local.set $temp - (i32.eqz - (local.get $6) - ) - ) - (nop) - (nop) - (drop - (local.get $temp) - ) - (nop) - (nop) - (local.set $4 - (local.get $temp) + (block $label$1 + (local.set $3 + (i32.load + (i32.const -8) ) ) + (local.set $4 + (i32.const 1) + ) + (br_if $label$1 + (local.get $3) + ) (nop) - (local.set $11 - (i32.ctz - (local.get $4) + (drop + (local.get $4) + ) + (local.set $6 + (i32.load + (i32.const -16) ) ) - (if - (local.get $11) - (block - (unreachable) - (unreachable) + (nop) + (local.set $temp + (i32.eqz + (local.get $6) ) ) + (nop) + (drop + (local.get $temp) + ) + (nop) + (local.set $4 + (local.get $temp) + ) ) (nop) + (local.set $11 + (i32.ctz + (local.get $4) + ) + ) + (if + (local.get $11) + (unreachable) + ) ) (func $flipped-needs-right-origin (; 60 ;) (param $var$0 i32) (result i32) (local $var$1 i32) @@ -4938,13 +4547,10 @@ infer %4 (br_if $label$1 (local.get $2) ) - (nop) (local.set $var$1 (i32.const 2) ) - (nop) ) - (nop) (block (nop) (local.set $4 @@ -4961,14 +4567,10 @@ infer %4 ) (if (local.get $5) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) ) (nop) - (nop) ) (local.set $7 (i32.const 5) @@ -5000,7 +4602,6 @@ infer %4 (i32.const 2) ) (nop) - (nop) (local.set $7 (i32.sub (i32.const 4) @@ -5011,8 +4612,6 @@ infer %4 (i32.const 3) (local.get $7) ) - (nop) - (unreachable) (unreachable) ) (nop) @@ -5037,7 +4636,6 @@ infer %4 (i32.const 1) ) ) - (nop) (br $label$1) (unreachable) ) @@ -5048,9 +4646,6 @@ infer %4 (nop) (nop) (nop) - (nop) - (nop) - (nop) (br $label$1) (unreachable) ) @@ -5077,57 +4672,42 @@ infer %4 (local.set $var$1 (i32.const 1) ) - (nop) (if (i32.const 0) - (block - (loop $label$2 - (block - (block - (nop) - (if - (local.get $var$1) - (nop) - ) - ) - (nop) - (local.set $var$3 - (i32.const 1) - ) - (nop) - (nop) - (local.set $var$1 - (i32.sub - (i32.const 0) - (local.get $var$3) - ) - ) - (nop) - (br_if $label$2 - (i32.const 0) - ) + (loop $label$2 + (block + (nop) + (if + (local.get $var$1) (nop) ) - (nop) + ) + (local.set $var$3 + (i32.const 1) ) (nop) + (nop) + (local.set $var$1 + (i32.sub + (i32.const 0) + (local.get $var$3) + ) + ) + (br_if $label$2 + (i32.const 0) + ) ) ) - (nop) (block (nop) (if (local.get $var$1) - (block - (local.set $var$3 - (i32.const 1) - ) - (nop) + (local.set $var$3 + (i32.const 1) ) ) ) (nop) - (nop) (local.set $14 (i32.add (local.get $var$3) @@ -5138,13 +4718,10 @@ infer %4 (i32.const 8) (local.get $14) ) - (nop) (i32.store (i32.const 8) (i32.const 64) ) - (nop) - (unreachable) (unreachable) ) (nop) diff --git a/test/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.txt b/test/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.txt index 488ba5c4b..28fe56cd1 100644 --- a/test/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.txt +++ b/test/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.txt @@ -1513,8 +1513,6 @@ infer %4 (nop) (nop) (nop) - (nop) - (nop) (local.set $12 (i64.eq (local.get $a) @@ -1529,7 +1527,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $15 (i32.and (local.get $12) @@ -1584,8 +1581,6 @@ infer %4 (nop) (nop) (nop) - (nop) - (nop) (local.set $15 (i64.eq (local.get $a) @@ -1600,7 +1595,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $18 (i32.and (local.get $15) @@ -1614,10 +1608,7 @@ infer %4 ) (unreachable) ) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) ) (unreachable) @@ -1653,7 +1644,6 @@ infer %4 (i32.const 1) ) ) - (nop) ) (block (nop) @@ -1664,12 +1654,10 @@ infer %4 (i32.const 2) ) ) - (nop) ) ) ) (nop) - (nop) (local.set $8 (i32.and (local.get $x) @@ -1718,195 +1706,168 @@ infer %4 (local $25 i64) (local $26 i64) (local $27 i32) - (block - (nop) - (nop) - (nop) - (local.set $x - (i32.ge_s - (local.get $x) - (local.get $y) - ) - ) - (nop) - (nop) - (nop) - (nop) - (local.set $x - (i32.ge_u - (local.get $x) - (local.get $y) - ) - ) - (nop) - (nop) - (nop) - (nop) - (local.set $x - (i32.gt_s - (local.get $x) - (local.get $y) - ) - ) - (nop) - (nop) - (nop) - (nop) - (local.set $x - (i32.gt_u - (local.get $x) - (local.get $y) - ) - ) - (nop) - (nop) - (nop) - (local.set $18 - (i64.ge_s - (local.get $z) - (local.get $w) - ) - ) - (call $send-i32 - (local.get $18) + (nop) + (nop) + (nop) + (local.set $x + (i32.ge_s + (local.get $x) + (local.get $y) ) - (nop) - (nop) - (nop) - (local.set $21 - (i64.ge_u - (local.get $z) - (local.get $w) - ) + ) + (nop) + (nop) + (nop) + (local.set $x + (i32.ge_u + (local.get $x) + (local.get $y) ) - (call $send-i32 - (local.get $21) + ) + (nop) + (nop) + (nop) + (local.set $x + (i32.gt_s + (local.get $x) + (local.get $y) ) - (nop) - (nop) - (nop) - (local.set $24 - (i64.gt_s - (local.get $z) - (local.get $w) - ) + ) + (nop) + (nop) + (nop) + (local.set $x + (i32.gt_u + (local.get $x) + (local.get $y) ) - (call $send-i32 - (local.get $24) + ) + (nop) + (nop) + (local.set $18 + (i64.ge_s + (local.get $z) + (local.get $w) ) - (nop) - (nop) - (nop) - (local.set $27 - (i64.gt_u - (local.get $z) - (local.get $w) - ) + ) + (call $send-i32 + (local.get $18) + ) + (nop) + (nop) + (local.set $21 + (i64.ge_u + (local.get $z) + (local.get $w) ) - (call $send-i32 - (local.get $27) + ) + (call $send-i32 + (local.get $21) + ) + (nop) + (nop) + (local.set $24 + (i64.gt_s + (local.get $z) + (local.get $w) ) - (nop) + ) + (call $send-i32 + (local.get $24) ) (nop) + (nop) + (local.set $27 + (i64.gt_u + (local.get $z) + (local.get $w) + ) + ) + (call $send-i32 + (local.get $27) + ) ) (func $various-conditions-1 (; 5 ;) (param $x i32) (local $1 i32) (local $2 i32) (local $3 i32) - (block - (nop) - (if - (local.get $x) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 1) - ) + (nop) + (if + (local.get $x) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 1) ) - (nop) ) ) ) - (nop) ) (func $various-conditions-2 (; 6 ;) (param $x i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) - (block - (nop) - (local.set $2 - (i32.lt_s - (local.get $x) - (i32.const 0) - ) + (nop) + (local.set $2 + (i32.lt_s + (local.get $x) + (i32.const 0) ) - (if - (local.get $2) - (block - (nop) - (nop) - (local.set $x - (i32.sub - (local.get $x) - (i32.const 2) - ) + ) + (if + (local.get $2) + (block + (nop) + (nop) + (local.set $x + (i32.sub + (local.get $x) + (i32.const 2) ) - (nop) ) ) ) - (nop) ) (func $various-conditions-3 (; 7 ;) (param $x i32) (local $1 i32) (local $2 i32) (local $3 i32) - (block - (local.set $1 - (i32.reinterpret_f32 - (f32.const 0) - ) + (local.set $1 + (i32.reinterpret_f32 + (f32.const 0) ) - (if - (local.get $1) - (block - (nop) - (nop) - (local.set $x - (i32.sub - (local.get $x) - (i32.const 4) - ) + ) + (if + (local.get $1) + (block + (nop) + (nop) + (local.set $x + (i32.sub + (local.get $x) + (i32.const 4) ) - (nop) ) ) ) - (nop) ) (func $various-conditions-4 (; 8 ;) (param $x i32) (local $1 i32) (local $2 i32) - (block + (if (unreachable) - (if - (unreachable) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) ) ) @@ -1923,52 +1884,48 @@ infer %4 (local $9 i32) (local $10 i32) (local $11 i32) - (block - (nop) - (local.set $3 - (i32.eqz - (local.get $x) - ) + (nop) + (local.set $3 + (i32.eqz + (local.get $x) ) - (if - (local.get $3) - (block - (nop) - (local.set $5 - (i32.ctz - (local.get $y) - ) + ) + (if + (local.get $3) + (block + (nop) + (local.set $5 + (i32.ctz + (local.get $y) ) - (nop) - (local.set $7 - (i32.clz - (local.get $x) - ) + ) + (nop) + (local.set $7 + (i32.clz + (local.get $x) ) - (nop) - (local.set $9 - (i32.popcnt - (local.get $y) - ) + ) + (nop) + (local.set $9 + (i32.popcnt + (local.get $y) ) - (local.set $10 - (i32.sub - (local.get $7) - (local.get $9) - ) + ) + (local.set $10 + (i32.sub + (local.get $7) + (local.get $9) ) - (nop) - (local.set $x - (i32.add - (local.get $5) - (local.get $10) - ) + ) + (nop) + (local.set $x + (i32.add + (local.get $5) + (local.get $10) ) - (nop) ) ) ) - (nop) ) (func $unary-condition (; 10 ;) (param $x i32) (local $1 i32) @@ -1976,35 +1933,31 @@ infer %4 (local $3 i32) (local $4 i32) (local $5 i32) - (block - (nop) - (local.set $2 - (i32.gt_u - (local.get $x) - (i32.const 1) - ) + (nop) + (local.set $2 + (i32.gt_u + (local.get $x) + (i32.const 1) ) - (local.set $3 - (i32.ctz - (local.get $2) - ) + ) + (local.set $3 + (i32.ctz + (local.get $2) ) - (if - (local.get $3) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 2) - ) + ) + (if + (local.get $3) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 2) ) - (nop) ) ) ) - (nop) ) (func $unary-condition-2 (; 11 ;) (param $x i32) (local $1 i32) @@ -2012,35 +1965,31 @@ infer %4 (local $3 i32) (local $4 i32) (local $5 i32) - (block - (nop) - (local.set $2 - (i32.gt_u - (local.get $x) - (i32.const 1) - ) + (nop) + (local.set $2 + (i32.gt_u + (local.get $x) + (i32.const 1) ) - (local.set $3 - (i32.eqz - (local.get $2) - ) + ) + (local.set $3 + (i32.eqz + (local.get $2) ) - (if - (local.get $3) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 2) - ) + ) + (if + (local.get $3) + (block + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 2) ) - (nop) ) ) ) - (nop) ) (func $if-else-cond (; 12 ;) (param $x i32) (result i32) (local $1 i32) @@ -2073,7 +2022,6 @@ infer %4 (i32.const 1) ) ) - (nop) ) (block (nop) @@ -2084,12 +2032,10 @@ infer %4 (i32.const 2) ) ) - (nop) ) ) ) (nop) - (nop) (local.set $8 (i32.and (local.get $x) @@ -2200,23 +2146,16 @@ infer %4 (nop) (if (local.get $2) - (block - (local.set $x - (i32.const 1) - ) - (nop) + (local.set $x + (i32.const 1) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) (nop) - (nop) ) (nop) (return @@ -2301,25 +2240,21 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $y) ) (nop) (nop) - (nop) (local.set $x (i32.add (local.get $x) (i32.const 2) ) ) - (nop) ) (nop) (nop) (nop) - (nop) ) (local.set $10 (i32.add @@ -2343,20 +2278,16 @@ infer %4 (i32.const 1) ) (nop) - (nop) (br_if $out (local.get $y) ) - (nop) (local.set $x (i32.const 2) ) - (nop) ) (nop) (nop) (nop) - (nop) ) (local.set $6 (i32.add @@ -2376,16 +2307,12 @@ infer %4 (block (if (i32.const 0) - (block - (local.set $x - (f64.const 1) - ) - (nop) + (local.set $x + (f64.const 1) ) ) (nop) (nop) - (nop) ) (nop) (return @@ -2451,7 +2378,6 @@ infer %4 (local.get $y) ) ) - (nop) ) (block (nop) @@ -2463,13 +2389,11 @@ infer %4 (local.get $y) ) ) - (nop) ) ) ) (nop) (nop) - (nop) ) (nop) (return @@ -2532,7 +2456,6 @@ infer %4 (i32.const 1) ) (nop) - (nop) (return (local.get $x) ) @@ -2540,16 +2463,12 @@ infer %4 ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) @@ -2575,22 +2494,16 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) - (unreachable) (unreachable) ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) @@ -2618,29 +2531,23 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (br $out) (unreachable) ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) (unreachable) ) (nop) - (nop) (return (local.get $x) ) @@ -2668,7 +2575,6 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (br_table $out $out $out (i32.const 1) ) @@ -2676,23 +2582,18 @@ infer %4 ) (unreachable) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) (unreachable) ) (nop) - (nop) (return (local.get $x) ) @@ -2716,37 +2617,27 @@ infer %4 (nop) (if (local.get $x) - (block - (block $block - (local.set $x - (i32.const 1) - ) - (nop) - (nop) - (br_if $out - (local.get $x) - ) - (nop) - ) - (nop) - ) - (block + (block $block (local.set $x - (i32.const 2) + (i32.const 1) ) (nop) + (br_if $out + (local.get $x) + ) + ) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) (unreachable) ) (nop) - (nop) (return (local.get $x) ) @@ -2762,109 +2653,88 @@ infer %4 (local $5 i32) (local $6 i32) (local $7 i32) - (block - (block $label$1 - (block $label$2 - (block $label$3 - (block - (nop) - (if - (local.get $2) + (block $label$1 + (block $label$2 + (block $label$3 + (block + (nop) + (if + (local.get $2) + (block (block - (block - (nop) - (if - (local.get $0) - (block - (block $block - (local.set $1 - (i32.const -8531) - ) - (nop) - (br $label$3) - (unreachable) + (nop) + (if + (local.get $0) + (block + (block $block + (local.set $1 + (i32.const -8531) ) + (br $label$3) (unreachable) ) - (block - (block $block3 - (local.set $1 - (i32.const -8531) - ) - (nop) - (br $label$1) - (unreachable) + (unreachable) + ) + (block + (block $block3 + (local.set $1 + (i32.const -8531) ) + (br $label$1) (unreachable) ) + (unreachable) ) ) - (unreachable) ) + (unreachable) ) ) - (nop) - (br $label$2) - (unreachable) - ) - (nop) - (local.set $6 - (i32.load - (i32.const 0) - ) ) - (drop - (local.get $6) - ) - (nop) - (br $label$1) + (br $label$2) (unreachable) ) - (nop) - (nop) - (i32.store16 - (i32.const 1) - (local.get $1) + (local.set $6 + (i32.load + (i32.const 0) + ) ) - (nop) - (unreachable) + (drop + (local.get $6) + ) + (br $label$1) (unreachable) ) (nop) (i32.store16 - (i32.const 0) - (i32.const -8531) + (i32.const 1) + (local.get $1) ) - (nop) + (unreachable) + ) + (i32.store16 + (i32.const 0) + (i32.const -8531) ) - (nop) ) (func $in-unreachable-operations (; 32 ;) (param $x i32) (param $y i32) (result i32) (local $2 i32) (local $3 i32) (block $block (unreachable) - (unreachable) (block (nop) (if (local.get $x) - (block - (local.set $x - (i32.const 1) - ) - (nop) + (local.set $x + (i32.const 1) ) - (block - (local.set $x - (i32.const 2) - ) - (nop) + (local.set $x + (i32.const 2) ) ) ) (nop) - (nop) (return (local.get $x) ) @@ -2895,15 +2765,11 @@ infer %4 ) (unreachable) ) - (nop) - (unreachable) (unreachable) ) - (nop) (br $label$1) (unreachable) ) - (nop) (local.set $var$0 (i32.const 8) ) @@ -2917,22 +2783,17 @@ infer %4 (local.get $3) (f64.const 0) ) - (nop) (br $label$1) (unreachable) ) - (nop) - (unreachable) (unreachable) ) (nop) - (nop) (i32.store (local.get $var$0) (i32.const 16) ) (nop) - (nop) ) (local.set $6 (i32.const 1) @@ -3008,7 +2869,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3017,7 +2877,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3026,7 +2885,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3035,7 +2893,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3044,7 +2901,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3053,7 +2909,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3062,7 +2917,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3071,7 +2925,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3080,7 +2933,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3089,7 +2941,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3098,7 +2949,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3107,7 +2957,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3116,7 +2965,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3125,7 +2973,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3134,7 +2981,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3143,7 +2989,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3152,7 +2997,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3161,7 +3005,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3170,7 +3013,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3179,7 +3021,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3188,7 +3029,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3197,7 +3037,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3206,7 +3045,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3215,7 +3053,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.xor (local.get $x) @@ -3224,7 +3061,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $x) @@ -3233,7 +3069,6 @@ infer %4 ) (nop) (nop) - (nop) ) (nop) (return @@ -3276,85 +3111,74 @@ infer %4 (if (local.get $5) (block - (block - (nop) - (local.set $7 - (i64.eqz - (local.get $x) - ) + (nop) + (local.set $7 + (i64.eqz + (local.get $x) ) - (if - (local.get $7) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.add - (local.get $x) - (local.get $y) - ) + ) + (if + (local.get $7) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.add + (local.get $x) + (local.get $y) ) - (nop) ) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.sub - (local.get $x) - (local.get $y) - ) + ) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.sub + (local.get $x) + (local.get $y) ) - (nop) ) ) ) - (nop) ) (block - (block - (nop) - (local.set $15 - (i64.eqz - (local.get $y) - ) + (nop) + (local.set $15 + (i64.eqz + (local.get $y) ) - (if - (local.get $15) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.mul - (local.get $x) - (local.get $y) - ) + ) + (if + (local.get $15) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.mul + (local.get $x) + (local.get $y) ) - (nop) ) - (block - (nop) - (nop) - (nop) - (local.set $t - (i64.div_s - (local.get $x) - (local.get $y) - ) + ) + (block + (nop) + (nop) + (nop) + (local.set $t + (i64.div_s + (local.get $x) + (local.get $y) ) - (nop) ) ) ) - (nop) ) ) ) (nop) - (nop) (return (local.get $t) ) @@ -3375,17 +3199,14 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy (nop) ) (nop) (nop) - (nop) (local.set $4 (i32.add (local.get $x) @@ -3416,37 +3237,29 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (nop) - (local.set $y - (i32.add - (local.get $y) - (i32.const 4) - ) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) (nop) + (nop) + (local.set $y + (i32.add + (local.get $y) + (i32.const 4) + ) + ) ) (nop) (nop) - (nop) (local.set $8 (i32.add (local.get $x) @@ -3478,42 +3291,33 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (nop) - (local.set $y - (i32.add - (local.get $y) - (i32.const 4) - ) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) - (nop) - (br_if $loopy + ) + (nop) + (nop) + (local.set $y + (i32.add (local.get $y) + (i32.const 4) ) - (nop) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3543,33 +3347,25 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $7 (i32.add (local.get $x) @@ -3599,37 +3395,28 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (local.set $y - (i32.const 2) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) + ) + (local.set $y + (i32.const 2) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $7 (i32.add (local.get $x) @@ -3660,36 +3447,27 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (nop) - (nop) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) ) (nop) + (nop) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $8 (i32.add (local.get $x) @@ -3719,37 +3497,28 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 3) - ) - ) - (nop) - (local.set $y - (i32.const 5) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 3) ) - (nop) + ) + (local.set $y + (i32.const 5) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $7 (i32.add (local.get $x) @@ -3785,42 +3554,31 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (local.set $z - (local.get $x) - ) - (nop) - (nop) - (local.set $w - (local.get $y) - ) - (nop) - (local.set $x - (i32.const 1) - ) - (nop) - (local.set $y - (i32.const 4) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) - ) - (nop) + (nop) + (local.set $z + (local.get $x) ) (nop) + (local.set $w + (local.get $y) + ) + (local.set $x + (i32.const 1) + ) + (local.set $y + (i32.const 4) + ) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3866,39 +3624,29 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (loop $loopy - (block - (nop) - (local.set $t - (local.get $x) - ) - (nop) - (nop) - (local.set $x - (local.get $y) - ) - (nop) - (nop) - (local.set $y - (local.get $t) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) - ) - (nop) + (nop) + (local.set $t + (local.get $x) ) (nop) + (local.set $x + (local.get $y) + ) + (nop) + (local.set $y + (local.get $t) + ) + (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3930,39 +3678,29 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 1) ) - (nop) (loop $loopy - (block - (nop) - (local.set $t - (local.get $x) - ) - (nop) - (nop) - (local.set $x - (local.get $y) - ) - (nop) - (nop) - (local.set $y - (local.get $t) - ) - (nop) - (nop) - (br_if $loopy - (local.get $y) - ) - (nop) + (nop) + (local.set $t + (local.get $x) + ) + (nop) + (local.set $x + (local.get $y) + ) + (nop) + (local.set $y + (local.get $t) ) (nop) + (br_if $loopy + (local.get $y) + ) ) (nop) (nop) - (nop) (local.set $9 (i32.add (local.get $x) @@ -3993,46 +3731,34 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (loop $loopy - (block - (local.set $x - (i32.const 4) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) - ) - (nop) - (local.set $y - (i32.const 5) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) - ) - (nop) - (local.set $z - (i32.const 6) - ) - (nop) + (local.set $x + (i32.const 4) + ) + (nop) + (br_if $loopy + (local.get $t) + ) + (local.set $y + (i32.const 5) ) (nop) + (br_if $loopy + (local.get $t) + ) + (local.set $z + (i32.const 6) + ) ) (nop) (nop) (nop) - (nop) (local.set $9 (select (local.get $x) @@ -4070,61 +3796,49 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (loop $loopy - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 4) - ) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) - ) - (nop) - (nop) - (nop) - (local.set $y - (i32.add - (local.get $y) - (i32.const 5) - ) - ) - (nop) - (nop) - (br_if $loopy - (local.get $t) + (nop) + (nop) + (local.set $x + (i32.add + (local.get $x) + (i32.const 4) ) - (nop) - (nop) - (nop) - (local.set $z - (i32.add - (local.get $z) - (i32.const 6) - ) + ) + (nop) + (br_if $loopy + (local.get $t) + ) + (nop) + (nop) + (local.set $y + (i32.add + (local.get $y) + (i32.const 5) ) - (nop) ) (nop) + (br_if $loopy + (local.get $t) + ) + (nop) + (nop) + (local.set $z + (i32.add + (local.get $z) + (i32.const 6) + ) + ) ) (nop) (nop) (nop) - (nop) (local.set $15 (select (local.get $x) @@ -4162,15 +3876,12 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (loop $loopy (block $out (nop) @@ -4182,13 +3893,11 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $y (i32.add (local.get $y) @@ -4196,29 +3905,24 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $z (i32.add (local.get $z) (i32.const 6) ) ) - (nop) (br $loopy) (unreachable) ) - (nop) ) (nop) (nop) (nop) - (nop) (local.set $15 (select (local.get $x) @@ -4256,15 +3960,12 @@ infer %4 (local.set $x (i32.const 1) ) - (nop) (local.set $y (i32.const 2) ) - (nop) (local.set $z (i32.const 3) ) - (nop) (block $out (loop $loopy (block @@ -4277,13 +3978,11 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $y (i32.add (local.get $y) @@ -4291,20 +3990,17 @@ infer %4 ) ) (nop) - (nop) (br_if $out (local.get $t) ) (nop) (nop) - (nop) (local.set $z (i32.add (local.get $z) (i32.const 6) ) ) - (nop) (br $loopy) (unreachable) ) @@ -4315,7 +4011,6 @@ infer %4 (nop) (nop) (nop) - (nop) (local.set $15 (select (local.get $x) @@ -4342,59 +4037,46 @@ infer %4 (local $9 f64) (local $10 f64) (local $11 f64) - (block - (nop) - (if - (local.get $var$2) - (block - (loop $label$2 + (nop) + (if + (local.get $var$2) + (block + (loop $label$2 + (block (block - (block - (block $label$3 - (if - (i32.const 0) - (block - (unreachable) - (unreachable) - ) - ) - (nop) - (nop) - (nop) - ) - (local.set $6 - (i32.const 0) - ) + (block $label$3 (if - (local.get $6) - (block - (unreachable) - (unreachable) - ) + (i32.const 0) + (unreachable) ) + (nop) + (nop) ) - (nop) - (nop) - (br_if $label$2 - (local.get $var$2) + (local.set $6 + (i32.const 0) + ) + (if + (local.get $6) + (unreachable) ) - (nop) - (nop) ) (nop) - (local.set $10 - (f64.const 0) + (br_if $label$2 + (local.get $var$2) ) + (nop) ) (nop) - (drop - (local.get $10) + (local.set $10 + (f64.const 0) ) - (nop) + ) + (nop) + (drop + (local.get $10) ) ) ) - (nop) ) (func $loop-unreachable (; 51 ;) (local $var$0 i32) @@ -4418,18 +4100,13 @@ infer %4 (block $label$4 (if (i32.const 1337) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) (nop) (nop) - (nop) ) (nop) (nop) - (nop) (loop $label$6 (block $label$7 (nop) @@ -4444,7 +4121,6 @@ infer %4 (local.get $6) ) (nop) - (nop) (local.set $6 (local.get $var$0) ) @@ -4455,25 +4131,19 @@ infer %4 (drop (local.get $6) ) - (nop) - (unreachable) (unreachable) ) (nop) (br_if $label$6 (local.get $6) ) - (nop) ) - (nop) ) (nop) (nop) - (nop) ) (nop) (nop) - (nop) (br $label$1) (unreachable) ) @@ -4512,10 +4182,7 @@ infer %4 (nop) (if (local.get $var$0) - (block - (unreachable) - (unreachable) - ) + (unreachable) (block (block $block (block @@ -4546,7 +4213,6 @@ infer %4 ) ) (nop) - (nop) ) (nop) (local.set $14 @@ -4557,8 +4223,6 @@ infer %4 ) (nop) (nop) - (nop) - (unreachable) (unreachable) ) (nop) @@ -4588,7 +4252,6 @@ infer %4 (nop) (nop) (nop) - (nop) ) (local.set $8 (i32.add @@ -4622,7 +4285,6 @@ infer %4 ) (nop) (nop) - (nop) (local.set $x (i32.mul (local.get $temp) @@ -4633,7 +4295,6 @@ infer %4 (nop) (nop) (nop) - (nop) ) (local.set $10 (i32.sub @@ -4702,78 +4363,62 @@ infer %4 (local $11 i32) (local $12 i32) (local $13 i32) - (block - (nop) - (nop) - (local.set $var$0 - (i32.add - (local.get $var$0) - (i32.const -7) - ) - ) - (nop) - (if + (nop) + (nop) + (local.set $var$0 + (i32.add (local.get $var$0) + (i32.const -7) + ) + ) + (nop) + (if + (local.get $var$0) + (block $label$2 + (block $label$3 + (nop) + (local.set $var$1 + (local.get $var$0) + ) + (nop) + (local.set $8 + (i32.const 12) + ) + (br_if $label$3 + (local.get $8) + ) + (unreachable) + ) + (nop) + (local.set $10 + (i32.eqz + (local.get $var$1) + ) + ) + (br_if $label$2 + (local.get $10) + ) (block - (block $label$2 - (block $label$3 - (nop) - (local.set $var$1 - (local.get $var$0) - ) - (nop) - (nop) - (local.set $8 - (i32.const 12) - ) - (br_if $label$3 - (local.get $8) - ) - (nop) - (unreachable) - (unreachable) - ) - (nop) - (nop) - (local.set $10 - (i32.eqz - (local.get $var$1) - ) - ) - (br_if $label$2 - (local.get $10) + (local.set $11 + (i32.load + (i32.const 0) ) - (nop) - (block - (local.set $11 - (i32.load - (i32.const 0) - ) - ) - (nop) - (local.set $13 - (i32.ne - (local.get $11) - (local.get $var$0) - ) - ) - (if - (local.get $13) - (block - (unreachable) - (unreachable) - ) - ) + ) + (nop) + (local.set $13 + (i32.ne + (local.get $11) + (local.get $var$0) ) - (nop) - (unreachable) + ) + (if + (local.get $13) (unreachable) ) - (nop) ) + (unreachable) ) ) - (nop) ) (func $multiple-uses-to-non-expression (; 57 ;) (param $x i32) (local $temp i32) @@ -4782,36 +4427,30 @@ infer %4 (local $4 i32) (local $5 i32) (local $6 i32) - (block - (nop) - (nop) - (local.set $x - (i32.add - (local.get $x) - (i32.const 10) - ) - ) - (nop) - (nop) - (i32.store - (i32.const 1) + (nop) + (nop) + (local.set $x + (i32.add (local.get $x) + (i32.const 10) ) - (nop) - (nop) - (local.set $6 - (i32.add - (local.get $x) - (i32.const 20) - ) - ) - (i32.store - (i32.const 2) - (local.get $6) - ) - (nop) ) (nop) + (i32.store + (i32.const 1) + (local.get $x) + ) + (nop) + (local.set $6 + (i32.add + (local.get $x) + (i32.const 20) + ) + ) + (i32.store + (i32.const 2) + (local.get $6) + ) ) (func $nested-phi-forwarding (; 58 ;) (param $var$0 i32) (result i32) (local $var$1 i32) @@ -4827,51 +4466,38 @@ infer %4 (block $label$1 (block $label$2 (loop $label$3 - (block - (block $label$4 - (block $label$5 - (block $label$6 - (block $label$7 - (block $label$8 - (nop) - (br_table $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$8 $label$2 $label$2 $label$2 $label$6 $label$2 $label$2 $label$7 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$5 $label$4 - (local.get $var$0) - ) - (unreachable) - ) + (block $label$4 + (block $label$5 + (block $label$6 + (block $label$7 + (block $label$8 (nop) - (local.set $var$1 - (i32.const 1) + (br_table $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$8 $label$2 $label$2 $label$2 $label$6 $label$2 $label$2 $label$7 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$2 $label$5 $label$4 + (local.get $var$0) ) - (nop) + (unreachable) + ) + (local.set $var$1 + (i32.const 1) ) - (nop) - (br $label$4) - (unreachable) ) - (nop) - (unreachable) + (br $label$4) (unreachable) ) - (nop) - (br $label$1) (unreachable) ) - (nop) - (local.set $var$2 - (i32.const 1) - ) - (nop) - (br_if $label$3 - (local.get $var$2) - ) - (nop) + (br $label$1) + (unreachable) + ) + (local.set $var$2 + (i32.const 1) ) (nop) + (br_if $label$3 + (local.get $var$2) + ) ) - (nop) ) - (nop) (block $label$9 (nop) (local.set $6 @@ -4883,20 +4509,15 @@ infer %4 (br_if $label$9 (local.get $6) ) - (nop) ) - (nop) - (unreachable) (unreachable) ) (nop) - (nop) (i32.store offset=176 (i32.const 0) (local.get $var$2) ) (nop) - (nop) ) (local.set $9 (i32.const 0) @@ -4913,51 +4534,44 @@ infer %4 (local $6 i32) (local $7 i32) (local $8 i32) - (block - (block $label$1 - (local.set $2 - (i32.load - (i32.const -8) - ) - ) - (local.set $3 - (i32.const 1) - ) - (br_if $label$1 - (local.get $2) - ) - (nop) - (drop - (local.get $3) - ) - (nop) - (local.set $5 - (i32.load - (i32.const -16) - ) - ) - (nop) - (local.set $3 - (i32.eqz - (local.get $5) - ) + (block $label$1 + (local.set $2 + (i32.load + (i32.const -8) ) ) + (local.set $3 + (i32.const 1) + ) + (br_if $label$1 + (local.get $2) + ) (nop) - (local.set $8 - (i32.ctz - (local.get $3) + (drop + (local.get $3) + ) + (local.set $5 + (i32.load + (i32.const -16) ) ) - (if - (local.get $8) - (block - (unreachable) - (unreachable) + (nop) + (local.set $3 + (i32.eqz + (local.get $5) ) ) ) (nop) + (local.set $8 + (i32.ctz + (local.get $3) + ) + ) + (if + (local.get $8) + (unreachable) + ) ) (func $zext-numGets-hasAnotherUse (; 60 ;) (param $var$0 i32) (param $var$1 i32) (local $temp i32) @@ -4970,61 +4584,52 @@ infer %4 (local $9 i32) (local $10 i32) (local $11 i32) - (block - (block $label$1 - (local.set $3 - (i32.load - (i32.const -8) - ) - ) - (local.set $4 - (i32.const 1) - ) - (br_if $label$1 - (local.get $3) - ) - (nop) - (drop - (local.get $4) - ) - (nop) - (local.set $6 - (i32.load - (i32.const -16) - ) - ) - (nop) - (local.set $temp - (i32.eqz - (local.get $6) - ) - ) - (nop) - (nop) - (drop - (local.get $temp) - ) - (nop) - (nop) - (local.set $4 - (local.get $temp) + (block $label$1 + (local.set $3 + (i32.load + (i32.const -8) ) ) + (local.set $4 + (i32.const 1) + ) + (br_if $label$1 + (local.get $3) + ) (nop) - (local.set $11 - (i32.ctz - (local.get $4) + (drop + (local.get $4) + ) + (local.set $6 + (i32.load + (i32.const -16) ) ) - (if - (local.get $11) - (block - (unreachable) - (unreachable) + (nop) + (local.set $temp + (i32.eqz + (local.get $6) ) ) + (nop) + (drop + (local.get $temp) + ) + (nop) + (local.set $4 + (local.get $temp) + ) ) (nop) + (local.set $11 + (i32.ctz + (local.get $4) + ) + ) + (if + (local.get $11) + (unreachable) + ) ) (func $flipped-needs-right-origin (; 61 ;) (param $var$0 i32) (result i32) (local $var$1 i32) @@ -5044,13 +4649,10 @@ infer %4 (br_if $label$1 (local.get $2) ) - (nop) (local.set $var$1 (i32.const 2) ) - (nop) ) - (nop) (block (nop) (local.set $4 @@ -5067,14 +4669,10 @@ infer %4 ) (if (local.get $5) - (block - (unreachable) - (unreachable) - ) + (unreachable) ) ) (nop) - (nop) ) (local.set $7 (i32.const 5) @@ -5106,7 +4704,6 @@ infer %4 (i32.const 2) ) (nop) - (nop) (local.set $7 (i32.sub (i32.const 4) @@ -5117,8 +4714,6 @@ infer %4 (i32.const 3) (local.get $7) ) - (nop) - (unreachable) (unreachable) ) (nop) @@ -5143,7 +4738,6 @@ infer %4 (i32.const 1) ) ) - (nop) (br $label$1) (unreachable) ) @@ -5154,9 +4748,6 @@ infer %4 (nop) (nop) (nop) - (nop) - (nop) - (nop) (br $label$1) (unreachable) ) @@ -5183,57 +4774,42 @@ infer %4 (local.set $var$1 (i32.const 1) ) - (nop) (if (i32.const 0) - (block - (loop $label$2 - (block - (block - (nop) - (if - (local.get $var$1) - (nop) - ) - ) - (nop) - (local.set $var$3 - (i32.const 1) - ) - (nop) - (nop) - (local.set $var$1 - (i32.sub - (i32.const 0) - (local.get $var$3) - ) - ) - (nop) - (br_if $label$2 - (i32.const 0) - ) + (loop $label$2 + (block + (nop) + (if + (local.get $var$1) (nop) ) - (nop) ) + (local.set $var$3 + (i32.const 1) + ) + (nop) (nop) + (local.set $var$1 + (i32.sub + (i32.const 0) + (local.get $var$3) + ) + ) + (br_if $label$2 + (i32.const 0) + ) ) ) - (nop) (block (nop) (if (local.get $var$1) - (block - (local.set $var$3 - (i32.const 1) - ) - (nop) + (local.set $var$3 + (i32.const 1) ) ) ) (nop) - (nop) (local.set $14 (i32.add (local.get $var$3) @@ -5244,13 +4820,10 @@ infer %4 (i32.const 8) (local.get $14) ) - (nop) (i32.store (i32.const 8) (i32.const 64) ) - (nop) - (unreachable) (unreachable) ) (nop) |