diff options
author | Thomas Lively <tlively@google.com> | 2024-01-04 14:25:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 14:25:18 -0800 |
commit | a58281ca114359cd6e65f5daaf086636aa18b0b0 (patch) | |
tree | ff98bd31d1c87b598027c2303b17855a44346515 /test/passes | |
parent | 0ed42cf976ce9a3dfbe9cbb0885122e8fb6a377b (diff) | |
download | binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.tar.gz binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.tar.bz2 binaryen-a58281ca114359cd6e65f5daaf086636aa18b0b0.zip |
Require `then` and `else` with `if` (#6201)
We previously supported (and primarily used) a non-standard text format for
conditionals in which the condition, if-true expression, and if-false expression
were all simply s-expression children of the `if` expression. The standard text
format, however, requires the use of `then` and `else` forms to introduce the
if-true and if-false arms of the conditional. Update the legacy text parser to
require the standard format and update all tests to match. Update the printer to
print the standard format as well.
The .wast and .wat test inputs were mechanically updated with this script:
https://gist.github.com/tlively/85ae7f01f92f772241ec994c840ccbb1
Diffstat (limited to 'test/passes')
87 files changed, 12155 insertions, 6119 deletions
diff --git a/test/passes/O.bin.txt b/test/passes/O.bin.txt index 51610d92f..d35a4d11c 100644 --- a/test/passes/O.bin.txt +++ b/test/passes/O.bin.txt @@ -10,15 +10,19 @@ (i64.eqz (local.get $0) ) - (i64.const 1) - (i64.mul - (call $0 - (i64.sub - (local.get $0) - (i64.const 1) + (then + (i64.const 1) + ) + (else + (i64.mul + (call $0 + (i64.sub + (local.get $0) + (i64.const 1) + ) ) + (local.get $0) ) - (local.get $0) ) ) ) @@ -27,15 +31,19 @@ (i64.eqz (local.get $0) ) - (i64.const 1) - (i64.mul - (call $1 - (i64.sub - (local.get $0) - (i64.const 1) + (then + (i64.const 1) + ) + (else + (i64.mul + (call $1 + (i64.sub + (local.get $0) + (i64.const 1) + ) ) + (local.get $0) ) - (local.get $0) ) ) ) @@ -54,7 +62,7 @@ (local.get $0) ) ) - (block + (then (local.set $1 (i64.mul (local.get $0) @@ -83,22 +91,24 @@ (local.get $0) (i64.const 2) ) - (loop $label$3 - (local.set $1 - (i64.mul - (local.get $0) - (local.get $1) + (then + (loop $label$3 + (local.set $1 + (i64.mul + (local.get $0) + (local.get $1) + ) ) - ) - (br_if $label$3 - (i64.gt_s - (local.tee $0 - (i64.sub - (local.get $0) - (i64.const 1) + (br_if $label$3 + (i64.gt_s + (local.tee $0 + (i64.sub + (local.get $0) + (i64.const 1) + ) ) + (i64.const 1) ) - (i64.const 1) ) ) ) diff --git a/test/passes/O3_low-memory-unused_metrics.txt b/test/passes/O3_low-memory-unused_metrics.txt index 3bdce2921..547eb1673 100644 --- a/test/passes/O3_low-memory-unused_metrics.txt +++ b/test/passes/O3_low-memory-unused_metrics.txt @@ -93,9 +93,11 @@ total (local.get $0) ) ) - (br_if $label$3 - (i32.load offset=4 - (local.get $0) + (then + (br_if $label$3 + (i32.load offset=4 + (local.get $0) + ) ) ) ) @@ -133,7 +135,9 @@ total (local.get $0) ) ) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (i32.store (local.get $2) @@ -164,7 +168,7 @@ total (local.get $3) (i32.const 42) ) - (block + (then (if (i32.eq (i32.load offset=24 @@ -172,7 +176,7 @@ total ) (i32.const 2) ) - (block + (then (i32.store offset=48 (local.get $0) (call $fimport$14 @@ -249,7 +253,7 @@ total ) ) ) - (block + (then (i32.store offset=20 (local.get $2) (i32.add @@ -362,21 +366,23 @@ total ) (i32.const 9) ) - (local.set $3 - (select - (i32.const 4) - (i32.shl - (i32.gt_s - (i32.load offset=136 - (local.get $2) + (then + (local.set $3 + (select + (i32.const 4) + (i32.shl + (i32.gt_s + (i32.load offset=136 + (local.get $2) + ) + (i32.const 1) ) - (i32.const 1) + (i32.const 2) + ) + (i32.lt_s + (local.get $4) + (i32.const 2) ) - (i32.const 2) - ) - (i32.lt_s - (local.get $4) - (i32.const 2) ) ) ) @@ -635,21 +641,23 @@ total ) (i32.const 9) ) - (local.set $3 - (select - (i32.const 4) - (i32.shl - (i32.gt_s - (i32.load offset=136 - (local.get $2) + (then + (local.set $3 + (select + (i32.const 4) + (i32.shl + (i32.gt_s + (i32.load offset=136 + (local.get $2) + ) + (i32.const 1) ) - (i32.const 1) + (i32.const 2) + ) + (i32.lt_s + (local.get $4) + (i32.const 2) ) - (i32.const 2) - ) - (i32.lt_s - (local.get $4) - (i32.const 2) ) ) ) @@ -711,7 +719,7 @@ total ) ) ) - (block (result i32) + (then (local.set $3 (i32.load offset=20 (local.get $3) @@ -771,20 +779,24 @@ total (local.get $2) ) ) - (local.get $3) + (else + (local.get $3) + ) ) ) - (i32.store offset=48 - (local.get $0) - (call $fimport$14 - (i32.load offset=48 - (local.get $0) - ) - (i32.load offset=8 - (local.get $2) - ) - (i32.load offset=20 - (local.get $2) + (then + (i32.store offset=48 + (local.get $0) + (call $fimport$14 + (i32.load offset=48 + (local.get $0) + ) + (i32.load offset=8 + (local.get $2) + ) + (i32.load offset=20 + (local.get $2) + ) ) ) ) @@ -929,7 +941,7 @@ total (i32.load offset=108 (local.get $2) ) - (block + (then (local.set $3 (i32.load offset=48 (local.get $0) @@ -1062,7 +1074,7 @@ total ) ) ) - (block + (then (local.set $3 (i32.load offset=20 (local.get $2) @@ -1091,7 +1103,7 @@ total ) (local.get $3) ) - (block + (then (block $label$30 (br_if $label$30 (i32.le_u @@ -1299,13 +1311,13 @@ total ) (local.get $6) ) - (block + (then (local.set $3 (local.get $4) ) (br $label$26) ) - (block + (else (local.set $3 (i32.load offset=20 (local.get $2) @@ -1374,7 +1386,7 @@ total (local.get $5) ) ) - (block + (then (i32.store offset=4 (local.get $2) (i32.const 73) @@ -1429,7 +1441,7 @@ total ) (local.get $3) ) - (block + (then (block $label$39 (br_if $label$39 (i32.le_u @@ -1625,7 +1637,7 @@ total ) (if (local.get $5) - (block + (then (local.set $3 (i32.load offset=20 (local.get $2) @@ -1633,7 +1645,7 @@ total ) (br $label$37) ) - (block + (else (local.set $3 (local.get $4) ) @@ -1742,7 +1754,7 @@ total ) (local.get $3) ) - (block + (then (block $label$47 (br_if $label$47 (i32.le_u @@ -1938,7 +1950,7 @@ total ) (if (local.get $5) - (block + (then (local.set $3 (i32.load offset=20 (local.get $2) @@ -1946,7 +1958,7 @@ total ) (br $label$45) ) - (block + (else (local.set $3 (local.get $4) ) @@ -2029,7 +2041,7 @@ total (local.get $2) ) ) - (block + (then (block $label$52 (br_if $label$52 (i32.ge_u @@ -2231,7 +2243,7 @@ total (i32.load offset=20 (local.get $2) ) - (block + (then (block $label$55 (br_if $label$55 (i32.eqz @@ -2375,7 +2387,7 @@ total ) (i32.const 666) ) - (block + (then (br_if $label$58 (i32.eqz (local.get $3) @@ -2424,7 +2436,7 @@ total ) (i32.const 3) ) - (block + (then (br_if $label$61 (i32.ne (local.get $3) @@ -2467,9 +2479,11 @@ total ) (i32.const 3) ) - (i32.store offset=4 - (local.get $2) - (i32.const 666) + (then + (i32.store offset=4 + (local.get $2) + (i32.const 666) + ) ) ) (if @@ -2479,7 +2493,7 @@ total (i32.const -3) ) ) - (block + (then (local.set $3 (i32.const 0) ) @@ -2509,7 +2523,7 @@ total (local.get $1) (i32.const 1) ) - (block + (then (call $fimport$30 (local.get $2) ) @@ -2710,7 +2724,7 @@ total (local.get $4) (i32.const 2) ) - (block + (then (i32.store offset=20 (local.get $2) (i32.add @@ -3115,11 +3129,13 @@ total ) (i32.const 0) ) - (i32.store offset=24 - (local.get $2) - (i32.sub - (i32.const 0) - (local.get $0) + (then + (i32.store offset=24 + (local.get $2) + (i32.sub + (i32.const 0) + (local.get $0) + ) ) ) ) diff --git a/test/passes/converge_O3_metrics.bin.txt b/test/passes/converge_O3_metrics.bin.txt index 54cc551be..bd977b342 100644 --- a/test/passes/converge_O3_metrics.bin.txt +++ b/test/passes/converge_O3_metrics.bin.txt @@ -92,19 +92,21 @@ total (i32.const 10888) ) ) - (block $label$2 - (br_if $label$2 - (call_indirect (type $0) - (local.get $1) - (i32.const 10888) - (local.get $0) - (i32.add - (i32.load offset=48 - (i32.load - (local.get $1) + (then + (block $label$2 + (br_if $label$2 + (call_indirect (type $0) + (local.get $1) + (i32.const 10888) + (local.get $0) + (i32.add + (i32.load offset=48 + (i32.load + (local.get $1) + ) ) + (i32.const 8) ) - (i32.const 8) ) ) ) @@ -133,17 +135,21 @@ total (i32.const 24) ) ) - (i32.const 0) - (call_indirect (type $1) - (local.get $0) - (i32.const 10) - (i32.add - (i32.load offset=52 - (i32.load - (local.get $0) + (then + (i32.const 0) + ) + (else + (call_indirect (type $1) + (local.get $0) + (i32.const 10) + (i32.add + (i32.load offset=52 + (i32.load + (local.get $0) + ) ) + (i32.const 422) ) - (i32.const 422) ) ) ) @@ -317,19 +323,21 @@ total (i32.const 10888) ) ) - (block $label$2 - (br_if $label$2 - (call_indirect (type $0) - (local.get $1) - (i32.const 10888) - (local.get $0) - (i32.add - (i32.load offset=48 - (i32.load - (local.get $1) + (then + (block $label$2 + (br_if $label$2 + (call_indirect (type $0) + (local.get $1) + (i32.const 10888) + (local.get $0) + (i32.add + (i32.load offset=48 + (i32.load + (local.get $1) + ) ) + (i32.const 8) ) - (i32.const 8) ) ) ) @@ -358,17 +366,21 @@ total (i32.const 24) ) ) - (i32.const 0) - (call_indirect (type $1) - (local.get $0) - (i32.const 10) - (i32.add - (i32.load offset=52 - (i32.load - (local.get $0) + (then + (i32.const 0) + ) + (else + (call_indirect (type $1) + (local.get $0) + (i32.const 10) + (i32.add + (i32.load offset=52 + (i32.load + (local.get $0) + ) ) + (i32.const 422) ) - (i32.const 422) ) ) ) @@ -537,19 +549,21 @@ total (i32.const 10888) ) ) - (block $label$2 - (br_if $label$2 - (call_indirect (type $0) - (local.get $1) - (i32.const 10888) - (local.get $0) - (i32.add - (i32.load offset=48 - (i32.load - (local.get $1) + (then + (block $label$2 + (br_if $label$2 + (call_indirect (type $0) + (local.get $1) + (i32.const 10888) + (local.get $0) + (i32.add + (i32.load offset=48 + (i32.load + (local.get $1) + ) ) + (i32.const 8) ) - (i32.const 8) ) ) ) @@ -578,17 +592,21 @@ total (i32.const 24) ) ) - (i32.const 0) - (call_indirect (type $1) - (local.get $0) - (i32.const 10) - (i32.add - (i32.load offset=52 - (i32.load - (local.get $0) + (then + (i32.const 0) + ) + (else + (call_indirect (type $1) + (local.get $0) + (i32.const 10) + (i32.add + (i32.load offset=52 + (i32.load + (local.get $0) + ) ) + (i32.const 422) ) - (i32.const 422) ) ) ) diff --git a/test/passes/fannkuch3_manyopts_dwarf.bin.txt b/test/passes/fannkuch3_manyopts_dwarf.bin.txt index 1df0db506..caaced4ef 100644 --- a/test/passes/fannkuch3_manyopts_dwarf.bin.txt +++ b/test/passes/fannkuch3_manyopts_dwarf.bin.txt @@ -4788,7 +4788,7 @@ file_names[ 4]: ;; code offset: 0x4a (i32.const 0) ) - (block + (then ;; code offset: 0x4f (loop $label$4 ;; code offset: 0x5b @@ -4899,52 +4899,54 @@ file_names[ 4]: ;; code offset: 0x9c (i32.const 1) ) - ;; code offset: 0xa1 - (loop $label$7 - ;; code offset: 0xb2 - (i32.store - ;; code offset: 0xaf - (i32.add - ;; code offset: 0xa3 - (local.get $9) - ;; code offset: 0xae - (i32.shl - ;; code offset: 0xaa - (local.tee $1 - ;; code offset: 0xa9 - (i32.sub - ;; code offset: 0xa5 - (local.get $2) - ;; code offset: 0xa7 - (i32.const 1) + (then + ;; code offset: 0xa1 + (loop $label$7 + ;; code offset: 0xb2 + (i32.store + ;; code offset: 0xaf + (i32.add + ;; code offset: 0xa3 + (local.get $9) + ;; code offset: 0xae + (i32.shl + ;; code offset: 0xaa + (local.tee $1 + ;; code offset: 0xa9 + (i32.sub + ;; code offset: 0xa5 + (local.get $2) + ;; code offset: 0xa7 + (i32.const 1) + ) ) + ;; code offset: 0xac + (i32.const 2) ) - ;; code offset: 0xac + ) + ;; code offset: 0xb0 + (local.get $2) + ) + ;; code offset: 0xba + (local.set $0 + ;; code offset: 0xb9 + (i32.gt_s + ;; code offset: 0xb5 + (local.get $2) + ;; code offset: 0xb7 (i32.const 2) ) ) - ;; code offset: 0xb0 - (local.get $2) - ) - ;; code offset: 0xba - (local.set $0 - ;; code offset: 0xb9 - (i32.gt_s - ;; code offset: 0xb5 - (local.get $2) - ;; code offset: 0xb7 - (i32.const 2) + ;; code offset: 0xbe + (local.set $2 + ;; code offset: 0xbc + (local.get $1) + ) + ;; code offset: 0xc2 + (br_if $label$7 + ;; code offset: 0xc0 + (local.get $0) ) - ) - ;; code offset: 0xbe - (local.set $2 - ;; code offset: 0xbc - (local.get $1) - ) - ;; code offset: 0xc2 - (br_if $label$7 - ;; code offset: 0xc0 - (local.get $0) ) ) ) @@ -5016,7 +5018,7 @@ file_names[ 4]: ;; code offset: 0xf7 (i32.const 3) ) - (block + (then ;; code offset: 0x101 (local.set $1 ;; code offset: 0x100 @@ -5207,7 +5209,7 @@ file_names[ 4]: ;; code offset: 0x186 (i32.const 0) ) - (block + (then ;; code offset: 0x18b (loop $label$14 ;; code offset: 0x1a5 @@ -5419,52 +5421,54 @@ file_names[ 4]: ;; code offset: 0x225 (i32.const 2) ) - ;; code offset: 0x22a - (loop $label$17 - ;; code offset: 0x23b - (i32.store - ;; code offset: 0x238 - (i32.add - ;; code offset: 0x22c - (local.get $9) - ;; code offset: 0x237 - (i32.shl - ;; code offset: 0x233 - (local.tee $1 - ;; code offset: 0x232 - (i32.sub - ;; code offset: 0x22e - (local.get $2) - ;; code offset: 0x230 - (i32.const 1) + (then + ;; code offset: 0x22a + (loop $label$17 + ;; code offset: 0x23b + (i32.store + ;; code offset: 0x238 + (i32.add + ;; code offset: 0x22c + (local.get $9) + ;; code offset: 0x237 + (i32.shl + ;; code offset: 0x233 + (local.tee $1 + ;; code offset: 0x232 + (i32.sub + ;; code offset: 0x22e + (local.get $2) + ;; code offset: 0x230 + (i32.const 1) + ) ) + ;; code offset: 0x235 + (i32.const 2) ) - ;; code offset: 0x235 + ) + ;; code offset: 0x239 + (local.get $2) + ) + ;; code offset: 0x243 + (local.set $0 + ;; code offset: 0x242 + (i32.gt_s + ;; code offset: 0x23e + (local.get $2) + ;; code offset: 0x240 (i32.const 2) ) ) - ;; code offset: 0x239 - (local.get $2) - ) - ;; code offset: 0x243 - (local.set $0 - ;; code offset: 0x242 - (i32.gt_s - ;; code offset: 0x23e - (local.get $2) - ;; code offset: 0x240 - (i32.const 2) + ;; code offset: 0x247 + (local.set $2 + ;; code offset: 0x245 + (local.get $1) + ) + ;; code offset: 0x24b + (br_if $label$17 + ;; code offset: 0x249 + (local.get $0) ) - ) - ;; code offset: 0x247 - (local.set $2 - ;; code offset: 0x245 - (local.get $1) - ) - ;; code offset: 0x24b - (br_if $label$17 - ;; code offset: 0x249 - (local.get $0) ) ) ) @@ -5526,7 +5530,7 @@ file_names[ 4]: ;; code offset: 0x278 (i32.const 3) ) - (block + (then ;; code offset: 0x282 (local.set $1 ;; code offset: 0x281 @@ -5717,7 +5721,7 @@ file_names[ 4]: ;; code offset: 0x307 (i32.const 0) ) - (block + (then ;; code offset: 0x30c (loop $label$24 ;; code offset: 0x326 @@ -5916,23 +5920,25 @@ file_names[ 4]: ;; code offset: 0x3aa (i32.const 2) ) - ;; code offset: 0x3bb - (br_if $label$2 - ;; code offset: 0x3ba - (i32.gt_s - ;; code offset: 0x3b6 - (local.tee $3 - ;; code offset: 0x3b4 - (call $atoi - ;; code offset: 0x3b1 - (i32.load offset=4 - ;; code offset: 0x3af - (local.get $1) + (then + ;; code offset: 0x3bb + (br_if $label$2 + ;; code offset: 0x3ba + (i32.gt_s + ;; code offset: 0x3b6 + (local.tee $3 + ;; code offset: 0x3b4 + (call $atoi + ;; code offset: 0x3b1 + (i32.load offset=4 + ;; code offset: 0x3af + (local.get $1) + ) ) ) + ;; code offset: 0x3b8 + (i32.const 0) ) - ;; code offset: 0x3b8 - (i32.const 0) ) ) ) @@ -5961,7 +5967,7 @@ file_names[ 4]: ;; code offset: 0x3cd (i32.const 1) ) - (block + (then ;; code offset: 0x3d7 (local.set $2 ;; code offset: 0x3d6 @@ -6079,7 +6085,7 @@ file_names[ 4]: ;; code offset: 0x42b (i32.const 0) ) - (block + (then ;; code offset: 0x430 (loop $label$10 ;; code offset: 0x43c @@ -6230,52 +6236,54 @@ file_names[ 4]: ;; code offset: 0x49c (i32.const 1) ) - ;; code offset: 0x4a1 - (loop $label$14 - ;; code offset: 0x4b2 - (i32.store - ;; code offset: 0x4af - (i32.add - ;; code offset: 0x4a3 - (local.get $5) - ;; code offset: 0x4ae - (i32.shl - ;; code offset: 0x4aa - (local.tee $0 - ;; code offset: 0x4a9 - (i32.sub - ;; code offset: 0x4a5 - (local.get $2) - ;; code offset: 0x4a7 - (i32.const 1) + (then + ;; code offset: 0x4a1 + (loop $label$14 + ;; code offset: 0x4b2 + (i32.store + ;; code offset: 0x4af + (i32.add + ;; code offset: 0x4a3 + (local.get $5) + ;; code offset: 0x4ae + (i32.shl + ;; code offset: 0x4aa + (local.tee $0 + ;; code offset: 0x4a9 + (i32.sub + ;; code offset: 0x4a5 + (local.get $2) + ;; code offset: 0x4a7 + (i32.const 1) + ) ) + ;; code offset: 0x4ac + (i32.const 2) ) - ;; code offset: 0x4ac + ) + ;; code offset: 0x4b0 + (local.get $2) + ) + ;; code offset: 0x4ba + (local.set $7 + ;; code offset: 0x4b9 + (i32.gt_s + ;; code offset: 0x4b5 + (local.get $2) + ;; code offset: 0x4b7 (i32.const 2) ) ) - ;; code offset: 0x4b0 - (local.get $2) - ) - ;; code offset: 0x4ba - (local.set $7 - ;; code offset: 0x4b9 - (i32.gt_s - ;; code offset: 0x4b5 - (local.get $2) - ;; code offset: 0x4b7 - (i32.const 2) + ;; code offset: 0x4be + (local.set $2 + ;; code offset: 0x4bc + (local.get $0) + ) + ;; code offset: 0x4c2 + (br_if $label$14 + ;; code offset: 0x4c0 + (local.get $7) ) - ) - ;; code offset: 0x4be - (local.set $2 - ;; code offset: 0x4bc - (local.get $0) - ) - ;; code offset: 0x4c2 - (br_if $label$14 - ;; code offset: 0x4c0 - (local.get $7) ) ) ) @@ -6323,7 +6331,7 @@ file_names[ 4]: ;; code offset: 0x4e3 (i32.const 0) ) - (block + (then ;; code offset: 0x4e8 (loop $label$17 ;; code offset: 0x502 @@ -6439,7 +6447,7 @@ file_names[ 4]: ;; code offset: 0x538 (i32.const 1) ) - (block + (then ;; code offset: 0x547 (br_if $label$15 ;; code offset: 0x546 @@ -6491,52 +6499,54 @@ file_names[ 4]: ;; code offset: 0x55e (i32.const 1) ) - ;; code offset: 0x563 - (loop $label$21 - ;; code offset: 0x574 - (i32.store - ;; code offset: 0x571 - (i32.add - ;; code offset: 0x565 - (local.get $5) - ;; code offset: 0x570 - (i32.shl - ;; code offset: 0x56c - (local.tee $0 - ;; code offset: 0x56b - (i32.sub - ;; code offset: 0x567 - (local.get $2) - ;; code offset: 0x569 - (i32.const 1) + (then + ;; code offset: 0x563 + (loop $label$21 + ;; code offset: 0x574 + (i32.store + ;; code offset: 0x571 + (i32.add + ;; code offset: 0x565 + (local.get $5) + ;; code offset: 0x570 + (i32.shl + ;; code offset: 0x56c + (local.tee $0 + ;; code offset: 0x56b + (i32.sub + ;; code offset: 0x567 + (local.get $2) + ;; code offset: 0x569 + (i32.const 1) + ) ) + ;; code offset: 0x56e + (i32.const 2) ) - ;; code offset: 0x56e + ) + ;; code offset: 0x572 + (local.get $2) + ) + ;; code offset: 0x57c + (local.set $7 + ;; code offset: 0x57b + (i32.gt_s + ;; code offset: 0x577 + (local.get $2) + ;; code offset: 0x579 (i32.const 2) ) ) - ;; code offset: 0x572 - (local.get $2) - ) - ;; code offset: 0x57c - (local.set $7 - ;; code offset: 0x57b - (i32.gt_s - ;; code offset: 0x577 - (local.get $2) - ;; code offset: 0x579 - (i32.const 2) + ;; code offset: 0x580 + (local.set $2 + ;; code offset: 0x57e + (local.get $0) + ) + ;; code offset: 0x584 + (br_if $label$21 + ;; code offset: 0x582 + (local.get $7) ) - ) - ;; code offset: 0x580 - (local.set $2 - ;; code offset: 0x57e - (local.get $0) - ) - ;; code offset: 0x584 - (br_if $label$21 - ;; code offset: 0x582 - (local.get $7) ) ) ) @@ -6584,7 +6594,7 @@ file_names[ 4]: ;; code offset: 0x5a5 (i32.const 0) ) - (block + (then ;; code offset: 0x5aa (loop $label$24 ;; code offset: 0x5c4 @@ -6700,7 +6710,7 @@ file_names[ 4]: ;; code offset: 0x5fa (i32.const 1) ) - (block + (then ;; code offset: 0x609 (br_if $label$22 ;; code offset: 0x608 @@ -6755,55 +6765,57 @@ file_names[ 4]: (if ;; code offset: 0x625 (local.get $4) - ;; code offset: 0x629 - (loop $label$27 - ;; code offset: 0x62f - (local.set $1 - ;; code offset: 0x62d - (call $fannkuch_worker\28void*\29 - ;; code offset: 0x62b - (local.get $4) + (then + ;; code offset: 0x629 + (loop $label$27 + ;; code offset: 0x62f + (local.set $1 + ;; code offset: 0x62d + (call $fannkuch_worker\28void*\29 + ;; code offset: 0x62b + (local.get $4) + ) ) - ) - ;; code offset: 0x636 - (local.set $2 - ;; code offset: 0x633 - (i32.load offset=8 - ;; code offset: 0x631 + ;; code offset: 0x636 + (local.set $2 + ;; code offset: 0x633 + (i32.load offset=8 + ;; code offset: 0x631 + (local.get $4) + ) + ) + ;; code offset: 0x63a + (call $free + ;; code offset: 0x638 (local.get $4) ) - ) - ;; code offset: 0x63a - (call $free - ;; code offset: 0x638 - (local.get $4) - ) - ;; code offset: 0x646 - (local.set $0 - ;; code offset: 0x645 - (select - ;; code offset: 0x63c - (local.get $1) - ;; code offset: 0x63e - (local.get $0) - ;; code offset: 0x644 - (i32.lt_s - ;; code offset: 0x640 - (local.get $0) - ;; code offset: 0x642 + ;; code offset: 0x646 + (local.set $0 + ;; code offset: 0x645 + (select + ;; code offset: 0x63c (local.get $1) + ;; code offset: 0x63e + (local.get $0) + ;; code offset: 0x644 + (i32.lt_s + ;; code offset: 0x640 + (local.get $0) + ;; code offset: 0x642 + (local.get $1) + ) ) ) - ) - ;; code offset: 0x64a - (local.set $4 - ;; code offset: 0x648 - (local.get $2) - ) - ;; code offset: 0x64e - (br_if $label$27 - ;; code offset: 0x64c - (local.get $2) + ;; code offset: 0x64a + (local.set $4 + ;; code offset: 0x648 + (local.get $2) + ) + ;; code offset: 0x64e + (br_if $label$27 + ;; code offset: 0x64c + (local.get $2) + ) ) ) ) diff --git a/test/passes/func-metrics.txt b/test/passes/func-metrics.txt index 8c2812bd2..69b89557c 100644 --- a/test/passes/func-metrics.txt +++ b/test/passes/func-metrics.txt @@ -57,34 +57,48 @@ func: ifs (block $block0 (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) ) (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (drop - (i32.const 2) + (else + (drop + (i32.const 2) + ) ) ) (if (i32.const 4) - (drop - (i32.const 5) + (then + (drop + (i32.const 5) + ) ) - (drop - (i32.const 6) + (else + (drop + (i32.const 6) + ) ) ) (drop (i32.eq (if (result i32) (i32.const 4) - (i32.const 5) - (i32.const 6) + (then + (i32.const 5) + ) + (else + (i32.const 6) + ) ) (i32.const 177) ) diff --git a/test/passes/func-metrics.wast b/test/passes/func-metrics.wast index e95d819d9..3b7f79b13 100644 --- a/test/passes/func-metrics.wast +++ b/test/passes/func-metrics.wast @@ -16,34 +16,48 @@ (block $block0 (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) ) (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (drop - (i32.const 2) + (else + (drop + (i32.const 2) + ) ) ) (if (i32.const 4) - (drop - (i32.const 5) + (then + (drop + (i32.const 5) + ) ) - (drop - (i32.const 6) + (else + (drop + (i32.const 6) + ) ) ) (drop (i32.eq (if (result i32) (i32.const 4) - (i32.const 5) - (i32.const 6) + (then + (i32.const 5) + ) + (else + (i32.const 6) + ) ) (i32.const 177) ) diff --git a/test/passes/interesting-pass-mix.txt b/test/passes/interesting-pass-mix.txt index 2c13877db..ae6252b77 100644 --- a/test/passes/interesting-pass-mix.txt +++ b/test/passes/interesting-pass-mix.txt @@ -34,23 +34,29 @@ (func $loops (param $0 i32) (if (local.get $0) - (loop $shape$2$continue - (call $trivial) - (br $shape$2$continue) + (then + (loop $shape$2$continue + (call $trivial) + (br $shape$2$continue) + ) ) ) (loop $shape$4$continue (call $trivial) (if (local.get $0) - (br $shape$4$continue) + (then + (br $shape$4$continue) + ) ) ) (loop $shape$6$continue (call $trivial) (if (local.get $0) - (br $shape$6$continue) + (then + (br $shape$6$continue) + ) ) ) ) @@ -64,7 +70,7 @@ (i32.eqz (local.get $0) ) - (block + (then (call $unreachable (i32.const 5) ) @@ -73,14 +79,16 @@ ) (if (local.get $0) - (block + (then (call $unreachable (i32.const 1) ) (unreachable) ) - (call $unreachable - (i32.const 3) + (else + (call $unreachable + (i32.const 3) + ) ) ) ) @@ -104,8 +112,10 @@ (i32.eqz (local.get $0) ) - (call $before-and-after - (i32.const 5) + (then + (call $before-and-after + (i32.const 5) + ) ) ) (call $before-and-after @@ -123,7 +133,9 @@ ) (if (local.get $0) - (br $shape$4$continue) + (then + (br $shape$4$continue) + ) ) ) (call $before-and-after @@ -134,8 +146,10 @@ ) (if (local.get $0) - (call $before-and-after - (i32.const 12) + (then + (call $before-and-after + (i32.const 12) + ) ) ) (call $before-and-after @@ -143,17 +157,23 @@ ) (if (local.get $0) - (call $before-and-after - (i32.const 14) + (then + (call $before-and-after + (i32.const 14) + ) ) - (call $before-and-after - (i32.const 15) + (else + (call $before-and-after + (i32.const 15) + ) ) ) (if (local.get $0) - (call $before-and-after - (i32.const 16) + (then + (call $before-and-after + (i32.const 16) + ) ) ) (call $before-and-after @@ -215,12 +235,18 @@ (block $block$2$break (if (local.get $0) - (call $if-br-wat - (i32.const 1) + (then + (call $if-br-wat + (i32.const 1) + ) ) - (if - (local.get $0) - (br $block$2$break) + (else + (if + (local.get $0) + (then + (br $block$2$break) + ) + ) ) ) (call $if-br-wat diff --git a/test/passes/interesting-pass-mix.wast b/test/passes/interesting-pass-mix.wast index fba9e7c9e..c1f9bb8f2 100644 --- a/test/passes/interesting-pass-mix.wast +++ b/test/passes/interesting-pass-mix.wast @@ -15,23 +15,33 @@ (func $ifs (param $x i32) (result i32) (if (local.get $x) - (if - (local.get $x) - (return (i32.const 2)) - (return (i32.const 3)) + (then + (if + (local.get $x) + (then + (return (i32.const 2)) + ) + (else + (return (i32.const 3)) + ) + ) ) ) (if (local.get $x) - (return (i32.const 4)) + (then + (return (i32.const 4)) + ) ) (return (i32.const 5)) ) (func $loops (param $x i32) (if (local.get $x) - (loop $top - (call $trivial) - (br $top) + (then + (loop $top + (call $trivial) + (br $top) + ) ) ) (loop $top2 @@ -40,7 +50,7 @@ ) (loop $top3 (call $trivial) - (if (local.get $x) (br $top3)) + (if (local.get $x) (then (br $top3))) ) ) (func $br-out (param $x i32) @@ -51,16 +61,22 @@ ) (func $unreachable (param $x i32) (if (local.get $x) - (if (local.get $x) - (block - (call $unreachable (i32.const 1)) - (unreachable) - (call $unreachable (i32.const 2)) - ) - (block - (call $unreachable (i32.const 3)) - (return) - (call $unreachable (i32.const 4)) + (then + (if (local.get $x) + (then + (block + (call $unreachable (i32.const 1)) + (unreachable) + (call $unreachable (i32.const 2)) + ) + ) + (else + (block + (call $unreachable (i32.const 3)) + (return) + (call $unreachable (i32.const 4)) + ) + ) ) ) ) @@ -97,16 +113,24 @@ ) (call $before-and-after (i32.const 11)) (if (local.get $x) - (call $before-and-after (i32.const 12)) + (then + (call $before-and-after (i32.const 12)) + ) ) (call $before-and-after (i32.const 13)) (if (local.get $x) - (call $before-and-after (i32.const 14)) - (call $before-and-after (i32.const 15)) + (then + (call $before-and-after (i32.const 14)) + ) + (else + (call $before-and-after (i32.const 15)) + ) ) (if (local.get $x) - (block - (call $before-and-after (i32.const 16)) + (then + (block + (call $before-and-after (i32.const 16)) + ) ) ) (call $before-and-after (i32.const 17)) @@ -148,8 +172,12 @@ ) (func $no-return (if (i32.const 1) - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (drop (i32.const 2)) + ) + (else + (drop (i32.const 3)) + ) ) ) (func $if-br-wat (param $x i32) @@ -159,12 +187,18 @@ (block $label$2 (if (local.get $x) - (call $if-br-wat - (i32.const 1) + (then + (call $if-br-wat + (i32.const 1) + ) ) - (if - (local.get $x) - (br $label$2) ;; waka + (else + (if + (local.get $x) + (then + (br $label$2) ;; waka + ) + ) ) ) (call $if-br-wat diff --git a/test/passes/licm.txt b/test/passes/licm.txt index 3c038207b..83edd78c3 100644 --- a/test/passes/licm.txt +++ b/test/passes/licm.txt @@ -444,8 +444,10 @@ (func $conditional (if (i32.const 0) - (drop - (i32.const 10) + (then + (drop + (i32.const 10) + ) ) ) (loop $loop @@ -459,8 +461,10 @@ (loop $loop (if (call $conditional1) - (drop - (i32.const 10) + (then + (drop + (i32.const 10) + ) ) ) (br_if $loop diff --git a/test/passes/licm.wast b/test/passes/licm.wast index c4fbfcd99..0ec3632be 100644 --- a/test/passes/licm.wast +++ b/test/passes/licm.wast @@ -245,7 +245,9 @@ (func $conditional (loop $loop (if (i32.const 0) - (drop (i32.const 10)) ;; cannot be hoisted - might never be reached + (then + (drop (i32.const 10)) ;; cannot be hoisted - might never be reached + ) ) (br_if $loop (i32.const 1)) ) @@ -253,7 +255,9 @@ (func $conditional1 (result i32) (loop $loop (if (call $conditional1) - (drop (i32.const 10)) ;; cannot be hoisted - might never be reached + (then + (drop (i32.const 10)) ;; cannot be hoisted - might never be reached + ) ;; also anyhow the whole if also cannot, due to the call ) (br_if $loop (i32.const 1)) diff --git a/test/passes/log-execution.txt b/test/passes/log-execution.txt index fdc533280..35ca7411e 100644 --- a/test/passes/log-execution.txt +++ b/test/passes/log-execution.txt @@ -23,7 +23,9 @@ (block (if (i32.const 0) - (nop) + (then + (nop) + ) ) (block (call $log_execution @@ -51,11 +53,13 @@ ) (if (call $intt) - (loop $y - (call $log_execution - (i32.const 5) + (then + (loop $y + (call $log_execution + (i32.const 5) + ) + (call $loops) ) - (call $loops) ) ) (block diff --git a/test/passes/log-execution.wast b/test/passes/log-execution.wast index f7448408a..b84d7ac1f 100644 --- a/test/passes/log-execution.wast +++ b/test/passes/log-execution.wast @@ -7,7 +7,7 @@ (i32.const 10) ) (func $workk - (if (i32.const 0) (nop)) + (if (i32.const 0) (then (nop))) (drop (i32.const 1)) ) (func $loops @@ -16,8 +16,10 @@ (br $x) ) (if (call $intt) - (loop $y - (call $loops) + (then + (loop $y + (call $loops) + ) ) ) (loop diff --git a/test/passes/merge-blocks.txt b/test/passes/merge-blocks.txt index b1037478b..86d97af4b 100644 --- a/test/passes/merge-blocks.txt +++ b/test/passes/merge-blocks.txt @@ -49,7 +49,7 @@ (block $x (if (i32.const 100) - (block + (then (drop (i32.const 1) ) @@ -121,7 +121,7 @@ (block $label (if (i32.const 1) - (block + (then (drop (i32.const 2) ) @@ -136,7 +136,7 @@ (block $label (if (br $label) - (block + (then (drop (i32.const 2) ) @@ -151,7 +151,9 @@ (block $label (if (i32.const 1) - (br $label) + (then + (br $label) + ) ) ) ) @@ -159,9 +161,13 @@ (block $label (if (i32.const 1) - (br $label) - (drop - (i32.const 3) + (then + (br $label) + ) + (else + (drop + (i32.const 3) + ) ) ) ) @@ -170,10 +176,14 @@ (block $label (if (i32.const 1) - (drop - (i32.const 3) + (then + (drop + (i32.const 3) + ) + ) + (else + (br $label) ) - (br $label) ) ) ) @@ -181,8 +191,12 @@ (block $label (if (i32.const 1) - (br $label) - (br $label) + (then + (br $label) + ) + (else + (br $label) + ) ) ) ) @@ -190,11 +204,15 @@ (block $label (if (i32.const 1) - (drop - (i32.const 2) + (then + (drop + (i32.const 2) + ) ) - (drop - (i32.const 3) + (else + (drop + (i32.const 3) + ) ) ) ) @@ -203,8 +221,12 @@ (block $label (result i32) (if (result i32) (i32.const 1) - (i32.const 2) - (i32.const 3) + (then + (i32.const 2) + ) + (else + (i32.const 3) + ) ) ) ) @@ -217,7 +239,9 @@ (block $label$4 (unreachable) ) - (br $label$3) + (then + (br $label$3) + ) ) ) (unreachable) @@ -229,24 +253,34 @@ (block $label$1 (if (unreachable) - (nop) - (unreachable) + (then + (nop) + ) + (else + (unreachable) + ) ) ) ) (func $propagate-type-if-we-optimize (if (i32.const 1) - (nop) - (block + (then + (nop) + ) + (else (drop (loop $label$3 (result i64) (br_if $label$3 (block $label$4 (result i32) (if (i32.const 0) - (unreachable) - (unreachable) + (then + (unreachable) + ) + (else + (unreachable) + ) ) ) ) diff --git a/test/passes/merge-blocks.wast b/test/passes/merge-blocks.wast index 55996420e..749797ce6 100644 --- a/test/passes/merge-blocks.wast +++ b/test/passes/merge-blocks.wast @@ -44,9 +44,11 @@ (drop (block $x (result i32) (if (i32.const 100) - (block - (drop (br_if $x (i32.const 1) (i32.const 2))) - (nop) + (then + (block + (drop (br_if $x (i32.const 1) (i32.const 2))) + (nop) + ) ) ) (i32.const 0) @@ -113,9 +115,11 @@ (block $label (if (i32.const 1) - (block - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (block + (drop (i32.const 2)) + (drop (i32.const 3)) + ) ) ) ) @@ -124,9 +128,11 @@ (block $label (if (br $label) ;; use outside of arm - (block - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (block + (drop (i32.const 2)) + (drop (i32.const 3)) + ) ) ) ) @@ -135,7 +141,9 @@ (block $label (if (i32.const 1) - (br $label) + (then + (br $label) + ) ) ) ) @@ -143,8 +151,12 @@ (block $label (if (i32.const 1) - (br $label) - (drop (i32.const 3)) + (then + (br $label) + ) + (else + (drop (i32.const 3)) + ) ) ) ) @@ -152,8 +164,12 @@ (block $label (if (i32.const 1) - (drop (i32.const 3)) - (br $label) + (then + (drop (i32.const 3)) + ) + (else + (br $label) + ) ) ) ) @@ -161,8 +177,12 @@ (block $label (if (i32.const 1) - (br $label) - (br $label) + (then + (br $label) + ) + (else + (br $label) + ) ) ) ) @@ -170,8 +190,12 @@ (block $label (if (i32.const 1) - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (drop (i32.const 2)) + ) + (else + (drop (i32.const 3)) + ) ) ) ) @@ -179,8 +203,12 @@ (block $label (result i32) (if (result i32) (i32.const 1) - (i32.const 2) - (i32.const 3) + (then + (i32.const 2) + ) + (else + (i32.const 3) + ) ) ) ) @@ -193,7 +221,9 @@ (block $label$4 (unreachable) ) - (br $label$3) + (then + (br $label$3) + ) ) ) (unreachable) @@ -205,31 +235,43 @@ (block $label$1 (if (unreachable) ;; unreachable condition - (nop) - (unreachable) + (then + (nop) + ) + (else + (unreachable) + ) ) ) ) (func $propagate-type-if-we-optimize (if (i32.const 1) - (nop) - (block - (drop - (loop $label$3 (result i64) - (br_if $label$3 - (block $label$4 (result i32) - (if - (i32.const 0) - (unreachable) - (unreachable) + (then + (nop) + ) + (else + (block + (drop + (loop $label$3 (result i64) + (br_if $label$3 + (block $label$4 (result i32) + (if + (i32.const 0) + (then + (unreachable) + ) + (else + (unreachable) + ) + ) ) ) + (i64.const -9) ) - (i64.const -9) ) + (unreachable) ) - (unreachable) ) ) ) diff --git a/test/passes/merge-locals_all-features.txt b/test/passes/merge-locals_all-features.txt index e9fd7acb0..18b552e5d 100644 --- a/test/passes/merge-locals_all-features.txt +++ b/test/passes/merge-locals_all-features.txt @@ -11,8 +11,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $x) @@ -23,8 +27,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $x) @@ -35,8 +43,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (drop @@ -50,8 +62,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (drop @@ -68,17 +84,25 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (if (i32.const 300) - (local.set $y - (i32.const 400) + (then + (local.set $y + (i32.const 400) + ) ) - (drop - (local.get $x) + (else + (drop + (local.get $x) + ) ) ) (i32.const 500) @@ -89,17 +113,25 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 200) + (then + (i32.const 100) + ) + (else + (i32.const 200) + ) ) ) (if (i32.const 300) - (local.set $y - (i32.const 400) + (then + (local.set $y + (i32.const 400) + ) ) - (drop - (local.get $y) + (else + (drop + (local.get $y) + ) ) ) (local.get $y) @@ -110,8 +142,12 @@ (local.tee $x (local.get $x) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $y) @@ -124,8 +160,12 @@ (local.get $x) ) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $y) @@ -149,8 +189,10 @@ ) (if (local.get $var$1) - (local.set $var$2 - (i32.const 1) + (then + (local.set $var$2 + (i32.const 1) + ) ) ) (drop @@ -163,8 +205,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $y) + (then + (i32.const 100) + ) + (else + (local.get $y) + ) ) ) (drop @@ -172,8 +218,10 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 200) + (then + (local.set $y + (i32.const 200) + ) ) ) (drop @@ -186,8 +234,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) ) @@ -197,8 +249,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.set $y @@ -214,8 +270,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $y) + (then + (i32.const 100) + ) + (else + (local.get $y) + ) ) ) (local.set $x @@ -226,8 +286,10 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 200) + (then + (local.set $y + (i32.const 200) + ) ) ) (drop @@ -240,8 +302,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 150) + (then + (i32.const 100) + ) + (else + (i32.const 150) + ) ) ) (local.set $x @@ -252,8 +318,10 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 200) + (then + (local.set $y + (i32.const 200) + ) ) ) (drop @@ -266,14 +334,20 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 150) + (then + (i32.const 100) + ) + (else + (i32.const 150) + ) ) ) (if (i32.const 1) - (local.set $x - (i32.const 300) + (then + (local.set $x + (i32.const 300) + ) ) ) (drop @@ -281,8 +355,10 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 200) + (then + (local.set $y + (i32.const 200) + ) ) ) (drop @@ -295,14 +371,20 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (if (i32.const 1) - (local.set $x - (i32.const 300) + (then + (local.set $x + (i32.const 300) + ) ) ) (drop @@ -310,8 +392,10 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 200) + (then + (local.set $y + (i32.const 200) + ) ) ) (drop @@ -324,20 +408,28 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 150) + (then + (i32.const 100) + ) + (else + (i32.const 150) + ) ) ) (if (i32.const 1) - (drop - (local.get $x) + (then + (drop + (local.get $x) + ) ) - (block + (else (if (i32.const 1) - (local.set $x - (i32.const 300) + (then + (local.set $x + (i32.const 300) + ) ) ) (drop @@ -347,8 +439,10 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 200) + (then + (local.set $y + (i32.const 200) + ) ) ) (drop @@ -388,12 +482,14 @@ (local.get $var$0) ) ) - (i32.const 0) - (block (result i32) + (then + (i32.const 0) + ) + (else (local.set $var$3 (if (result i32) (i32.const 0) - (block (result i32) + (then (block $label$7 (block $label$8 (local.set $var$0 @@ -403,13 +499,15 @@ ) (local.get $var$3) ) - (block (result i32) + (else (if (i32.eqz (global.get $global$0) ) - (return - (i64.const 137438953472) + (then + (return + (i64.const 137438953472) + ) ) ) (global.set $global$0 @@ -443,8 +541,10 @@ (loop $label$1 (if (i32.const 1) - (drop - (local.get $result) + (then + (drop + (local.get $result) + ) ) ) (local.set $result diff --git a/test/passes/merge-locals_all-features.wast b/test/passes/merge-locals_all-features.wast index 1b73c9a95..b1d3aa9b7 100644 --- a/test/passes/merge-locals_all-features.wast +++ b/test/passes/merge-locals_all-features.wast @@ -6,8 +6,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $y) ;; turn this into $x @@ -18,8 +22,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $x) @@ -30,8 +38,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (drop (local.get $y)) ;; turn this into $x @@ -43,8 +55,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (drop (local.get $y)) ;; turn this into $x @@ -57,14 +73,22 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (if (i32.const 300) - (local.set $y (i32.const 400)) - (drop (local.get $y)) ;; turn this into $x + (then + (local.set $y (i32.const 400)) + ) + (else + (drop (local.get $y)) ;; turn this into $x + ) ) (i32.const 500) ) @@ -74,14 +98,22 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 200) + (then + (i32.const 100) + ) + (else + (i32.const 200) + ) ) ) (if (i32.const 300) - (local.set $y (i32.const 400)) - (drop (local.get $y)) ;; can turn this into $x, but another exists we can't, so do nothing + (then + (local.set $y (i32.const 400)) + ) + (else + (drop (local.get $y)) ;; can turn this into $x, but another exists we can't, so do nothing + ) ) (local.get $y) ;; but not this one! ) @@ -91,8 +123,12 @@ (local.tee $x (local.get $x) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $y) ;; turn this into $x @@ -105,8 +141,12 @@ (local.get $x) ) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (local.get $y) ;; turn this into $x @@ -129,8 +169,10 @@ (local.get $var$1) ) (if (local.get $var$1) - (local.set $var$2 ;; conditional overwrite 2 - (i32.const 1) + (then + (local.set $var$2 ;; conditional overwrite 2 + (i32.const 1) + ) ) ) (drop @@ -143,13 +185,19 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (drop (local.get $x)) ;; (read lower down first) but the reverse can work! (if (i32.const 1) - (local.set $y (i32.const 200)) + (then + (local.set $y (i32.const 200)) + ) ) (drop (local.get $y)) ;; cannot this into $x, since this $y has multiple sources ) @@ -159,8 +207,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) ;; don't change to $y, as its lifetime ended. leave it ended + (then + (i32.const 100) + ) + (else + (local.get $x) ;; don't change to $y, as its lifetime ended. leave it ended + ) ) ) ) @@ -170,8 +222,12 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) ;; don't change to $y, as its lifetime ended. leave it ended + (then + (i32.const 100) + ) + (else + (local.get $x) ;; don't change to $y, as its lifetime ended. leave it ended + ) ) ) (local.set $y (i32.const 200)) @@ -183,14 +239,20 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) ;; can optimize this ($y lives on) + (then + (i32.const 100) + ) + (else + (local.get $x) ;; can optimize this ($y lives on) + ) ) ) (local.set $x (i32.const 300)) ;; force an undo (drop (local.get $x)) ;; (read lower down first) but the reverse can almost work (if (i32.const 1) - (local.set $y (i32.const 200)) + (then + (local.set $y (i32.const 200)) + ) ) (drop (local.get $y)) ;; cannot this into $x, since this $y has multiple sources ) @@ -200,14 +262,20 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 150) + (then + (i32.const 100) + ) + (else + (i32.const 150) + ) ) ) (local.set $x (i32.const 300)) ;; force an undo (drop (local.get $x)) ;; (read lower down first) but the reverse can almost work (if (i32.const 1) - (local.set $y (i32.const 200)) + (then + (local.set $y (i32.const 200)) + ) ) (drop (local.get $y)) ;; cannot this into $x, since this $y has multiple sources ) @@ -217,16 +285,24 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 150) + (then + (i32.const 100) + ) + (else + (i32.const 150) + ) ) ) (if (i32.const 1) - (local.set $x (i32.const 300)) ;; force an undo + (then + (local.set $x (i32.const 300)) ;; force an undo + ) ) (drop (local.get $x)) ;; (read lower down first) but the reverse can almost work (if (i32.const 1) - (local.set $y (i32.const 200)) + (then + (local.set $y (i32.const 200)) + ) ) (drop (local.get $y)) ;; cannot this into $x, since this $y has multiple sources ) @@ -236,16 +312,24 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (local.get $x) + (then + (i32.const 100) + ) + (else + (local.get $x) + ) ) ) (if (i32.const 1) - (local.set $x (i32.const 300)) ;; force an undo + (then + (local.set $x (i32.const 300)) ;; force an undo + ) ) (drop (local.get $x)) ;; (read lower down first) but the reverse can almost work (if (i32.const 1) - (local.set $y (i32.const 200)) + (then + (local.set $y (i32.const 200)) + ) ) (drop (local.get $y)) ;; cannot this into $x, since this $y has multiple sources ) @@ -255,21 +339,33 @@ (local.tee $x (local.get $y) ) - (i32.const 100) - (i32.const 150) + (then + (i32.const 100) + ) + (else + (i32.const 150) + ) ) ) (if (i32.const 1) - (drop (local.get $x)) - (block - (if (i32.const 1) - (local.set $x (i32.const 300)) ;; force an undo + (then + (drop (local.get $x)) + ) + (else + (block + (if (i32.const 1) + (then + (local.set $x (i32.const 300)) ;; force an undo + ) + ) + (drop (local.get $x)) ;; (read lower down first) but the reverse can almost work ) - (drop (local.get $x)) ;; (read lower down first) but the reverse can almost work ) ) (if (i32.const 1) - (local.set $y (i32.const 200)) + (then + (local.set $y (i32.const 200)) + ) ) (drop (local.get $y)) ;; cannot this into $x, since this $y has multiple sources ) @@ -306,48 +402,58 @@ (local.get $var$0) ) ) - (i32.const 0) - (block (result i32) - (local.set $var$3 - (if (result i32) - (i32.const 0) - (block (result i32) - (block $label$7 - (block $label$8 - (local.set $var$0 - (i32.const 34738786) + (then + (i32.const 0) + ) + (else + (block (result i32) + (local.set $var$3 + (if (result i32) + (i32.const 0) + (then + (block (result i32) + (block $label$7 + (block $label$8 + (local.set $var$0 + (i32.const 34738786) + ) + ) ) - ) - ) - (local.get $var$3) - ) - (block (result i32) - (if - (i32.eqz - (global.get $global$0) - ) - (return - (i64.const 137438953472) - ) - ) - (global.set $global$0 - (i32.sub - (global.get $global$0) - (i32.const 1) - ) - ) - (br_if $label$1 - (i32.eqz (local.get $var$3) ) ) - (return - (i64.const 44125) + (else + (block (result i32) + (if + (i32.eqz + (global.get $global$0) + ) + (then + (return + (i64.const 137438953472) + ) + ) + ) + (global.set $global$0 + (i32.sub + (global.get $global$0) + (i32.const 1) + ) + ) + (br_if $label$1 + (i32.eqz + (local.get $var$3) + ) + ) + (return + (i64.const 44125) + ) + ) ) ) ) + (i32.const -129) ) - (i32.const -129) ) ) ) @@ -361,8 +467,10 @@ (loop $label$1 (if (i32.const 1) - (drop - (local.get $result) + (then + (drop + (local.get $result) + ) ) ) (local.set $result ;; vanishes diff --git a/test/passes/metrics_all-features.txt b/test/passes/metrics_all-features.txt index e40a35441..2fcf29257 100644 --- a/test/passes/metrics_all-features.txt +++ b/test/passes/metrics_all-features.txt @@ -31,34 +31,48 @@ total (block $block0 (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) ) (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (drop - (i32.const 2) + (else + (drop + (i32.const 2) + ) ) ) (if (i32.const 4) - (drop - (i32.const 5) + (then + (drop + (i32.const 5) + ) ) - (drop - (i32.const 6) + (else + (drop + (i32.const 6) + ) ) ) (drop (i32.eq (if (result i32) (i32.const 4) - (i32.const 5) - (i32.const 6) + (then + (i32.const 5) + ) + (else + (i32.const 6) + ) ) (i32.const 177) ) diff --git a/test/passes/metrics_all-features.wast b/test/passes/metrics_all-features.wast index 68c13b9c2..fe4a70ce2 100644 --- a/test/passes/metrics_all-features.wast +++ b/test/passes/metrics_all-features.wast @@ -12,34 +12,48 @@ (block $block0 (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) ) (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (drop - (i32.const 2) + (else + (drop + (i32.const 2) + ) ) ) (if (i32.const 4) - (drop - (i32.const 5) + (then + (drop + (i32.const 5) + ) ) - (drop - (i32.const 6) + (else + (drop + (i32.const 6) + ) ) ) (drop (i32.eq (if (result i32) (i32.const 4) - (i32.const 5) - (i32.const 6) + (then + (i32.const 5) + ) + (else + (i32.const 6) + ) ) (i32.const 177) ) diff --git a/test/passes/optimize-added-constants-propagate_low-memory-unused.txt b/test/passes/optimize-added-constants-propagate_low-memory-unused.txt index 2c8a9f0c7..981699603 100644 --- a/test/passes/optimize-added-constants-propagate_low-memory-unused.txt +++ b/test/passes/optimize-added-constants-propagate_low-memory-unused.txt @@ -271,8 +271,10 @@ (local $3 i32) (if (local.get $z) - (local.set $y - (i32.const -1) + (then + (local.set $y + (i32.const -1) + ) ) ) (block @@ -323,10 +325,12 @@ ) (if (i32.const 1) - (local.set $x - (i32.add - (i32.const 2) - (local.get $y) + (then + (local.set $x + (i32.add + (i32.const 2) + (local.get $y) + ) ) ) ) diff --git a/test/passes/optimize-added-constants-propagate_low-memory-unused.wast b/test/passes/optimize-added-constants-propagate_low-memory-unused.wast index d62d487d2..dbff37fbc 100644 --- a/test/passes/optimize-added-constants-propagate_low-memory-unused.wast +++ b/test/passes/optimize-added-constants-propagate_low-memory-unused.wast @@ -303,7 +303,9 @@ (local $x i32) (local $y i32) (if (local.get $z) - (local.set $y (i32.const -1)) ;; y is not ssa + (then + (local.set $y (i32.const -1)) ;; y is not ssa + ) ) (local.set $x (i32.add @@ -345,10 +347,12 @@ ) ) (if (i32.const 1) - (local.set $x ;; x is not ssa - (i32.add - (i32.const 2) - (local.get $y) + (then + (local.set $x ;; x is not ssa + (i32.add + (i32.const 2) + (local.get $y) + ) ) ) ) diff --git a/test/passes/optimize-added-constants_low-memory-unused.txt b/test/passes/optimize-added-constants_low-memory-unused.txt index c700fa741..9baf092af 100644 --- a/test/passes/optimize-added-constants_low-memory-unused.txt +++ b/test/passes/optimize-added-constants_low-memory-unused.txt @@ -290,8 +290,10 @@ (local $y i32) (if (local.get $z) - (local.set $y - (i32.const -1) + (then + (local.set $y + (i32.const -1) + ) ) ) (local.set $x diff --git a/test/passes/optimize-added-constants_low-memory-unused.wast b/test/passes/optimize-added-constants_low-memory-unused.wast index ac7d77fc4..4b40a0f85 100644 --- a/test/passes/optimize-added-constants_low-memory-unused.wast +++ b/test/passes/optimize-added-constants_low-memory-unused.wast @@ -303,7 +303,9 @@ (local $x i32) (local $y i32) (if (local.get $z) - (local.set $y (i32.const -1)) + (then + (local.set $y (i32.const -1)) + ) ) (local.set $x (i32.add diff --git a/test/passes/precompute-propagate_all-features.txt b/test/passes/precompute-propagate_all-features.txt index 6fb67825a..380c7a889 100644 --- a/test/passes/precompute-propagate_all-features.txt +++ b/test/passes/precompute-propagate_all-features.txt @@ -19,8 +19,10 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 10) + (then + (local.set $x + (i32.const 10) + ) ) ) (call $basic @@ -34,11 +36,15 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 10) + (then + (local.set $x + (i32.const 10) + ) ) - (local.set $x - (i32.const 10) + (else + (local.set $x + (i32.const 10) + ) ) ) (call $basic @@ -49,11 +55,15 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 10) + (then + (local.set $x + (i32.const 10) + ) ) - (local.set $x - (i32.const 20) + (else + (local.set $x + (i32.const 20) + ) ) ) (call $basic @@ -67,11 +77,15 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 10) + (then + (local.set $x + (i32.const 10) + ) ) - (local.set $x - (local.get $p) + (else + (local.set $x + (local.get $p) + ) ) ) (call $basic @@ -85,8 +99,10 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 0) + (then + (local.set $x + (i32.const 0) + ) ) ) (call $basic @@ -129,11 +145,15 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 11) + (then + (local.set $y + (i32.const 11) + ) ) - (local.set $y - (i32.const 11) + (else + (local.set $y + (i32.const 11) + ) ) ) (local.set $y @@ -149,11 +169,15 @@ ) (if (i32.const 1) - (local.set $y - (i32.const 12) + (then + (local.set $y + (i32.const 12) + ) ) - (local.set $y - (i32.const 11) + (else + (local.set $y + (i32.const 11) + ) ) ) (local.set $y @@ -242,8 +266,10 @@ (nop) (if (local.get $3) - (local.set $2 - (i32.const 0) + (then + (local.set $2 + (i32.const 0) + ) ) ) (local.get $2) diff --git a/test/passes/precompute-propagate_all-features.wast b/test/passes/precompute-propagate_all-features.wast index 17a20417d..0460ad34a 100644 --- a/test/passes/precompute-propagate_all-features.wast +++ b/test/passes/precompute-propagate_all-features.wast @@ -8,38 +8,54 @@ (func $split (param $p i32) (local $x i32) (if (i32.const 1) - (local.set $x (i32.const 10)) + (then + (local.set $x (i32.const 10)) + ) ) (call $basic (i32.add (local.get $x) (local.get $x))) ) (func $split-but-join (param $p i32) (local $x i32) (if (i32.const 1) - (local.set $x (i32.const 10)) - (local.set $x (i32.const 10)) + (then + (local.set $x (i32.const 10)) + ) + (else + (local.set $x (i32.const 10)) + ) ) (call $basic (i32.add (local.get $x) (local.get $x))) ) (func $split-but-join-different (param $p i32) (local $x i32) (if (i32.const 1) - (local.set $x (i32.const 10)) - (local.set $x (i32.const 20)) + (then + (local.set $x (i32.const 10)) + ) + (else + (local.set $x (i32.const 20)) + ) ) (call $basic (i32.add (local.get $x) (local.get $x))) ) (func $split-but-join-different-b (param $p i32) (local $x i32) (if (i32.const 1) - (local.set $x (i32.const 10)) - (local.set $x (local.get $p)) + (then + (local.set $x (i32.const 10)) + ) + (else + (local.set $x (local.get $p)) + ) ) (call $basic (i32.add (local.get $x) (local.get $x))) ) (func $split-but-join-init0 (param $p i32) (local $x i32) (if (i32.const 1) - (local.set $x (i32.const 0)) + (then + (local.set $x (i32.const 0)) + ) ) (call $basic (i32.add (local.get $x) (local.get $x))) ) @@ -62,8 +78,12 @@ (local $y i32) (local.set $x (i32.const 10)) (if (i32.const 1) - (local.set $y (i32.const 11)) - (local.set $y (i32.add (local.get $x) (i32.const 1))) + (then + (local.set $y (i32.const 11)) + ) + (else + (local.set $y (i32.add (local.get $x) (i32.const 1))) + ) ) (local.set $y (i32.add (local.get $x) (local.get $y))) (local.get $y) @@ -73,8 +93,12 @@ (local $y i32) (local.set $x (i32.const 10)) (if (i32.const 1) - (local.set $y (i32.const 12)) ;; 12, not 11... - (local.set $y (i32.add (local.get $x) (i32.const 1))) + (then + (local.set $y (i32.const 12)) ;; 12, not 11... + ) + (else + (local.set $y (i32.add (local.get $x) (i32.const 1))) + ) ) (local.set $y (i32.add (local.get $x) (local.get $y))) (local.get $y) @@ -83,8 +107,8 @@ (local $x i32) (local $y i32) (loop $loop ;; we look like we depend on the other, but we don't actually - (local.set $x (if (result i32) (i32.const 1) (i32.const 0) (local.get $y))) - (local.set $y (if (result i32) (i32.const 1) (i32.const 0) (local.get $x))) + (local.set $x (if (result i32) (i32.const 1) (then (i32.const 0) )(else (local.get $y)))) + (local.set $y (if (result i32) (i32.const 1) (then (i32.const 0) )(else (local.get $x)))) (br $loop) ) ) @@ -92,8 +116,8 @@ (local $x i32) (local $y i32) (loop $loop ;; we look like we depend on the other, but we don't actually - (local.set $x (if (result i32) (i32.const 1) (i32.const 0) (local.get $y))) - (local.set $y (if (result i32) (i32.const 1) (i32.const 0) (local.get $x))) + (local.set $x (if (result i32) (i32.const 1) (then (i32.const 0) )(else (local.get $y)))) + (local.set $y (if (result i32) (i32.const 1) (then (i32.const 0) )(else (local.get $x)))) (call $deadloop2 (local.get $x)) (call $deadloop2 (local.get $y)) (br $loop) @@ -103,8 +127,8 @@ (local $x i32) (local $y i32) (loop $loop ;; we look like we depend on the other, but we don't actually - (local.set $x (if (result i32) (i32.const 1) (i32.const 0) (local.get $x))) - (local.set $y (if (result i32) (i32.const 1) (i32.const 0) (local.get $y))) + (local.set $x (if (result i32) (i32.const 1) (then (i32.const 0) )(else (local.get $x)))) + (local.set $y (if (result i32) (i32.const 1) (then (i32.const 0) )(else (local.get $y)))) (call $deadloop2 (local.get $x)) (call $deadloop2 (local.get $y)) (br $loop) @@ -147,14 +171,18 @@ ;; if lower down, but we do not do an additional cycle of ;; this pass automatically as such things are fairly rare, ;; so that opportunity remains unoptimized in this test. - (local.set $3 ;; this set is completely removed, allowing later opts - (i32.const 24) + (then + (local.set $3 ;; this set is completely removed, allowing later opts + (i32.const 24) + ) ) ) (if (local.get $3) - (local.set $2 - (i32.const 0) + (then + (local.set $2 + (i32.const 0) + ) ) ) (local.get $2) diff --git a/test/passes/precompute_all-features.txt b/test/passes/precompute_all-features.txt index affa32531..3f5908ef0 100644 --- a/test/passes/precompute_all-features.txt +++ b/test/passes/precompute_all-features.txt @@ -96,14 +96,18 @@ (func $ret (type $1) (result i32) (if (call $ret) - (return - (i32.const 0) + (then + (return + (i32.const 0) + ) ) ) (if (call $ret) - (return - (i32.const 1) + (then + (return + (i32.const 1) + ) ) ) (i32.const 1) @@ -111,7 +115,9 @@ (func $noret (type $0) (if (call $ret) - (return) + (then + (return) + ) ) ) (func $refinalize-br-condition-unreachable (type $0) @@ -144,21 +150,25 @@ (i32.const 1919623207) (if (result i32) (i32.const 1) - (block $label$2 - (drop - (i64.and - (i64.trunc_f32_u - (f32.const 70847791997969805621592064) + (then + (block $label$2 + (drop + (i64.and + (i64.trunc_f32_u + (f32.const 70847791997969805621592064) + ) + (i64.const 729618461987467893) ) - (i64.const 729618461987467893) ) - ) - (br $label$0 - (f64.const 6.134856208230095e-154) + (br $label$0 + (f64.const 6.134856208230095e-154) + ) ) ) - (i32.load offset=3 align=2 - (i32.const 169901344) + (else + (i32.load offset=3 align=2 + (i32.const 169901344) + ) ) ) ) diff --git a/test/passes/precompute_all-features.wast b/test/passes/precompute_all-features.wast index 450001533..633787fad 100644 --- a/test/passes/precompute_all-features.wast +++ b/test/passes/precompute_all-features.wast @@ -192,16 +192,22 @@ ) (func $ret (result i32) (if (call $ret) - (return (i32.const 0)) + (then + (return (i32.const 0)) + ) ) (if (call $ret) - (return (return (i32.const 1))) + (then + (return (return (i32.const 1))) + ) ) (i32.const 1) ) (func $noret (if (call $ret) - (return) + (then + (return) + ) ) ) (func $refinalize-br-condition-unreachable @@ -234,33 +240,37 @@ (i32.const 1919623207) (if (result i32) (i32.const 1) - (block $label$2 (result i32) - (drop - (i64.and - (i64.trunc_f32_u - (f32.const 70847791997969805621592064) + (then + (block $label$2 (result i32) + (drop + (i64.and + (i64.trunc_f32_u + (f32.const 70847791997969805621592064) + ) + (i64.const 729618461987467893) ) - (i64.const 729618461987467893) ) - ) - (br_if $label$2 - (i32.const 2049535349) - (f32.eq - (f32.demote_f64 - (f64.mul - (br_if $label$0 ;; this br is optimized, and br *and* values reused - (f64.const 6.134856208230095e-154) - (i32.const 690910817) + (br_if $label$2 + (i32.const 2049535349) + (f32.eq + (f32.demote_f64 + (f64.mul + (br_if $label$0 ;; this br is optimized, and br *and* values reused + (f64.const 6.134856208230095e-154) + (i32.const 690910817) + ) + (f64.const 1.515470884183969e-152) ) - (f64.const 1.515470884183969e-152) ) + (f32.const 66524025679377434935296) ) - (f32.const 66524025679377434935296) ) ) ) - (i32.load offset=3 align=2 - (i32.const 169901344) + (else + (i32.load offset=3 align=2 + (i32.const 169901344) + ) ) ) ) diff --git a/test/passes/print-call-graph.txt b/test/passes/print-call-graph.txt index 42a640aa3..b6ec339b7 100644 --- a/test/passes/print-call-graph.txt +++ b/test/passes/print-call-graph.txt @@ -225,7 +225,7 @@ digraph call { (i32.eqz (global.get $__THREW__) ) - (block + (then (global.set $__THREW__ (local.get $0) ) @@ -404,7 +404,7 @@ digraph call { (i32.load (i32.const 1140) ) - (block (result i32) + (then (call $_pthread_cleanup_push (i32.const 1) (local.get $0) @@ -436,7 +436,7 @@ digraph call { ) (local.get $3) ) - (block (result i32) + (else (i32.store (local.get $8) (i32.load @@ -484,7 +484,7 @@ digraph call { ) ) ) - (block (result i32) + (then (i32.store (local.get $6) (local.tee $3 @@ -519,34 +519,36 @@ digraph call { (local.get $1) ) ) - (if (result i32) - (i32.eq - (local.get $5) - (i32.const 2) - ) - (block (result i32) - (i32.store - (local.get $6) - (i32.add - (i32.load - (local.get $6) + (else + (if (result i32) + (i32.eq + (local.get $5) + (i32.const 2) + ) + (then + (i32.store + (local.get $6) + (i32.add + (i32.load + (local.get $6) + ) + (local.get $4) ) - (local.get $4) ) + (local.set $3 + (local.get $1) + ) + (local.set $5 + (i32.const 2) + ) + (local.get $12) ) - (local.set $3 - (local.get $1) - ) - (local.set $5 - (i32.const 2) - ) - (local.get $12) - ) - (block (result i32) - (local.set $3 - (local.get $1) + (else + (local.set $3 + (local.get $1) + ) + (local.get $12) ) - (local.get $12) ) ) ) @@ -693,15 +695,17 @@ digraph call { ) (i32.const 0) ) - (block (result i32) + (then (i32.store (local.get $0) (i32.const -1) ) (i32.const -1) ) - (i32.load - (local.get $0) + (else + (i32.load + (local.get $0) + ) ) ) ) @@ -716,7 +720,7 @@ digraph call { (local.get $0) (i32.const -4096) ) - (block (result i32) + (then (i32.store (call $___errno_location) (i32.sub @@ -726,7 +730,9 @@ digraph call { ) (i32.const -1) ) - (local.get $0) + (else + (local.get $0) + ) ) ) (func $___errno_location (result i32) @@ -734,10 +740,14 @@ digraph call { (i32.load (i32.const 1140) ) - (i32.load offset=64 - (call $_pthread_self) + (then + (i32.load offset=64 + (call $_pthread_self) + ) + ) + (else + (i32.const 1184) ) - (i32.const 1184) ) ) (func $_cleanup_387 (param $0 i32) @@ -747,8 +757,10 @@ digraph call { (local.get $0) ) ) - (call $_free - (local.get $0) + (then + (call $_free + (local.get $0) + ) ) ) ) @@ -787,7 +799,7 @@ digraph call { (i32.const 64) ) ) - (block + (then (i32.store (local.get $3) (i32.load offset=60 @@ -807,9 +819,11 @@ digraph call { (i32.const 54) (local.get $3) ) - (i32.store8 offset=75 - (local.get $0) - (i32.const -1) + (then + (i32.store8 offset=75 + (local.get $0) + (i32.const -1) + ) ) ) ) @@ -832,7 +846,7 @@ digraph call { (block $do-once (result i32) (if (result i32) (local.get $0) - (block (result i32) + (then (if (i32.le_s (i32.load offset=76 @@ -840,9 +854,11 @@ digraph call { ) (i32.const -1) ) - (br $do-once - (call $___fflush_unlocked - (local.get $0) + (then + (br $do-once + (call $___fflush_unlocked + (local.get $0) + ) ) ) ) @@ -860,8 +876,10 @@ digraph call { ) (if (result i32) (local.get $2) - (local.get $1) - (block (result i32) + (then + (local.get $1) + ) + (else (call $_free (local.get $0) ) @@ -869,18 +887,22 @@ digraph call { ) ) ) - (block (result i32) + (else (local.set $0 (if (result i32) (i32.load (i32.const 1136) ) - (call $_fflush - (i32.load - (i32.const 1136) + (then + (call $_fflush + (i32.load + (i32.const 1136) + ) ) ) - (i32.const 0) + (else + (i32.const 0) + ) ) ) (call $___lock @@ -892,50 +914,62 @@ digraph call { (i32.const 1164) ) ) - (loop $while-in - (local.set $2 - (if (result i32) - (i32.gt_s - (i32.load offset=76 - (local.get $1) + (then + (loop $while-in + (local.set $2 + (if (result i32) + (i32.gt_s + (i32.load offset=76 + (local.get $1) + ) + (i32.const -1) + ) + (then + (call $_malloc + (local.get $1) + ) + ) + (else + (i32.const 0) ) - (i32.const -1) - ) - (call $_malloc - (local.get $1) ) - (i32.const 0) ) - ) - (local.set $0 - (if (result i32) - (i32.gt_u - (i32.load offset=20 - (local.get $1) + (local.set $0 + (if (result i32) + (i32.gt_u + (i32.load offset=20 + (local.get $1) + ) + (i32.load offset=28 + (local.get $1) + ) ) - (i32.load offset=28 - (local.get $1) + (then + (i32.or + (call $___fflush_unlocked + (local.get $1) + ) + (local.get $0) + ) + ) + (else + (local.get $0) ) ) - (i32.or - (call $___fflush_unlocked + ) + (if + (local.get $2) + (then + (call $_free (local.get $1) ) - (local.get $0) ) - (local.get $0) - ) - ) - (if - (local.get $2) - (call $_free - (local.get $1) ) - ) - (br_if $while-in - (local.tee $1 - (i32.load offset=56 - (local.get $1) + (br_if $while-in + (local.tee $1 + (i32.load offset=56 + (local.get $1) + ) ) ) ) @@ -1026,22 +1060,24 @@ digraph call { ) ) ) - (drop - (call_indirect (type $FUNCSIG$iiii) - (local.get $0) - (i32.sub - (local.get $4) - (local.get $6) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load offset=40 - (local.get $0) + (then + (drop + (call_indirect (type $FUNCSIG$iiii) + (local.get $0) + (i32.sub + (local.get $4) + (local.get $6) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load offset=40 + (local.get $0) + ) + (i32.const 3) ) - (i32.const 3) + (i32.const 2) ) - (i32.const 2) ) ) ) @@ -1091,7 +1127,7 @@ digraph call { (local.tee $0 (call $__ZSt15get_new_handlerv) ) - (block + (then (call_indirect (type $FUNCSIG$v) (i32.add (i32.and @@ -1103,8 +1139,10 @@ digraph call { ) (br $while-in) ) - (local.set $0 - (i32.const 0) + (else + (local.set $0 + (i32.const 0) + ) ) ) ) @@ -1145,7 +1183,7 @@ digraph call { (local.get $2) (i32.const 20) ) - (block + (then (local.set $5 (i32.or (i32.or @@ -1185,7 +1223,7 @@ digraph call { (i32.const 3) ) ) - (block + (then (local.set $3 (i32.sub (i32.add @@ -1201,7 +1239,7 @@ digraph call { (local.get $0) (local.get $3) ) - (block + (then (i32.store8 (local.get $0) (local.get $1) @@ -1224,7 +1262,7 @@ digraph call { (local.get $0) (local.get $6) ) - (block + (then (i32.store (local.get $0) (local.get $5) @@ -1247,7 +1285,7 @@ digraph call { (local.get $0) (local.get $4) ) - (block + (then (i32.store8 (local.get $0) (local.get $1) @@ -1274,11 +1312,13 @@ digraph call { (local.get $2) (i32.const 4096) ) - (return - (call $_emscripten_memcpy_big - (local.get $0) - (local.get $1) - (local.get $2) + (then + (return + (call $_emscripten_memcpy_big + (local.get $0) + (local.get $1) + (local.get $2) + ) ) ) ) @@ -1296,7 +1336,7 @@ digraph call { (i32.const 3) ) ) - (block + (then (loop $while-in (block $while-out (br_if $while-out @@ -1311,8 +1351,10 @@ digraph call { (i32.eqz (local.get $2) ) - (return - (local.get $3) + (then + (return + (local.get $3) + ) ) ) (i32.store8 @@ -1348,7 +1390,7 @@ digraph call { (local.get $2) (i32.const 4) ) - (block + (then (i32.store (local.get $0) (i32.load @@ -1385,7 +1427,7 @@ digraph call { (local.get $2) (i32.const 0) ) - (block + (then (i32.store8 (local.get $0) (i32.load8_s diff --git a/test/passes/print-call-graph.wast b/test/passes/print-call-graph.wast index b1bb60011..9d6371b4b 100644 --- a/test/passes/print-call-graph.wast +++ b/test/passes/print-call-graph.wast @@ -110,12 +110,14 @@ (i32.eqz (global.get $__THREW__) ) - (block - (global.set $__THREW__ - (local.get $0) - ) - (global.set $threwValue - (local.get $1) + (then + (block + (global.set $__THREW__ + (local.get $0) + ) + (global.set $threwValue + (local.get $1) + ) ) ) ) @@ -289,57 +291,61 @@ (i32.load (i32.const 1140) ) - (block (result i32) - (call $_pthread_cleanup_push - (i32.const 1) - (local.get $0) - ) - (i32.store - (local.get $9) - (i32.load - (local.get $13) + (then + (block (result i32) + (call $_pthread_cleanup_push + (i32.const 1) + (local.get $0) ) - ) - (i32.store offset=4 - (local.get $9) - (local.get $1) - ) - (i32.store offset=8 - (local.get $9) - (local.get $5) - ) - (local.set $3 - (call $___syscall_ret - (call $___syscall146 - (i32.const 146) - (local.get $9) + (i32.store + (local.get $9) + (i32.load + (local.get $13) ) ) + (i32.store offset=4 + (local.get $9) + (local.get $1) + ) + (i32.store offset=8 + (local.get $9) + (local.get $5) + ) + (local.set $3 + (call $___syscall_ret + (call $___syscall146 + (i32.const 146) + (local.get $9) + ) + ) + ) + (call $_pthread_cleanup_pop + (i32.const 0) + ) + (local.get $3) ) - (call $_pthread_cleanup_pop - (i32.const 0) - ) - (local.get $3) ) - (block (result i32) - (i32.store - (local.get $8) - (i32.load - (local.get $13) + (else + (block (result i32) + (i32.store + (local.get $8) + (i32.load + (local.get $13) + ) ) - ) - (i32.store offset=4 - (local.get $8) - (local.get $1) - ) - (i32.store offset=8 - (local.get $8) - (local.get $5) - ) - (call $___syscall_ret - (call $___syscall146 - (i32.const 146) + (i32.store offset=4 + (local.get $8) + (local.get $1) + ) + (i32.store offset=8 (local.get $8) + (local.get $5) + ) + (call $___syscall_ret + (call $___syscall146 + (i32.const 146) + (local.get $8) + ) ) ) ) @@ -369,69 +375,77 @@ ) ) ) - (block (result i32) - (i32.store - (local.get $6) - (local.tee $3 - (i32.load - (local.get $14) - ) - ) - ) - (i32.store - (local.get $10) - (local.get $3) - ) - (local.set $4 - (i32.sub - (local.get $4) - (local.get $12) - ) - ) - (local.set $3 - (i32.add - (local.get $1) - (i32.const 8) - ) - ) - (local.set $5 - (i32.add - (local.get $5) - (i32.const -1) - ) - ) - (i32.load offset=12 - (local.get $1) - ) - ) - (if (result i32) - (i32.eq - (local.get $5) - (i32.const 2) - ) + (then (block (result i32) (i32.store (local.get $6) - (i32.add + (local.tee $3 (i32.load - (local.get $6) + (local.get $14) ) + ) + ) + (i32.store + (local.get $10) + (local.get $3) + ) + (local.set $4 + (i32.sub (local.get $4) + (local.get $12) ) ) (local.set $3 - (local.get $1) + (i32.add + (local.get $1) + (i32.const 8) + ) ) (local.set $5 - (i32.const 2) + (i32.add + (local.get $5) + (i32.const -1) + ) ) - (local.get $12) - ) - (block (result i32) - (local.set $3 + (i32.load offset=12 (local.get $1) ) - (local.get $12) + ) + ) + (else + (if (result i32) + (i32.eq + (local.get $5) + (i32.const 2) + ) + (then + (block (result i32) + (i32.store + (local.get $6) + (i32.add + (i32.load + (local.get $6) + ) + (local.get $4) + ) + ) + (local.set $3 + (local.get $1) + ) + (local.set $5 + (i32.const 2) + ) + (local.get $12) + ) + ) + (else + (block (result i32) + (local.set $3 + (local.get $1) + ) + (local.get $12) + ) + ) ) ) ) @@ -578,15 +592,19 @@ ) (i32.const 0) ) - (block (result i32) - (i32.store - (local.get $0) + (then + (block (result i32) + (i32.store + (local.get $0) + (i32.const -1) + ) (i32.const -1) ) - (i32.const -1) ) - (i32.load - (local.get $0) + (else + (i32.load + (local.get $0) + ) ) ) ) @@ -601,17 +619,21 @@ (local.get $0) (i32.const -4096) ) - (block (result i32) - (i32.store - (call $___errno_location) - (i32.sub - (i32.const 0) - (local.get $0) + (then + (block (result i32) + (i32.store + (call $___errno_location) + (i32.sub + (i32.const 0) + (local.get $0) + ) ) + (i32.const -1) ) - (i32.const -1) ) - (local.get $0) + (else + (local.get $0) + ) ) ) (func $___errno_location (result i32) @@ -619,10 +641,14 @@ (i32.load (i32.const 1140) ) - (i32.load offset=64 - (call $_pthread_self) + (then + (i32.load offset=64 + (call $_pthread_self) + ) + ) + (else + (i32.const 1184) ) - (i32.const 1184) ) ) (func $_cleanup_387 (param $0 i32) @@ -632,8 +658,10 @@ (local.get $0) ) ) - (call $_free - (local.get $0) + (then + (call $_free + (local.get $0) + ) ) ) ) @@ -672,29 +700,33 @@ (i32.const 64) ) ) - (block - (i32.store - (local.get $3) - (i32.load offset=60 - (local.get $0) + (then + (block + (i32.store + (local.get $3) + (i32.load offset=60 + (local.get $0) + ) ) - ) - (i32.store offset=4 - (local.get $3) - (i32.const 21505) - ) - (i32.store offset=8 - (local.get $3) - (local.get $5) - ) - (if - (call $___syscall54 - (i32.const 54) + (i32.store offset=4 (local.get $3) + (i32.const 21505) ) - (i32.store8 offset=75 - (local.get $0) - (i32.const -1) + (i32.store offset=8 + (local.get $3) + (local.get $5) + ) + (if + (call $___syscall54 + (i32.const 54) + (local.get $3) + ) + (then + (i32.store8 offset=75 + (local.get $0) + (i32.const -1) + ) + ) ) ) ) @@ -717,119 +749,145 @@ (block $do-once (result i32) (if (result i32) (local.get $0) - (block (result i32) - (if - (i32.le_s - (i32.load offset=76 - (local.get $0) + (then + (block (result i32) + (if + (i32.le_s + (i32.load offset=76 + (local.get $0) + ) + (i32.const -1) ) - (i32.const -1) - ) - (br $do-once - (call $___fflush_unlocked - (local.get $0) + (then + (br $do-once + (call $___fflush_unlocked + (local.get $0) + ) + ) ) ) - ) - (local.set $2 - (i32.eqz - (call $_malloc - (local.get $0) + (local.set $2 + (i32.eqz + (call $_malloc + (local.get $0) + ) ) ) - ) - (local.set $1 - (call $___fflush_unlocked - (local.get $0) - ) - ) - (if (result i32) - (local.get $2) - (local.get $1) - (block (result i32) - (call $_free + (local.set $1 + (call $___fflush_unlocked (local.get $0) ) - (local.get $1) ) - ) - ) - (block (result i32) - (local.set $0 (if (result i32) - (i32.load - (i32.const 1136) + (local.get $2) + (then + (local.get $1) ) - (call $_fflush - (i32.load - (i32.const 1136) + (else + (block (result i32) + (call $_free + (local.get $0) + ) + (local.get $1) ) ) - (i32.const 0) ) ) - (call $___lock - (i32.const 1168) - ) - (if - (local.tee $1 - (i32.load - (i32.const 1164) - ) - ) - (loop $while-in - (local.set $2 - (if (result i32) - (i32.gt_s - (i32.load offset=76 - (local.get $1) + ) + (else + (block (result i32) + (local.set $0 + (if (result i32) + (i32.load + (i32.const 1136) + ) + (then + (call $_fflush + (i32.load + (i32.const 1136) ) - (i32.const -1) - ) - (call $_malloc - (local.get $1) ) + ) + (else (i32.const 0) ) ) - (local.set $0 - (if (result i32) - (i32.gt_u - (i32.load offset=20 - (local.get $1) + ) + (call $___lock + (i32.const 1168) + ) + (if + (local.tee $1 + (i32.load + (i32.const 1164) + ) + ) + (then + (loop $while-in + (local.set $2 + (if (result i32) + (i32.gt_s + (i32.load offset=76 + (local.get $1) + ) + (i32.const -1) + ) + (then + (call $_malloc + (local.get $1) + ) + ) + (else + (i32.const 0) + ) ) - (i32.load offset=28 - (local.get $1) + ) + (local.set $0 + (if (result i32) + (i32.gt_u + (i32.load offset=20 + (local.get $1) + ) + (i32.load offset=28 + (local.get $1) + ) + ) + (then + (i32.or + (call $___fflush_unlocked + (local.get $1) + ) + (local.get $0) + ) + ) + (else + (local.get $0) + ) ) ) - (i32.or - (call $___fflush_unlocked - (local.get $1) + (if + (local.get $2) + (then + (call $_free + (local.get $1) + ) ) - (local.get $0) ) - (local.get $0) - ) - ) - (if - (local.get $2) - (call $_free - (local.get $1) - ) - ) - (br_if $while-in - (local.tee $1 - (i32.load offset=56 - (local.get $1) + (br_if $while-in + (local.tee $1 + (i32.load offset=56 + (local.get $1) + ) + ) ) ) ) ) + (call $___unlock + (i32.const 1168) + ) + (local.get $0) ) - (call $___unlock - (i32.const 1168) - ) - (local.get $0) ) ) ) @@ -911,22 +969,24 @@ ) ) ) - (drop - (call_indirect (type $FUNCSIG$iiii) - (local.get $0) - (i32.sub - (local.get $4) - (local.get $6) - ) - (i32.const 1) - (i32.add - (i32.and - (i32.load offset=40 - (local.get $0) + (then + (drop + (call_indirect (type $FUNCSIG$iiii) + (local.get $0) + (i32.sub + (local.get $4) + (local.get $6) + ) + (i32.const 1) + (i32.add + (i32.and + (i32.load offset=40 + (local.get $0) + ) + (i32.const 3) ) - (i32.const 3) + (i32.const 2) ) - (i32.const 2) ) ) ) @@ -976,20 +1036,24 @@ (local.tee $0 (call $__ZSt15get_new_handlerv) ) - (block - (call_indirect (type $FUNCSIG$v) - (i32.add - (i32.and - (local.get $0) - (i32.const 0) + (then + (block + (call_indirect (type $FUNCSIG$v) + (i32.add + (i32.and + (local.get $0) + (i32.const 0) + ) + (i32.const 8) ) - (i32.const 8) ) + (br $while-in) ) - (br $while-in) ) - (local.set $0 - (i32.const 0) + (else + (local.set $0 + (i32.const 0) + ) ) ) ) @@ -1030,97 +1094,105 @@ (local.get $2) (i32.const 20) ) - (block - (local.set $5 - (i32.or + (then + (block + (local.set $5 (i32.or (i32.or - (local.tee $1 - (i32.and + (i32.or + (local.tee $1 + (i32.and + (local.get $1) + (i32.const 255) + ) + ) + (i32.shl (local.get $1) - (i32.const 255) + (i32.const 8) ) ) (i32.shl (local.get $1) - (i32.const 8) + (i32.const 16) ) ) (i32.shl (local.get $1) - (i32.const 16) + (i32.const 24) ) ) - (i32.shl - (local.get $1) - (i32.const 24) - ) ) - ) - (local.set $6 - (i32.and - (local.get $4) - (i32.const -4) - ) - ) - (if - (local.tee $3 + (local.set $6 (i32.and - (local.get $0) - (i32.const 3) + (local.get $4) + (i32.const -4) ) ) - (block - (local.set $3 - (i32.sub - (i32.add - (local.get $0) - (i32.const 4) - ) - (local.get $3) + (if + (local.tee $3 + (i32.and + (local.get $0) + (i32.const 3) ) ) - (loop $while-in - (if - (i32.lt_s - (local.get $0) - (local.get $3) - ) - (block - (i32.store8 - (local.get $0) - (local.get $1) - ) - (local.set $0 + (then + (block + (local.set $3 + (i32.sub (i32.add (local.get $0) - (i32.const 1) + (i32.const 4) + ) + (local.get $3) + ) + ) + (loop $while-in + (if + (i32.lt_s + (local.get $0) + (local.get $3) + ) + (then + (block + (i32.store8 + (local.get $0) + (local.get $1) + ) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 1) + ) + ) + (br $while-in) + ) ) ) - (br $while-in) ) ) ) ) - ) - (loop $while-in1 - (if - (i32.lt_s - (local.get $0) - (local.get $6) - ) - (block - (i32.store + (loop $while-in1 + (if + (i32.lt_s (local.get $0) - (local.get $5) + (local.get $6) ) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 4) + (then + (block + (i32.store + (local.get $0) + (local.get $5) + ) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 4) + ) + ) + (br $while-in1) ) ) - (br $while-in1) ) ) ) @@ -1132,18 +1204,20 @@ (local.get $0) (local.get $4) ) - (block - (i32.store8 - (local.get $0) - (local.get $1) - ) - (local.set $0 - (i32.add + (then + (block + (i32.store8 (local.get $0) - (i32.const 1) + (local.get $1) ) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 1) + ) + ) + (br $while-in3) ) - (br $while-in3) ) ) ) @@ -1159,11 +1233,13 @@ (local.get $2) (i32.const 4096) ) - (return - (call $_emscripten_memcpy_big - (local.get $0) - (local.get $1) - (local.get $2) + (then + (return + (call $_emscripten_memcpy_big + (local.get $0) + (local.get $1) + (local.get $2) + ) ) ) ) @@ -1181,84 +1257,90 @@ (i32.const 3) ) ) - (block - (loop $while-in - (block $while-out - (br_if $while-out - (i32.eqz - (i32.and - (local.get $0) - (i32.const 3) + (then + (block + (loop $while-in + (block $while-out + (br_if $while-out + (i32.eqz + (i32.and + (local.get $0) + (i32.const 3) + ) ) ) - ) - (if - (i32.eqz - (local.get $2) - ) - (return - (local.get $3) - ) - ) - (i32.store8 - (local.get $0) - (i32.load8_s - (local.get $1) - ) - ) - (local.set $0 - (i32.add - (local.get $0) - (i32.const 1) - ) - ) - (local.set $1 - (i32.add - (local.get $1) - (i32.const 1) - ) - ) - (local.set $2 - (i32.sub - (local.get $2) - (i32.const 1) + (if + (i32.eqz + (local.get $2) + ) + (then + (return + (local.get $3) + ) + ) ) - ) - (br $while-in) - ) - ) - (loop $while-in1 - (if - (i32.ge_s - (local.get $2) - (i32.const 4) - ) - (block - (i32.store + (i32.store8 (local.get $0) - (i32.load + (i32.load8_s (local.get $1) ) ) (local.set $0 (i32.add (local.get $0) - (i32.const 4) + (i32.const 1) ) ) (local.set $1 (i32.add (local.get $1) - (i32.const 4) + (i32.const 1) ) ) (local.set $2 (i32.sub (local.get $2) - (i32.const 4) + (i32.const 1) + ) + ) + (br $while-in) + ) + ) + (loop $while-in1 + (if + (i32.ge_s + (local.get $2) + (i32.const 4) + ) + (then + (block + (i32.store + (local.get $0) + (i32.load + (local.get $1) + ) + ) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 4) + ) + ) + (local.set $1 + (i32.add + (local.get $1) + (i32.const 4) + ) + ) + (local.set $2 + (i32.sub + (local.get $2) + (i32.const 4) + ) + ) + (br $while-in1) ) ) - (br $while-in1) ) ) ) @@ -1270,32 +1352,34 @@ (local.get $2) (i32.const 0) ) - (block - (i32.store8 - (local.get $0) - (i32.load8_s - (local.get $1) - ) - ) - (local.set $0 - (i32.add + (then + (block + (i32.store8 (local.get $0) - (i32.const 1) + (i32.load8_s + (local.get $1) + ) ) - ) - (local.set $1 - (i32.add - (local.get $1) - (i32.const 1) + (local.set $0 + (i32.add + (local.get $0) + (i32.const 1) + ) ) - ) - (local.set $2 - (i32.sub - (local.get $2) - (i32.const 1) + (local.set $1 + (i32.add + (local.get $1) + (i32.const 1) + ) + ) + (local.set $2 + (i32.sub + (local.get $2) + (i32.const 1) + ) ) + (br $while-in3) ) - (br $while-in3) ) ) ) diff --git a/test/passes/print.bin.txt b/test/passes/print.bin.txt index ed16d9e21..25b2cc387 100644 --- a/test/passes/print.bin.txt +++ b/test/passes/print.bin.txt @@ -26,31 +26,33 @@ ) (i32.const 55) ) - (loop $label$2 - (br_if $label$2 - (i32.ne - (i32.rem_s - (local.tee $0 - (i32.add + (then + (loop $label$2 + (br_if $label$2 + (i32.ne + (i32.rem_s + (local.tee $0 (i32.add - (i32.mul + (i32.add (i32.mul + (i32.mul + (local.get $0) + (local.get $0) + ) (local.get $0) + ) + (i32.div_s (local.get $0) + (i32.const -2) ) - (local.get $0) - ) - (i32.div_s - (local.get $0) - (i32.const -2) ) + (i32.const 13) ) - (i32.const 13) ) + (i32.const 120) ) - (i32.const 120) + (i32.const 55) ) - (i32.const 55) ) ) ) @@ -117,31 +119,33 @@ ) (i32.const 55) ) - (loop $label$2 - (br_if $label$2 - (i32.ne - (i32.rem_s - (local.tee $0 - (i32.add + (then + (loop $label$2 + (br_if $label$2 + (i32.ne + (i32.rem_s + (local.tee $0 (i32.add - (i32.mul + (i32.add (i32.mul + (i32.mul + (local.get $0) + (local.get $0) + ) (local.get $0) + ) + (i32.div_s (local.get $0) + (i32.const -2) ) - (local.get $0) - ) - (i32.div_s - (local.get $0) - (i32.const -2) ) + (i32.const 13) ) - (i32.const 13) ) + (i32.const 120) ) - (i32.const 120) + (i32.const 55) ) - (i32.const 55) ) ) ) diff --git a/test/passes/print_g.bin.txt b/test/passes/print_g.bin.txt index 21f31a831..174230388 100644 --- a/test/passes/print_g.bin.txt +++ b/test/passes/print_g.bin.txt @@ -33,49 +33,51 @@ ;; code offset: 0xd (i32.const 55) ) - ;; code offset: 0x12 - (loop $label$2 - ;; code offset: 0x2e - (br_if $label$2 - ;; code offset: 0x2d - (i32.ne - ;; code offset: 0x2a - (i32.rem_s - ;; code offset: 0x25 - (local.tee $0 - ;; code offset: 0x24 - (i32.add - ;; code offset: 0x21 + (then + ;; code offset: 0x12 + (loop $label$2 + ;; code offset: 0x2e + (br_if $label$2 + ;; code offset: 0x2d + (i32.ne + ;; code offset: 0x2a + (i32.rem_s + ;; code offset: 0x25 + (local.tee $0 + ;; code offset: 0x24 (i32.add - ;; code offset: 0x1b - (i32.mul - ;; code offset: 0x18 + ;; code offset: 0x21 + (i32.add + ;; code offset: 0x1b (i32.mul - ;; code offset: 0x14 + ;; code offset: 0x18 + (i32.mul + ;; code offset: 0x14 + (local.get $0) + ;; code offset: 0x16 + (local.get $0) + ) + ;; code offset: 0x19 (local.get $0) - ;; code offset: 0x16 + ) + ;; code offset: 0x20 + (i32.div_s + ;; code offset: 0x1c (local.get $0) + ;; code offset: 0x1e + (i32.const -2) ) - ;; code offset: 0x19 - (local.get $0) - ) - ;; code offset: 0x20 - (i32.div_s - ;; code offset: 0x1c - (local.get $0) - ;; code offset: 0x1e - (i32.const -2) ) + ;; code offset: 0x22 + (i32.const 13) ) - ;; code offset: 0x22 - (i32.const 13) ) + ;; code offset: 0x27 + (i32.const 120) ) - ;; code offset: 0x27 - (i32.const 120) + ;; code offset: 0x2b + (i32.const 55) ) - ;; code offset: 0x2b - (i32.const 55) ) ) ) @@ -163,49 +165,51 @@ ;; code offset: 0xd (i32.const 55) ) - ;; code offset: 0x12 - (loop $label$2 - ;; code offset: 0x2e - (br_if $label$2 - ;; code offset: 0x2d - (i32.ne - ;; code offset: 0x2a - (i32.rem_s - ;; code offset: 0x25 - (local.tee $0 - ;; code offset: 0x24 - (i32.add - ;; code offset: 0x21 + (then + ;; code offset: 0x12 + (loop $label$2 + ;; code offset: 0x2e + (br_if $label$2 + ;; code offset: 0x2d + (i32.ne + ;; code offset: 0x2a + (i32.rem_s + ;; code offset: 0x25 + (local.tee $0 + ;; code offset: 0x24 (i32.add - ;; code offset: 0x1b - (i32.mul - ;; code offset: 0x18 + ;; code offset: 0x21 + (i32.add + ;; code offset: 0x1b (i32.mul - ;; code offset: 0x14 + ;; code offset: 0x18 + (i32.mul + ;; code offset: 0x14 + (local.get $0) + ;; code offset: 0x16 + (local.get $0) + ) + ;; code offset: 0x19 (local.get $0) - ;; code offset: 0x16 + ) + ;; code offset: 0x20 + (i32.div_s + ;; code offset: 0x1c (local.get $0) + ;; code offset: 0x1e + (i32.const -2) ) - ;; code offset: 0x19 - (local.get $0) - ) - ;; code offset: 0x20 - (i32.div_s - ;; code offset: 0x1c - (local.get $0) - ;; code offset: 0x1e - (i32.const -2) ) + ;; code offset: 0x22 + (i32.const 13) ) - ;; code offset: 0x22 - (i32.const 13) ) + ;; code offset: 0x27 + (i32.const 120) ) - ;; code offset: 0x27 - (i32.const 120) + ;; code offset: 0x2b + (i32.const 55) ) - ;; code offset: 0x2b - (i32.const 55) ) ) ) diff --git a/test/passes/print_g_metrics.bin.txt b/test/passes/print_g_metrics.bin.txt index 4fd8a953b..e5ac1edae 100644 --- a/test/passes/print_g_metrics.bin.txt +++ b/test/passes/print_g_metrics.bin.txt @@ -29,31 +29,33 @@ ) (i32.const 55) ) - (loop $label$2 - (br_if $label$2 - (i32.ne - (i32.rem_s - (local.tee $0 - (i32.add + (then + (loop $label$2 + (br_if $label$2 + (i32.ne + (i32.rem_s + (local.tee $0 (i32.add - (i32.mul + (i32.add (i32.mul + (i32.mul + (local.get $0) + (local.get $0) + ) (local.get $0) + ) + (i32.div_s (local.get $0) + (i32.const -2) ) - (local.get $0) - ) - (i32.div_s - (local.get $0) - (i32.const -2) ) + (i32.const 13) ) - (i32.const 13) ) + (i32.const 120) ) - (i32.const 120) + (i32.const 55) ) - (i32.const 55) ) ) ) @@ -116,31 +118,33 @@ total ) (i32.const 55) ) - (loop $label$2 - (br_if $label$2 - (i32.ne - (i32.rem_s - (local.tee $0 - (i32.add + (then + (loop $label$2 + (br_if $label$2 + (i32.ne + (i32.rem_s + (local.tee $0 (i32.add - (i32.mul + (i32.add (i32.mul + (i32.mul + (local.get $0) + (local.get $0) + ) (local.get $0) + ) + (i32.div_s (local.get $0) + (i32.const -2) ) - (local.get $0) - ) - (i32.div_s - (local.get $0) - (i32.const -2) ) + (i32.const 13) ) - (i32.const 13) ) + (i32.const 120) ) - (i32.const 120) + (i32.const 55) ) - (i32.const 55) ) ) ) diff --git a/test/passes/print_g_strip-dwarf.bin.txt b/test/passes/print_g_strip-dwarf.bin.txt index 6c31defb2..967e03f3d 100644 --- a/test/passes/print_g_strip-dwarf.bin.txt +++ b/test/passes/print_g_strip-dwarf.bin.txt @@ -26,31 +26,33 @@ ) (i32.const 55) ) - (loop $label$2 - (br_if $label$2 - (i32.ne - (i32.rem_s - (local.tee $0 - (i32.add + (then + (loop $label$2 + (br_if $label$2 + (i32.ne + (i32.rem_s + (local.tee $0 (i32.add - (i32.mul + (i32.add (i32.mul + (i32.mul + (local.get $0) + (local.get $0) + ) (local.get $0) + ) + (i32.div_s (local.get $0) + (i32.const -2) ) - (local.get $0) - ) - (i32.div_s - (local.get $0) - (i32.const -2) ) + (i32.const 13) ) - (i32.const 13) ) + (i32.const 120) ) - (i32.const 120) + (i32.const 55) ) - (i32.const 55) ) ) ) @@ -117,31 +119,33 @@ ) (i32.const 55) ) - (loop $label$2 - (br_if $label$2 - (i32.ne - (i32.rem_s - (local.tee $0 - (i32.add + (then + (loop $label$2 + (br_if $label$2 + (i32.ne + (i32.rem_s + (local.tee $0 (i32.add - (i32.mul + (i32.add (i32.mul + (i32.mul + (local.get $0) + (local.get $0) + ) (local.get $0) + ) + (i32.div_s (local.get $0) + (i32.const -2) ) - (local.get $0) - ) - (i32.div_s - (local.get $0) - (i32.const -2) ) + (i32.const 13) ) - (i32.const 13) ) + (i32.const 120) ) - (i32.const 120) + (i32.const 55) ) - (i32.const 55) ) ) ) diff --git a/test/passes/remove-non-js-ops.txt b/test/passes/remove-non-js-ops.txt index 5ce482d30..a89c7af94 100644 --- a/test/passes/remove-non-js-ops.txt +++ b/test/passes/remove-non-js-ops.txt @@ -379,7 +379,7 @@ ) ) ) - (block + (then (br_if $label$11 (i32.eqz (local.tee $var$3 @@ -673,7 +673,7 @@ (block $label$13 (if (local.get $var$2) - (block + (then (local.set $var$8 (i64.add (local.get $var$1) @@ -764,16 +764,18 @@ (func $__wasm_ctz_i32 (param $var$0 i32) (result i32) (if (local.get $var$0) - (return - (i32.sub - (i32.const 31) - (i32.clz - (i32.xor - (i32.add + (then + (return + (i32.sub + (i32.const 31) + (i32.clz + (i32.xor + (i32.add + (local.get $var$0) + (i32.const -1) + ) (local.get $var$0) - (i32.const -1) ) - (local.get $var$0) ) ) ) @@ -833,7 +835,7 @@ (f32.const 0.5) ) ) - (block + (then (local.set $var$0 (f32.ceil (local.get $var$0) @@ -844,8 +846,10 @@ (local.get $var$2) (f32.const 0.5) ) - (return - (local.get $var$0) + (then + (return + (local.get $var$0) + ) ) ) (local.set $var$1 @@ -891,7 +895,7 @@ (f64.const 0.5) ) ) - (block + (then (local.set $var$0 (f64.ceil (local.get $var$0) @@ -902,8 +906,10 @@ (local.get $var$2) (f64.const 0.5) ) - (return - (local.get $var$0) + (then + (return + (local.get $var$0) + ) ) ) (local.set $var$1 diff --git a/test/passes/remove-unused-brs_enable-multivalue.txt b/test/passes/remove-unused-brs_enable-multivalue.txt index e03ca15a7..2fd56cb9c 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.txt +++ b/test/passes/remove-unused-brs_enable-multivalue.txt @@ -128,25 +128,29 @@ (func $b12-yes (if (i32.const 1) - (block $topmost - (block $block1 - (drop - (i32.const 12) - ) - (block + (then + (block $topmost + (block $block1 (drop - (i32.const 1) + (i32.const 12) + ) + (block + (drop + (i32.const 1) + ) ) ) ) ) - (block $block3 - (drop - (i32.const 27) - ) - (block + (else + (block $block3 (drop - (i32.const 2) + (i32.const 27) + ) + (block + (drop + (i32.const 2) + ) ) ) ) @@ -156,23 +160,27 @@ (block $topmost (result i32) (if (i32.const 1) - (block $block1 - (drop - (i32.const 12) - ) - (drop - (br_if $topmost - (i32.const 1) - (i32.const 1) + (then + (block $block1 + (drop + (i32.const 12) + ) + (drop + (br_if $topmost + (i32.const 1) + (i32.const 1) + ) ) ) ) - (block $block3 - (drop - (i32.const 27) - ) - (br $topmost - (i32.const 2) + (else + (block $block3 + (drop + (i32.const 27) + ) + (br $topmost + (i32.const 2) + ) ) ) ) @@ -195,18 +203,22 @@ (func $b14-tuple (result i32 i64) (if (type $5) (result i32 i64) (i32.const 1) - (block $topmost (type $5) (result i32 i64) - (block $block1 (type $5) (result i32 i64) - (tuple.make 2 - (i32.const 12) - (i64.const 12) + (then + (block $topmost (type $5) (result i32 i64) + (block $block1 (type $5) (result i32 i64) + (tuple.make 2 + (i32.const 12) + (i64.const 12) + ) ) ) ) - (block $block3 (type $5) (result i32 i64) - (tuple.make 2 - (i32.const 27) - (i64.const 27) + (else + (block $block3 (type $5) (result i32 i64) + (tuple.make 2 + (i32.const 27) + (i64.const 27) + ) ) ) ) @@ -221,10 +233,12 @@ (func $b15b (if (i32.const 18) - (block $topmost - (block - (drop - (i32.const 0) + (then + (block $topmost + (block + (drop + (i32.const 0) + ) ) ) ) @@ -253,42 +267,58 @@ (func $b17 (if (i32.const 0) - (block $a - (block $block1 + (then + (block $a + (block $block1 + ) ) ) - (block $block3 + (else + (block $block3 + ) ) ) (if (i32.const 0) - (block $a7 - (drop - (i32.const 1) + (then + (block $a7 + (drop + (i32.const 1) + ) ) ) - (block $block6 + (else + (block $block6 + ) ) ) (if (i32.const 0) - (block $a9 - (block $block8 + (then + (block $a9 + (block $block8 + ) ) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 1) + ) ) ) (if (i32.const 0) - (block $c - (block $b - (block $block11 + (then + (block $c + (block $b + (block $block11 + ) ) ) ) - (block $block13 + (else + (block $block13 + ) ) ) ) @@ -304,9 +334,13 @@ (func $ret-3 (if (i32.const 0) - (block $block0 + (then + (block $block0 + ) ) - (block $block3 + (else + (block $block3 + ) ) ) ) @@ -321,37 +355,45 @@ (block $a (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (block $block2 - (block + (else + (block $block2 + (block + (drop + (i32.const 2) + ) + (br $a) + ) (drop - (i32.const 2) + (i32.const 3) ) - (br $a) - ) - (drop - (i32.const 3) ) ) ) (if (i32.const 0) - (block $block4 - (block + (then + (block $block4 + (block + (drop + (i32.const 2) + ) + (br $a) + ) (drop - (i32.const 2) + (i32.const 3) ) - (br $a) ) + ) + (else (drop - (i32.const 3) + (i32.const 1) ) ) - (drop - (i32.const 1) - ) ) (if (block $block6 (result i32) @@ -363,28 +405,36 @@ ) (i32.const 3) ) - (drop - (i32.const 0) + (then + (drop + (i32.const 0) + ) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 1) + ) ) ) (if (block $a17 (result i32) (i32.const 0) ) - (block $a18 - (block - (drop - (i32.const 1) + (then + (block $a18 + (block + (drop + (i32.const 1) + ) ) ) ) - (block $a20 - (block - (drop - (i32.const 2) + (else + (block $a20 + (block + (drop + (i32.const 2) + ) ) ) ) @@ -396,7 +446,7 @@ (block $do-once$0 (if (call $b13) - (block + (then (drop (i32.const 0) ) @@ -410,7 +460,7 @@ (block $do-once$022 (if (call $b13) - (block + (then (drop (call $b14) ) @@ -424,7 +474,7 @@ (block $do-once$025 (if (i32.const 0) - (block + (then (drop (call $b14) ) @@ -440,9 +490,11 @@ (local.tee $x (i32.const 1) ) - (br $do-once$028 - (local.tee $x - (i32.const 2) + (then + (br $do-once$028 + (local.tee $x + (i32.const 2) + ) ) ) ) @@ -488,10 +540,12 @@ (i32.eqz (i32.const 0) ) - (block $out40 - (nop) - (br_if $in39 - (i32.const 1) + (then + (block $out40 + (nop) + (br_if $in39 + (i32.const 1) + ) ) ) ) @@ -506,29 +560,39 @@ (loop $in45 (if (i32.const 0) - (block $out46 - (unreachable) + (then + (block $out46 + (unreachable) + ) + ) + (else + (br $in45) ) - (br $in45) ) ) (loop $in48 (if (i32.const 0) - (block $out49 - (block - (call $loops) + (then + (block $out49 + (block + (call $loops) + ) ) ) - (br $in48) + (else + (br $in48) + ) ) ) (loop $in-todo (if (i32.const 0) - (block $out-todo + (then + (block $out-todo + ) ) - (block + (else (call $loops) (br $in-todo) ) @@ -537,9 +601,11 @@ (loop $in52 (if (i32.const 0) - (block $out53 + (then + (block $out53 + ) ) - (block + (else (call $loops) (br $in52) ) @@ -548,34 +614,40 @@ (loop $in55 (if (i32.const 0) - (block + (then (call $loops) (br $in55) ) - (block $out56 + (else + (block $out56 + ) ) ) ) (loop $in58 (if (i32.const 0) - (block + (then (drop (i32.const 1) ) (call $loops) (br $in58) ) - (block $out59 + (else + (block $out59 + ) ) ) ) (loop $in62 (if (i32.const 0) - (block $out63 + (then + (block $out63 + ) ) - (block + (else (call $loops) (drop (i32.const 100) @@ -587,21 +659,23 @@ (loop $in65 (if (i32.const 0) - (block + (then (call $loops) (drop (i32.const 101) ) (br $in65) ) - (block $out66 + (else + (block $out66 + ) ) ) ) (loop $in68 (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -611,7 +685,9 @@ ) (br $in68) ) - (block $out69 + (else + (block $out69 + ) ) ) ) @@ -620,11 +696,13 @@ (i32.eqz (i32.const 0) ) - (block $out73 - (nop) - (call $loops) - (return) - (br $in72) + (then + (block $out73 + (nop) + (call $loops) + (return) + (br $in72) + ) ) ) ) @@ -641,9 +719,11 @@ (loop $in78 (if (i32.const 0) - (block $out79 + (then + (block $out79 + ) ) - (block + (else (call $loops) (drop (block $out2 (result i32) @@ -666,9 +746,11 @@ (loop $in-todo2 (if (i32.const 0) - (block $out-todo2 + (then + (block $out-todo2 + ) ) - (block + (else (call $loops) (br $in-todo2) ) @@ -703,9 +785,11 @@ (loop $in-todo287 (if (i32.const 0) - (block $out-todo288 + (then + (block $out-todo288 + ) ) - (block + (else (call $loops) (drop (i32.const 1) @@ -789,16 +873,20 @@ (block $out (result i32) (if (local.get $x) - (br $out - (block (result i32) - (local.set $x - (i32.const 0) + (then + (br $out + (block (result i32) + (local.set $x + (i32.const 0) + ) + (i32.const 1) ) - (i32.const 1) ) ) - (br_if $leave - (i32.const 1) + (else + (br_if $leave + (i32.const 1) + ) ) ) (unreachable) @@ -816,15 +904,19 @@ (block $out (result i32) (if (local.get $x) - (br_if $leave - (i32.const 1) + (then + (br_if $leave + (i32.const 1) + ) ) - (br $out - (block (result i32) - (local.set $x - (i32.const 0) + (else + (br $out + (block (result i32) + (local.set $x + (i32.const 0) + ) + (i32.const 1) ) - (i32.const 1) ) ) ) @@ -843,16 +935,18 @@ (block $out (result i32) (if (local.get $x) - (br $out - (block (result i32) - (drop - (call $if-to-br_if-value-sideeffect - (i32.const 0) - (i32.const 1) + (then + (br $out + (block (result i32) + (drop + (call $if-to-br_if-value-sideeffect + (i32.const 0) + (i32.const 1) + ) ) + (nop) + (i32.const 1) ) - (nop) - (i32.const 1) ) ) ) @@ -874,16 +968,20 @@ (local.get $j) (i32.const 2147483640) ) - (block $x - (block $y - (block $z - (br_if $x - (local.get $j) + (then + (block $x + (block $y + (block $z + (br_if $x + (local.get $j) + ) ) ) ) ) - (block $switch$26 + (else + (block $switch$26 + ) ) ) (i32.store @@ -900,13 +998,15 @@ (i32.eqz (i32.const 0) ) - (block $yes - (nop) - (drop - (i32.const 1) - ) - (drop - (i32.const 2) + (then + (block $yes + (nop) + (drop + (i32.const 1) + ) + (drop + (i32.const 2) + ) ) ) ) @@ -1078,7 +1178,9 @@ ) (if (i32.const 0) - (nop) + (then + (nop) + ) ) ) ) @@ -1087,8 +1189,12 @@ (drop (if (result f64) (unreachable) - (f64.const 1) - (br $label$3) + (then + (f64.const 1) + ) + (else + (br $label$3) + ) ) ) (i64.const 1) @@ -1099,12 +1205,20 @@ (drop (if (result i32) (unreachable) - (if (result i32) - (i32.const 1) - (br $label$39) + (then + (if (result i32) + (i32.const 1) + (then + (br $label$39) + ) + (else + (i32.const 0) + ) + ) + ) + (else (i32.const 0) ) - (i32.const 0) ) ) ) @@ -1114,31 +1228,39 @@ (local $2 f32) (if (result f32) (local.get $0) - (block $label$0 - (block $label$11 - (return - (f32.const 239) - ) - (if - (i32.const 0) + (then + (block $label$0 + (block $label$11 (return - (local.get $2) + (f32.const 239) + ) + (if + (i32.const 0) + (then + (return + (local.get $2) + ) + ) ) ) ) ) - (f32.const -9223372036854775808) + (else + (f32.const -9223372036854775808) + ) ) ) (func $unreachable-return-loop-value (result i64) (loop $loop (if (i32.const 1) - (block $block - (br_if $block + (then + (block $block + (br_if $block + (br $loop) + ) (br $loop) ) - (br $loop) ) ) (br $loop) @@ -1152,11 +1274,13 @@ (loop $label$5 (if (i32.const 11) - (block $label$8 - (br_if $label$8 - (unreachable) + (then + (block $label$8 + (br_if $label$8 + (unreachable) + ) + (br $label$5) ) - (br $label$5) ) ) (br $label$5) @@ -1770,9 +1894,13 @@ (func $tiny-switch (if (i32.const 0) - (block $y + (then + (block $y + ) ) - (block $x + (else + (block $x + ) ) ) (block $z @@ -1946,8 +2074,12 @@ (local.set $x (if (result i32) (local.get $p) - (br $out) - (br $out) + (then + (br $out) + ) + (else + (br $out) + ) ) ) ) @@ -1957,21 +2089,27 @@ (local $var$6 f64) (if (i32.const 0) - (drop - (loop $label$3 (result i64) - (block $label$4 (result i64) - (block $label$5 - (block $label$6 - (local.set $var$1 - (if (result f64) - (unreachable) - (br $label$5) - (f64.const 1) + (then + (drop + (loop $label$3 (result i64) + (block $label$4 (result i64) + (block $label$5 + (block $label$6 + (local.set $var$1 + (if (result f64) + (unreachable) + (then + (br $label$5) + ) + (else + (f64.const 1) + ) + ) ) ) ) + (i64.const 1) ) - (i64.const 1) ) ) ) @@ -1988,15 +2126,23 @@ (func $if-flow-2 (result i32) (if (result i32) (i32.const 0) - (unreachable) - (i32.const 2) + (then + (unreachable) + ) + (else + (i32.const 2) + ) ) ) (func $if-flow-3 (result i32) (if (result i32) (i32.const 0) - (i32.const 1) - (unreachable) + (then + (i32.const 1) + ) + (else + (unreachable) + ) ) ) (func $if-flow-4 (result i32) @@ -2004,11 +2150,15 @@ (return (i32.const 0) ) - (return - (i32.const 1) + (then + (return + (i32.const 1) + ) ) - (return - (i32.const 2) + (else + (return + (i32.const 2) + ) ) ) ) @@ -2023,9 +2173,13 @@ (unreachable) (if (i32.const 0) - (nop) - (return - (i32.const 0) + (then + (nop) + ) + (else + (return + (i32.const 0) + ) ) ) ) @@ -2036,52 +2190,68 @@ (loop $label$1 (if (local.get $0) - (block $label$2 - (local.tee $0 - (loop $label$5 - (br_if $label$5 - (block - (unreachable) - (drop - (i32.const 0) + (then + (block $label$2 + (local.tee $0 + (loop $label$5 + (br_if $label$5 + (block + (unreachable) + (drop + (i32.const 0) + ) ) ) ) ) ) ) - (br $label$1) + (else + (br $label$1) + ) ) ) ) (func $drop-restructure-if (param $x i32) (param $y i32) (result i32) (if (result i32) (local.get $y) - (local.get $x) - (block $label$2 (result i32) - (nop) - (i32.const 0) + (then + (local.get $x) + ) + (else + (block $label$2 (result i32) + (nop) + (i32.const 0) + ) ) ) ) (func $drop-restructure-if-final (param $x i32) (param $y i32) (result i32) (if (result i32) (local.get $y) - (local.get $x) - (block $label$2 (result i32) - (nop) - (unreachable) + (then + (local.get $x) + ) + (else + (block $label$2 (result i32) + (nop) + (unreachable) + ) ) ) ) (func $drop-restructure-if-middle (param $x i32) (param $y i32) (result i32) (if (result i32) (local.get $y) - (local.get $x) - (block $label$2 (result i32) - (nop) - (nop) - (i32.const 0) + (then + (local.get $x) + ) + (else + (block $label$2 (result i32) + (nop) + (nop) + (i32.const 0) + ) ) ) ) @@ -2113,13 +2283,15 @@ (func $if-block (if (i32.const 1) - (block $label - (block - (drop - (i32.const 2) - ) - (drop - (i32.const 3) + (then + (block $label + (block + (drop + (i32.const 2) + ) + (drop + (i32.const 3) + ) ) ) ) @@ -2129,7 +2301,7 @@ (block $label (if (br $label) - (block + (then (drop (i32.const 2) ) @@ -2150,42 +2322,58 @@ (func $if-block-br-1 (if (i32.const 1) - (block $label + (then + (block $label + ) ) - (drop - (i32.const 3) + (else + (drop + (i32.const 3) + ) ) ) ) (func $if-block-br-2 (if (i32.const 1) - (block $label - (drop - (i32.const 3) + (then + (block $label + (drop + (i32.const 3) + ) ) ) - (nop) + (else + (nop) + ) ) ) (func $if-block-br-3 (if (i32.const 1) - (block $label + (then + (block $label + ) + ) + (else + (nop) ) - (nop) ) ) (func $if-block-br-4-eithre (if (i32.const 1) - (block $label - (drop - (i32.const 2) + (then + (block $label + (drop + (i32.const 2) + ) ) ) - (drop - (i32.const 3) + (else + (drop + (i32.const 3) + ) ) ) ) @@ -2206,8 +2394,10 @@ (block $label$4 (unreachable) ) - (block $label$3 - (br $label$3) + (then + (block $label$3 + (br $label$3) + ) ) ) (unreachable) @@ -2218,26 +2408,36 @@ (func $if-arm-unreachable (if (unreachable) - (block $label$1 - (nop) + (then + (block $label$1 + (nop) + ) + ) + (else + (unreachable) ) - (unreachable) ) ) (func $propagate-type-if-we-optimize (if (i32.const 1) - (nop) - (block + (then + (nop) + ) + (else (drop (loop $label$3 (result i64) (br_if $label$3 (if (i32.const 0) - (block $label$4 + (then + (block $label$4 + (unreachable) + ) + ) + (else (unreachable) ) - (unreachable) ) ) (i64.const -9) @@ -2311,14 +2511,20 @@ (loop $label$1 (if (i32.const 0) - (if - (i32.const 0) - (block $label$3 - (block + (then + (if + (i32.const 0) + (then + (block $label$3 + (block + ) + ) + ) + (else + (return + (i32.const -8192) + ) ) - ) - (return - (i32.const -8192) ) ) ) @@ -2400,10 +2606,14 @@ (local.get $0) (i32.const 2) ) - (local.tee $0 - (i32.const 1) + (then + (local.tee $0 + (i32.const 1) + ) + ) + (else + (i32.const 0) ) - (i32.const 0) ) ) (drop @@ -2412,9 +2622,13 @@ (local.get $0) (i32.const 2) ) - (i32.const 0) - (local.tee $0 - (i32.const 1) + (then + (i32.const 0) + ) + (else + (local.tee $0 + (i32.const 1) + ) ) ) ) @@ -2429,8 +2643,12 @@ ) (i32.const 2) ) - (local.get $0) - (i32.const 0) + (then + (local.get $0) + ) + (else + (i32.const 0) + ) ) ) (drop @@ -2441,8 +2659,12 @@ ) (i32.const 2) ) - (i32.const 0) - (local.get $0) + (then + (i32.const 0) + ) + (else + (local.get $0) + ) ) ) (drop @@ -2504,15 +2726,17 @@ (func $ifs-copies-recursive (param $20 i32) (result i32) (if (i32.const 1) - (local.set $20 - (select + (then + (local.set $20 (select - (i32.const 4) + (select + (i32.const 4) + (local.get $20) + (i32.const 3) + ) (local.get $20) - (i32.const 3) + (i32.const 2) ) - (local.get $20) - (i32.const 2) ) ) ) @@ -2538,8 +2762,10 @@ (loop $top (if (i32.const 1) - (local.tee $x - (unreachable) + (then + (local.tee $x + (unreachable) + ) ) ) (br $top) @@ -2552,8 +2778,12 @@ (local.set $x (if (result i32) (i32.const 1) - (unreachable) - (local.get $y) + (then + (unreachable) + ) + (else + (local.get $y) + ) ) ) (br $top) @@ -2600,12 +2830,16 @@ (unreachable) (if (i32.const 0) - (block $A - (return - (i32.const 0) + (then + (block $A + (return + (i32.const 0) + ) ) ) - (nop) + (else + (nop) + ) ) ) (func $do-not-flow-values-through-unreachable-code-b (result i32) @@ -2613,12 +2847,16 @@ (unreachable) (if (i32.const 0) - (block $A - (return - (i32.const 0) + (then + (block $A + (return + (i32.const 0) + ) ) ) - (nop) + (else + (nop) + ) ) ) ) @@ -2658,9 +2896,11 @@ ) (if (i32.const 1026) - (br_if $label$1 - (local.tee $0 - (i32.const -7) + (then + (br_if $label$1 + (local.tee $0 + (i32.const -7) + ) ) ) ) @@ -2686,8 +2926,10 @@ (block (result i32) (if (local.get $x) - (return - (i32.const 5) + (then + (return + (i32.const 5) + ) ) ) (i32.const 6) @@ -2699,8 +2941,12 @@ (select (if (result i32) (unreachable) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) (i32.const 1) (i32.const 2) diff --git a/test/passes/remove-unused-brs_enable-multivalue.wast b/test/passes/remove-unused-brs_enable-multivalue.wast index 493ead96e..0deff0db8 100644 --- a/test/passes/remove-unused-brs_enable-multivalue.wast +++ b/test/passes/remove-unused-brs_enable-multivalue.wast @@ -125,26 +125,30 @@ (block $topmost (if (i32.const 1) - (block $block1 - (drop - (i32.const 12) - ) - (block + (then + (block $block1 (drop - (i32.const 1) + (i32.const 12) + ) + (block + (drop + (i32.const 1) + ) + (br $topmost) ) - (br $topmost) ) ) - (block $block3 - (drop - (i32.const 27) - ) - (block + (else + (block $block3 (drop - (i32.const 2) + (i32.const 27) + ) + (block + (drop + (i32.const 2) + ) + (br $topmost) ) - (br $topmost) ) ) ) @@ -154,23 +158,27 @@ (block $topmost (result i32) (if (i32.const 1) - (block $block1 - (drop - (i32.const 12) - ) - (drop - (br_if $topmost - (i32.const 1) - (i32.const 1) + (then + (block $block1 + (drop + (i32.const 12) + ) + (drop + (br_if $topmost + (i32.const 1) + (i32.const 1) + ) ) ) ) - (block $block3 - (drop - (i32.const 27) - ) - (br $topmost - (i32.const 2) + (else + (block $block3 + (drop + (i32.const 27) + ) + (br $topmost + (i32.const 2) + ) ) ) ) @@ -181,11 +189,15 @@ (block $topmost (result i32) (if (result i32) (i32.const 1) - (block $block1 (result i32) - (i32.const 12) + (then + (block $block1 (result i32) + (i32.const 12) + ) ) - (block $block3 (result i32) - (i32.const 27) + (else + (block $block3 (result i32) + (i32.const 27) + ) ) ) ) @@ -194,16 +206,20 @@ (block $topmost (result i32 i64) (if (result i32 i64) (i32.const 1) - (block $block1 (result i32 i64) - (tuple.make 2 - (i32.const 12) - (i64.const 12) + (then + (block $block1 (result i32 i64) + (tuple.make 2 + (i32.const 12) + (i64.const 12) + ) ) ) - (block $block3 (result i32 i64) - (tuple.make 2 - (i32.const 27) - (i64.const 27) + (else + (block $block3 (result i32 i64) + (tuple.make 2 + (i32.const 27) + (i64.const 27) + ) ) ) ) @@ -213,7 +229,9 @@ (block $topmost (if (i32.const 17) - (br $topmost) + (then + (br $topmost) + ) ) ) ) @@ -221,11 +239,13 @@ (block $topmost (if (i32.const 18) - (block - (drop - (i32.const 0) + (then + (block + (drop + (i32.const 0) + ) + (br $topmost) ) - (br $topmost) ) ) ) @@ -263,33 +283,45 @@ (block $a (if (i32.const 0) - (block $block1 - (br $a) + (then + (block $block1 + (br $a) + ) ) - (block $block3 - (br $a) + (else + (block $block3 + (br $a) + ) ) ) ) (block $a (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (block $block6 - (br $a) + (else + (block $block6 + (br $a) + ) ) ) ) (block $a (if (i32.const 0) - (block $block8 - (br $a) + (then + (block $block8 + (br $a) + ) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 1) + ) ) ) ) @@ -297,11 +329,15 @@ (block $b (if (i32.const 0) - (block $block11 - (br $b) + (then + (block $block11 + (br $b) + ) ) - (block $block13 - (br $c) + (else + (block $block13 + (br $c) + ) ) ) ) @@ -321,10 +357,14 @@ (block $block0 (if (i32.const 0) - (return) - (block $block3 + (then (return) ) + (else + (block $block3 + (return) + ) + ) ) ) ) @@ -341,37 +381,45 @@ (block $a (if (i32.const 0) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (block $block2 - (block + (else + (block $block2 + (block + (drop + (i32.const 2) + ) + (br $a) + ) (drop - (i32.const 2) + (i32.const 3) ) - (br $a) - ) - (drop - (i32.const 3) ) ) ) (if (i32.const 0) - (block $block4 - (block + (then + (block $block4 + (block + (drop + (i32.const 2) + ) + (br $a) + ) (drop - (i32.const 2) + (i32.const 3) ) - (br $a) ) + ) + (else (drop - (i32.const 3) + (i32.const 1) ) ) - (drop - (i32.const 1) - ) ) (if (block $block6 (result i32) @@ -383,11 +431,15 @@ ) (i32.const 3) ) - (drop - (i32.const 0) + (then + (drop + (i32.const 0) + ) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 1) + ) ) ) (if @@ -396,20 +448,24 @@ (i32.const 0) ) ) - (block $a - (block - (drop - (i32.const 1) + (then + (block $a + (block + (drop + (i32.const 1) + ) + (br $a) ) - (br $a) ) ) - (block $a - (block - (drop - (i32.const 2) + (else + (block $a + (block + (drop + (i32.const 2) + ) + (br $a) ) - (br $a) ) ) ) @@ -420,11 +476,13 @@ (block $do-once$0 (if (call $b13) - (block - (drop - (i32.const 0) + (then + (block + (drop + (i32.const 0) + ) + (br $do-once$0) ) - (br $do-once$0) ) ) (drop @@ -434,11 +492,13 @@ (block $do-once$0 (if (call $b13) - (block - (drop - (call $b14) + (then + (block + (drop + (call $b14) + ) + (br $do-once$0) ) - (br $do-once$0) ) ) (drop @@ -448,11 +508,13 @@ (block $do-once$0 (if (i32.const 0) - (block - (drop - (call $b14) + (then + (block + (drop + (call $b14) + ) + (br $do-once$0) ) - (br $do-once$0) ) ) (drop @@ -464,9 +526,11 @@ (local.tee $x (i32.const 1) ) - (br $do-once$0 - (local.tee $x - (i32.const 2) + (then + (br $do-once$0 + (local.tee $x + (i32.const 2) + ) ) ) ) @@ -476,7 +540,7 @@ (func $loops (loop $in (block $out - (if (i32.const 0) (br $out)) + (if (i32.const 0) (then (br $out))) (br $in) ;; we can conditionalize this, and then the br out can vanish ) ) @@ -485,13 +549,13 @@ ) (loop (block $out - (if (i32.const 0) (br $out)) + (if (i32.const 0) (then (br $out))) (br $out) ) ) (loop $in (block $out - (if (i32.const 0) (br $out)) + (if (i32.const 0) (then (br $out))) (br $out) ) ) @@ -501,28 +565,30 @@ ) (loop $in (block $out - (if (i32.const 0) (br $out)) + (if (i32.const 0) (then (br $out))) (br_if $in (i32.const 1)) ) ) (loop $in (block $out - (if (i32.const 0) (br $in)) + (if (i32.const 0) (then (br $in))) (br $out) ) ) (loop $in (block $out - (if (i32.const 0) (unreachable)) + (if (i32.const 0) (then (unreachable))) (br $in) ) ) (loop $in (block $out (if (i32.const 0) - (block - (call $loops) - (br $out) + (then + (block + (call $loops) + (br $out) + ) ) ) (br $in) @@ -530,7 +596,7 @@ ) (loop $in-todo ;; br_if into if (block $out-todo - (if (i32.const 0) (br $out-todo)) + (if (i32.const 0) (then (br $out-todo))) (call $loops) (br $in-todo) ) @@ -538,8 +604,12 @@ (loop $in (block $out (if (i32.const 0) - (br $out) - (call $loops) + (then + (br $out) + ) + (else + (call $loops) + ) ) (br $in) ) @@ -547,8 +617,12 @@ (loop $in (block $out (if (i32.const 0) - (call $loops) - (br $out) + (then + (call $loops) + ) + (else + (br $out) + ) ) (br $in) ) @@ -556,11 +630,15 @@ (loop $in (block $out (if (i32.const 0) - (block - (drop (i32.const 1)) - (call $loops) + (then + (block + (drop (i32.const 1)) + (call $loops) + ) + ) + (else + (br $out) ) - (br $out) ) (br $in) ) @@ -568,8 +646,12 @@ (loop $in (block $out (if (i32.const 0) - (br $out) - (call $loops) + (then + (br $out) + ) + (else + (call $loops) + ) ) (drop (i32.const 100)) (br $in) @@ -578,8 +660,12 @@ (loop $in (block $out (if (i32.const 0) - (call $loops) - (br $out) + (then + (call $loops) + ) + (else + (br $out) + ) ) (drop (i32.const 101)) (br $in) @@ -588,11 +674,15 @@ (loop $in (block $out (if (i32.const 0) - (block - (drop (i32.const 1)) - (call $loops) + (then + (block + (drop (i32.const 1)) + (call $loops) + ) + ) + (else + (br $out) ) - (br $out) ) (drop (i32.const 102)) (br $in) @@ -601,8 +691,12 @@ (loop $in (block $out (if (i32.const 0) - (br $out) - (call $loops) + (then + (br $out) + ) + (else + (call $loops) + ) ) (return) (br $in) @@ -611,8 +705,12 @@ (loop $in (block $out (if (i32.const 0) - (br $out) - (call $loops) + (then + (br $out) + ) + (else + (call $loops) + ) ) (br $out) (br $in) @@ -621,8 +719,12 @@ (loop $in (block $out (if (i32.const 0) - (br $out) - (call $loops) + (then + (br $out) + ) + (else + (call $loops) + ) ) (drop (block $out2 (result i32) @@ -677,14 +779,14 @@ (func $br_if_in_block (result i32) (block $outval (result i32) (block $in - (if (i32.const 1) (br $in) (br $in)) + (if (i32.const 1) (then (br $in) )(else (br $in))) (drop (i32.const 2)) - (if (i32.const 3) (unreachable) (br $in)) + (if (i32.const 3) (then (unreachable) )(else (br $in))) (drop (i32.const 4)) - (if (i32.const 5) (br $in) (unreachable)) + (if (i32.const 5) (then (br $in) )(else (unreachable))) (drop (i32.const 6)) ) - (if (result i32) (i32.const 6) (br $outval (i32.const 7)) (i32.const 8)) + (if (result i32) (i32.const 6) (then (br $outval (i32.const 7)) )(else (i32.const 8))) ) ) (func $threading @@ -694,7 +796,9 @@ (block $out (block $in (if (i32.const 1) - (br $in) + (then + (br $in) + ) ) (br_if $in (i32.const 2)) (br $value-in (i32.const 3)) @@ -710,7 +814,9 @@ (block $stack3 (block $stack4 (if (i32.const 1) - (br $stack4) + (then + (br $stack4) + ) ) (unreachable) ) @@ -727,13 +833,17 @@ (block $out (result i32) (if (local.get $x) - (br $out - (block (result i32) - (local.set $x (i32.const 0)) - (i32.const 1) + (then + (br $out + (block (result i32) + (local.set $x (i32.const 0)) + (i32.const 1) + ) ) ) - (br_if $leave (i32.const 1)) + (else + (br_if $leave (i32.const 1)) + ) ) (unreachable) ) @@ -747,11 +857,15 @@ (block $out (result i32) (if (local.get $x) - (br_if $leave (i32.const 1)) - (br $out - (block (result i32) - (local.set $x (i32.const 0)) - (i32.const 1) + (then + (br_if $leave (i32.const 1)) + ) + (else + (br $out + (block (result i32) + (local.set $x (i32.const 0)) + (i32.const 1) + ) ) ) ) @@ -767,11 +881,13 @@ (block $out (result i32) (if (local.get $x) - (br $out - (block (result i32) - (drop (call $if-to-br_if-value-sideeffect (i32.const 0) (i32.const 1))) - (nop) - (i32.const 1) + (then + (br $out + (block (result i32) + (drop (call $if-to-br_if-value-sideeffect (i32.const 0) (i32.const 1))) + (nop) + (i32.const 1) + ) ) ) ) @@ -790,19 +906,23 @@ (local.get $j) (i32.const 2147483640) ) - (block $x - (block $y - (block $z - (br_if $y - (local.get $j) + (then + (block $x + (block $y + (block $z + (br_if $y + (local.get $j) + ) + (br $x) ;; don't be confused by this ) - (br $x) ;; don't be confused by this + (nop) ;; get me to the store! ) - (nop) ;; get me to the store! ) ) - (block $switch$26 - (nop) + (else + (block $switch$26 + (nop) + ) ) ) (i32.store @@ -857,9 +977,11 @@ ;; element in the block, (if (i32.const 2) - (block - (drop (call $loop-if)) - (br $outer (i32.const 0)) + (then + (block + (drop (call $loop-if)) + (br $outer (i32.const 0)) + ) ) ) (br $typed) @@ -927,10 +1049,14 @@ (i32.load8_s (i32.const 201460482) ) - (br $label$0) - (block $label$3 - (br_if $label$3 - (local.get $0) + (then + (br $label$0) + ) + (else + (block $label$3 + (br_if $label$3 + (local.get $0) + ) ) ) ) @@ -971,7 +1097,9 @@ ) (if (i32.const 0) - (nop) + (then + (nop) + ) ) ) ) @@ -980,8 +1108,12 @@ (drop (if (result f64) (unreachable) - (f64.const 1) - (br $label$3) + (then + (f64.const 1) + ) + (else + (br $label$3) + ) ) ) (i64.const 1) @@ -992,12 +1124,20 @@ (drop (if (result i32) (unreachable) - (if (result i32) - (i32.const 1) - (br $label$39) ;; if we nop this, then the parent type must change + (then + (if (result i32) + (i32.const 1) + (then + (br $label$39) ;; if we nop this, then the parent type must change + ) + (else + (i32.const 0) + ) + ) + ) + (else (i32.const 0) ) - (i32.const 0) ) ) ) @@ -1008,19 +1148,25 @@ (block $label$0 (if (local.get $0) - (block $label$11 - (return - (f32.const 239) - ) - (if - (i32.const 0) + (then + (block $label$11 (return - (local.get $2) + (f32.const 239) + ) + (if + (i32.const 0) + (then + (return + (local.get $2) + ) + ) ) ) ) - (return - (f32.const -9223372036854775808) + (else + (return + (f32.const -9223372036854775808) + ) ) ) ) @@ -1029,11 +1175,13 @@ (loop $loop (if (i32.const 1) - (block $block - (br_if $block + (then + (block $block + (br_if $block + (br $loop) + ) (br $loop) ) - (br $loop) ) ) (br $loop) ;; we 100% go back to the loop top, the loop is never exited. but opts move code around so that is not obvious anymore, and the loop becomes a nop, but the func has a return value @@ -1047,11 +1195,13 @@ (loop $label$5 (if (i32.const 11) - (block $label$8 ;; this block is none - it has a break, even if not taken - and so looks like it might flow out, - (br_if $label$8 ;; and so we can't move it outside to be the end of the loop's block - (unreachable) + (then + (block $label$8 ;; this block is none - it has a break, even if not taken - and so looks like it might flow out, + (br_if $label$8 ;; and so we can't move it outside to be the end of the loop's block + (unreachable) + ) + (br $label$5) ) - (br $label$5) ) ) (br $label$5) @@ -1554,22 +1704,34 @@ (local.set $x (if (result i32) (local.get $p) - (br $out) - (i32.const 1) + (then + (br $out) + ) + (else + (i32.const 1) + ) ) ) (local.set $x (if (result i32) (local.get $p) - (i32.const 2) - (br $out) + (then + (i32.const 2) + ) + (else + (br $out) + ) ) ) (local.set $x (if (result i32) (local.get $p) - (br $out) - (br $out) + (then + (br $out) + ) + (else + (br $out) + ) ) ) ) @@ -1579,22 +1741,28 @@ (local $var$6 f64) (if (i32.const 0) - (drop - (loop $label$3 (result i64) - (block $label$4 (result i64) - (block $label$5 - (block $label$6 - (local.set $var$1 - (if (result f64) - (unreachable) - (br $label$5) - (f64.const 1) + (then + (drop + (loop $label$3 (result i64) + (block $label$4 (result i64) + (block $label$5 + (block $label$6 + (local.set $var$1 + (if (result f64) + (unreachable) + (then + (br $label$5) + ) + (else + (f64.const 1) + ) + ) ) ) + (nop) ) - (nop) + (i64.const 1) ) - (i64.const 1) ) ) ) @@ -1604,42 +1772,64 @@ (func $if-flow-1 (result i32) (if (i32.const 0) - (return (i32.const 1)) - (return (i32.const 2)) + (then + (return (i32.const 1)) + ) + (else + (return (i32.const 2)) + ) ) ) (func $if-flow-2 (result i32) (if (i32.const 0) - (unreachable) - (return (i32.const 2)) + (then + (unreachable) + ) + (else + (return (i32.const 2)) + ) ) ) (func $if-flow-3 (result i32) (if (i32.const 0) - (return (i32.const 1)) - (unreachable) + (then + (return (i32.const 1)) + ) + (else + (unreachable) + ) ) ) (func $if-flow-4 (result i32) (if (return (i32.const 0)) - (return (i32.const 1)) - (return (i32.const 2)) + (then + (return (i32.const 1)) + ) + (else + (return (i32.const 2)) + ) ) ) (func $iff-flow-fuzz-bug (result i32) (loop $label$1 (if (i32.const 1) - (loop $label$2 - (unreachable) - (if ;; a loop that is never reached at the end of a loop - (i32.const 0) - (nop) - (return + (then + (loop $label$2 + (unreachable) + (if ;; a loop that is never reached at the end of a loop (i32.const 0) + (then + (nop) + ) + (else + (return + (i32.const 0) + ) + ) ) ) ) @@ -1653,12 +1843,14 @@ (block $label$2 (result i32) (if (local.get $0) - (local.set $0 - (loop $label$5 - (br_if $label$5 - (br_if $label$2 - (unreachable) - (i32.const 0) + (then + (local.set $0 + (loop $label$5 + (br_if $label$5 + (br_if $label$2 + (unreachable) + (i32.const 0) + ) ) ) ) @@ -1728,9 +1920,11 @@ (block $label (if (i32.const 1) - (block - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (block + (drop (i32.const 2)) + (drop (i32.const 3)) + ) ) ) ) @@ -1739,9 +1933,11 @@ (block $label (if (br $label) ;; use outside of arm - (block - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (block + (drop (i32.const 2)) + (drop (i32.const 3)) + ) ) ) ) @@ -1750,7 +1946,9 @@ (block $label (if (i32.const 1) - (br $label) + (then + (br $label) + ) ) ) ) @@ -1758,8 +1956,12 @@ (block $label (if (i32.const 1) - (br $label) - (drop (i32.const 3)) + (then + (br $label) + ) + (else + (drop (i32.const 3)) + ) ) ) ) @@ -1767,8 +1969,12 @@ (block $label (if (i32.const 1) - (drop (i32.const 3)) - (br $label) + (then + (drop (i32.const 3)) + ) + (else + (br $label) + ) ) ) ) @@ -1776,8 +1982,12 @@ (block $label (if (i32.const 1) - (br $label) - (br $label) + (then + (br $label) + ) + (else + (br $label) + ) ) ) ) @@ -1785,8 +1995,12 @@ (block $label (if (i32.const 1) - (drop (i32.const 2)) - (drop (i32.const 3)) + (then + (drop (i32.const 2)) + ) + (else + (drop (i32.const 3)) + ) ) ) ) @@ -1794,8 +2008,12 @@ (block $label (result i32) (if (result i32) (i32.const 1) - (i32.const 2) - (i32.const 3) + (then + (i32.const 2) + ) + (else + (i32.const 3) + ) ) ) ) @@ -1808,7 +2026,9 @@ (block $label$4 (unreachable) ) - (br $label$3) + (then + (br $label$3) + ) ) ) (unreachable) @@ -1820,31 +2040,43 @@ (block $label$1 (if (unreachable) ;; unreachable condition - (nop) - (unreachable) + (then + (nop) + ) + (else + (unreachable) + ) ) ) ) (func $propagate-type-if-we-optimize (if (i32.const 1) - (nop) - (block - (drop - (loop $label$3 (result i64) - (br_if $label$3 - (block $label$4 (result i32) - (if - (i32.const 0) - (unreachable) - (unreachable) + (then + (nop) + ) + (else + (block + (drop + (loop $label$3 (result i64) + (br_if $label$3 + (block $label$4 (result i32) + (if + (i32.const 0) + (then + (unreachable) + ) + (else + (unreachable) + ) + ) ) ) + (i64.const -9) ) - (i64.const -9) ) + (unreachable) ) - (unreachable) ) ) ) @@ -1905,15 +2137,21 @@ (loop $label$1 (if (i32.const 0) - (block $label$3 - (if - (i32.const 0) - (block - (nop) - (br $label$3) - ) - (return - (i32.const -8192) + (then + (block $label$3 + (if + (i32.const 0) + (then + (block + (nop) + (br $label$3) + ) + ) + (else + (return + (i32.const -8192) + ) + ) ) ) ) @@ -1950,13 +2188,17 @@ (local.get $x) (i32.const 1) ) - (i32.mul - (i32.const 2) - (i32.const 3) + (then + (i32.mul + (i32.const 2) + (i32.const 3) + ) ) - (i32.mul - (i32.const 2) - (i32.const 3) + (else + (i32.mul + (i32.const 2) + (i32.const 3) + ) ) ) ) @@ -1966,13 +2208,17 @@ (local.get $x) (i32.const 1) ) - (i32.add - (i32.const 2) - (i32.const 3) + (then + (i32.add + (i32.const 2) + (i32.const 3) + ) ) - (i32.add - (i32.const 2) - (i32.const 3) + (else + (i32.add + (i32.const 2) + (i32.const 3) + ) ) ) ) @@ -1983,8 +2229,12 @@ (local.get $0) (i32.const 2) ) - (i32.const 1) - (i32.const 0) + (then + (i32.const 1) + ) + (else + (i32.const 0) + ) )) ) (func $no-selectify-when-arm-side-effects (param $0 i32) @@ -1993,16 +2243,24 @@ (local.get $0) (i32.const 2) ) - (local.tee $0 (i32.const 1)) - (i32.const 0) + (then + (local.tee $0 (i32.const 1)) + ) + (else + (i32.const 0) + ) )) (drop (if (result i32) (i32.rem_s (local.get $0) (i32.const 2) ) - (i32.const 0) - (local.tee $0 (i32.const 1)) + (then + (i32.const 0) + ) + (else + (local.tee $0 (i32.const 1)) + ) )) ) (func $no-selectify-when-effects-invalidate (param $0 i32) @@ -2012,16 +2270,24 @@ (local.tee $0 (i32.const 3)) (i32.const 2) ) - (local.get $0) - (i32.const 0) + (then + (local.get $0) + ) + (else + (i32.const 0) + ) )) (drop (if (result i32) (i32.rem_s (local.tee $0 (i32.const 3)) (i32.const 2) ) - (i32.const 0) - (local.get $0) + (then + (i32.const 0) + ) + (else + (local.get $0) + ) )) ;; but different locals do not invalidate (drop (if (result i32) @@ -2029,8 +2295,12 @@ (local.tee $0 (i32.const 3)) (i32.const 2) ) - (i32.const 0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (local.get $1) + ) )) ) (func $if-one-side (result i32) @@ -2038,8 +2308,12 @@ (local.set $x (if (result i32) (i32.const 1) - (i32.const 2) - (local.get $x) + (then + (i32.const 2) + ) + (else + (local.get $x) + ) ) ) (local.get $x) @@ -2049,8 +2323,12 @@ (local.set $x (if (result i32) (i32.const 1) - (local.get $x) - (i32.const 2) + (then + (local.get $x) + ) + (else + (i32.const 2) + ) ) ) (local.get $x) @@ -2068,8 +2346,12 @@ (local.tee $x (if (result i32) (i32.const -3) - (i32.const -4) - (local.get $x) + (then + (i32.const -4) + ) + (else + (local.get $x) + ) ) ) ) @@ -2080,16 +2362,28 @@ (local.set $20 (if (result i32) (i32.const 1) - (if (result i32) - (i32.const 2) + (then (if (result i32) - (i32.const 3) - (i32.const 4) - (local.get $20) + (i32.const 2) + (then + (if (result i32) + (i32.const 3) + (then + (i32.const 4) + ) + (else + (local.get $20) + ) + ) + ) + (else + (local.get $20) + ) ) + ) + (else (local.get $20) ) - (local.get $20) ) ) (local.get $20) @@ -2101,8 +2395,12 @@ (local.set $x (if (result i32) (i32.const 1) - (local.get $x) - (local.get $y) + (then + (local.get $x) + ) + (else + (local.get $y) + ) ) ) (br $top) @@ -2115,8 +2413,12 @@ (local.set $x (if (result i32) (i32.const 1) - (unreachable) - (local.get $x) + (then + (unreachable) + ) + (else + (local.get $x) + ) ) ) (br $top) @@ -2129,8 +2431,12 @@ (local.set $x (if (result i32) (i32.const 1) - (unreachable) - (local.get $y) + (then + (unreachable) + ) + (else + (local.get $y) + ) ) ) (br $top) @@ -2144,8 +2450,12 @@ (local.tee $x (if (result i32) (i32.const 1) - (local.get $x) - (i32.const 2) + (then + (local.get $x) + ) + (else + (i32.const 2) + ) ) ) ) @@ -2157,8 +2467,12 @@ (nop) (if (local.get $x) - (br $loop) - (local.set $x (i32.const 1)) + (then + (br $loop) + ) + (else + (local.set $x (i32.const 1)) + ) ) ) (local.get $x) @@ -2168,8 +2482,12 @@ (nop) (if (result i32) (local.get $x) - (br $loop) - (i32.const 1) + (then + (br $loop) + ) + (else + (i32.const 1) + ) ) ) ) @@ -2179,10 +2497,14 @@ (block $A (if (i32.const 0) - (return - (i32.const 0) ;; seems to flow out, but we are in unreachable code, and do not actually reach anywhere + (then + (return + (i32.const 0) ;; seems to flow out, but we are in unreachable code, and do not actually reach anywhere + ) + ) + (else + (br $A) ;; can be a nop ) - (br $A) ;; can be a nop ) ) ) @@ -2193,10 +2515,14 @@ (block $A (if (i32.const 0) - (return - (i32.const 0) + (then + (return + (i32.const 0) + ) + ) + (else + (br $A) ) - (br $A) ) ) ) @@ -2208,17 +2534,21 @@ (local.tee $0 ;; note side effect; it's ok (i32.const 1024) ) - (br_if $label$1 - (i32.eqz - (i32.const -4) + (then + (br_if $label$1 + (i32.eqz + (i32.const -4) + ) ) ) ) (if (i32.const 1025) - (br_if $label$1 - (i32.eqz - (i32.const -5) + (then + (br_if $label$1 + (i32.eqz + (i32.const -5) + ) ) ) ) @@ -2226,17 +2556,21 @@ (local.tee $0 ;; note side effect; it's ok (i32.const 1025) ) - (br_if $label$1 - (i32.eqz - (i32.const -6) + (then + (br_if $label$1 + (i32.eqz + (i32.const -6) + ) ) ) ) (if (i32.const 1026) - (br_if $label$1 - (local.tee $0 ;; but here it is *not* ok - (i32.const -7) + (then + (br_if $label$1 + (local.tee $0 ;; but here it is *not* ok + (i32.const -7) + ) ) ) ) @@ -2262,8 +2596,10 @@ (block (result i32) (if (local.get $x) - (return - (i32.const 5) + (then + (return + (i32.const 5) + ) ) ) (i32.const 6) @@ -2275,8 +2611,12 @@ (select (if (result i32) (unreachable) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) (i32.const 1) (i32.const 2) diff --git a/test/passes/remove-unused-brs_precompute_vacuum_remove-unused-brs.wast b/test/passes/remove-unused-brs_precompute_vacuum_remove-unused-brs.wast index 909e9514a..5c0fe1536 100644 --- a/test/passes/remove-unused-brs_precompute_vacuum_remove-unused-brs.wast +++ b/test/passes/remove-unused-brs_precompute_vacuum_remove-unused-brs.wast @@ -11,14 +11,18 @@ (i32.const 9) (i32.const 0) ) - (return - (f64.const -3.4) + (then + (return + (f64.const -3.4) + ) ) ) (if (local.get $x) - (return - (f64.const 5.6) + (then + (return + (f64.const 5.6) + ) ) ) (return diff --git a/test/passes/remove-unused-brs_shrink-level=1.txt b/test/passes/remove-unused-brs_shrink-level=1.txt index c32b64d03..06b4e4e72 100644 --- a/test/passes/remove-unused-brs_shrink-level=1.txt +++ b/test/passes/remove-unused-brs_shrink-level=1.txt @@ -17,10 +17,14 @@ (drop (if (result i32) (i32.const 1) - (i32.load - (i32.const 10) + (then + (i32.load + (i32.const 10) + ) + ) + (else + (i32.const 27) ) - (i32.const 27) ) ) (drop @@ -36,10 +40,14 @@ (drop (if (result i32) (i32.const 1) - (i32.trunc_f64_u - (f64.const 12.34) + (then + (i32.trunc_f64_u + (f64.const 12.34) + ) + ) + (else + (i32.const 27) ) - (i32.const 27) ) ) (i32.const 0) @@ -108,9 +116,11 @@ (i32.const 0) ) ) - (block $out8 - (nop) - (nop) + (then + (block $out8 + (nop) + (nop) + ) ) ) (block $out83 diff --git a/test/passes/remove-unused-brs_shrink-level=1.wast b/test/passes/remove-unused-brs_shrink-level=1.wast index 2033ffd7c..ce141c430 100644 --- a/test/passes/remove-unused-brs_shrink-level=1.wast +++ b/test/passes/remove-unused-brs_shrink-level=1.wast @@ -7,33 +7,49 @@ (drop (if (result i32) ;; with shrinking, this can become a select (i32.const 1) - (block $block1 (result i32) - (i32.const 12) + (then + (block $block1 (result i32) + (i32.const 12) + ) ) - (block $block3 (result i32) - (i32.const 27) + (else + (block $block3 (result i32) + (i32.const 27) + ) ) ) ) (drop (if (result i32) (i32.const 1) - (i32.load (i32.const 10)) ;; load may have side effects, unless ignored - (i32.const 27) + (then + (i32.load (i32.const 10)) ;; load may have side effects, unless ignored + ) + (else + (i32.const 27) + ) ) ) (drop (if (result i32) (i32.const 1) - (i32.rem_s (i32.const 11) (i32.const 12)) ;; rem may have side effects, unless ignored - (i32.const 27) + (then + (i32.rem_s (i32.const 11) (i32.const 12)) ;; rem may have side effects, unless ignored + ) + (else + (i32.const 27) + ) ) ) (drop (if (result i32) (i32.const 1) - (i32.trunc_f64_u (f64.const 12.34)) ;; float to int may have side effects, unless ignored - (i32.const 27) + (then + (i32.trunc_f64_u (f64.const 12.34)) ;; float to int may have side effects, unless ignored + ) + (else + (i32.const 27) + ) ) ) (i32.const 0) diff --git a/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt b/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt index 6f8f40042..8398d6ee6 100644 --- a/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt +++ b/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.txt @@ -108,9 +108,11 @@ (i32.const 0) ) ) - (block $out8 - (nop) - (nop) + (then + (block $out8 + (nop) + (nop) + ) ) ) (block $out83 diff --git a/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.wast b/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.wast index 08d3fb318..4f15dc9c0 100644 --- a/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.wast +++ b/test/passes/remove-unused-brs_shrink-level=1_ignore-implicit-traps.wast @@ -7,33 +7,49 @@ (drop (if (result i32) ;; with shrinking, this can become a select (i32.const 1) - (block $block1 (result i32) - (i32.const 12) + (then + (block $block1 (result i32) + (i32.const 12) + ) ) - (block $block3 (result i32) - (i32.const 27) + (else + (block $block3 (result i32) + (i32.const 27) + ) ) ) ) (drop (if (result i32) (i32.const 1) - (i32.load (i32.const 10)) ;; load may have side effects, unless ignored - (i32.const 27) + (then + (i32.load (i32.const 10)) ;; load may have side effects, unless ignored + ) + (else + (i32.const 27) + ) ) ) (drop (if (result i32) (i32.const 1) - (i32.rem_s (i32.const 11) (i32.const 12)) ;; rem may have side effects, unless ignored - (i32.const 27) + (then + (i32.rem_s (i32.const 11) (i32.const 12)) ;; rem may have side effects, unless ignored + ) + (else + (i32.const 27) + ) ) ) (drop (if (result i32) (i32.const 1) - (i32.trunc_f64_u (f64.const 12.34)) ;; float to int may have side effects, unless ignored - (i32.const 27) + (then + (i32.trunc_f64_u (f64.const 12.34)) ;; float to int may have side effects, unless ignored + ) + (else + (i32.const 27) + ) ) ) (i32.const 0) diff --git a/test/passes/remove-unused-names_code-folding.txt b/test/passes/remove-unused-names_code-folding.txt index 7d7505b07..d0486b3c7 100644 --- a/test/passes/remove-unused-names_code-folding.txt +++ b/test/passes/remove-unused-names_code-folding.txt @@ -6,7 +6,9 @@ (func $ifs (if (i32.const 0) - (nop) + (then + (nop) + ) ) (block (drop @@ -16,8 +18,12 @@ ) (if (i32.const 0) - (nop) - (unreachable) + (then + (nop) + ) + (else + (unreachable) + ) ) (drop (block (result i32) @@ -33,13 +39,17 @@ (drop (if (result i32) (i32.const 0) - (i32.add - (i32.const 1) - (i32.const 2) + (then + (i32.add + (i32.const 1) + (i32.const 2) + ) ) - (i32.add - (i32.const 1) - (i32.const 333333333) + (else + (i32.add + (i32.const 1) + (i32.const 333333333) + ) ) ) ) @@ -56,8 +66,10 @@ (block (if (i32.const 0) - (unreachable) - (block + (then + (unreachable) + ) + (else ) ) (nop) @@ -65,24 +77,30 @@ (block (if (i32.const 0) - (block + (then + ) + (else + (unreachable) ) - (unreachable) ) (nop) ) (if (i32.const 0) - (block + (then (nop) (unreachable) ) - (nop) + (else + (nop) + ) ) (if (i32.const 0) - (nop) - (block + (then + (nop) + ) + (else (nop) (unreachable) ) @@ -105,8 +123,10 @@ (block (if (i32.const 0) - (unreachable) - (block + (then + (unreachable) + ) + (else ) ) (drop @@ -119,9 +139,11 @@ (block (if (i32.const 0) - (block + (then + ) + (else + (unreachable) ) - (unreachable) ) (drop (i32.add @@ -132,7 +154,7 @@ ) (if (i32.const 0) - (block + (then (drop (i32.add (i32.const 1) @@ -141,22 +163,26 @@ ) (unreachable) ) - (drop - (i32.add - (i32.const 1) - (i32.const 2) + (else + (drop + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) ) (if (i32.const 0) - (drop - (i32.add - (i32.const 1) - (i32.const 2) + (then + (drop + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) - (block + (else (drop (i32.add (i32.const 1) @@ -171,7 +197,7 @@ (block (if (i32.const 1) - (block + (then (drop (i32.const -1234) ) @@ -179,8 +205,10 @@ (i32.const -1000) ) ) - (drop - (i32.const 999) + (else + (drop + (i32.const 999) + ) ) ) (drop @@ -193,7 +221,7 @@ (block (result i32) (if (i32.const 2) - (block + (then (drop (i32.const -1234) ) @@ -201,8 +229,10 @@ (i32.const -1000) ) ) - (drop - (i32.const 999) + (else + (drop + (i32.const 999) + ) ) ) (drop @@ -217,7 +247,7 @@ (block (result i32) (if (i32.const 3) - (block + (then (drop (i32.const -1234) ) @@ -225,8 +255,10 @@ (i32.const -1000) ) ) - (drop - (i32.const 999) + (else + (drop + (i32.const 999) + ) ) ) (drop @@ -242,34 +274,36 @@ (block (if (i32.const 0) - (if - (i32.const 0) - (block - (drop - (i32.const -1234) - ) - (drop - (i32.const -1000) - ) - (br $folding-inner0) - ) - (block - (drop - (i32.const 999) + (then + (if + (i32.const 0) + (then + (drop + (i32.const -1234) + ) + (drop + (i32.const -1000) + ) + (br $folding-inner0) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 999) + ) + (drop + (i32.const 1) + ) + (br $folding-inner0) ) - (br $folding-inner0) ) ) ) (if (i32.const 0) - (block + (then (if (i32.const 0) - (block + (then (drop (i32.const -1234) ) @@ -277,7 +311,7 @@ (i32.const -1000) ) ) - (block + (else (drop (i32.const 999) ) @@ -292,12 +326,12 @@ ) (if (i32.const 0) - (block + (then (if (i32.const 0) - (block + (then ) - (block + (else (drop (i32.const 999) ) @@ -311,10 +345,10 @@ ) (if (i32.const 0) - (block + (then (if (i32.const 0) - (block + (then (drop (i32.const -1234) ) @@ -322,7 +356,7 @@ (i32.const -1000) ) ) - (block + (else ) ) (br $folding-inner0) @@ -332,7 +366,7 @@ (block (if (i32.const 9999) - (block + (then (drop (i32.const -51234) ) @@ -340,7 +374,7 @@ (i32.const -51000) ) ) - (block + (else (drop (i32.const 5999) ) @@ -357,7 +391,7 @@ (block (result i32) (if (i32.const 9999) - (block + (then (drop (i32.const -51234) ) @@ -365,7 +399,7 @@ (i32.const -51000) ) ) - (block + (else (drop (i32.const 5999) ) @@ -383,7 +417,7 @@ (drop (if (result i32) (i32.const 9999) - (block (result i32) + (then (drop (i32.const -51234) ) @@ -393,7 +427,7 @@ (unreachable) (i32.const 10) ) - (block (result i32) + (else (drop (i32.const 5999) ) @@ -414,7 +448,7 @@ (func $no-grandparent (if (i32.const 9999) - (block + (then (drop (i32.const -51234) ) @@ -424,7 +458,7 @@ (unreachable) (unreachable) ) - (block + (else (drop (i32.const 5999) ) @@ -440,7 +474,7 @@ (block (if (i32.const 9999) - (block + (then (drop (i32.const -51234) ) @@ -448,7 +482,7 @@ (i32.const -51000) ) ) - (block + (else (drop (i32.const 5999) ) @@ -478,44 +512,52 @@ (block (if (local.get $x) - (br_if $out - (local.get $y) + (then + (br_if $out + (local.get $y) + ) ) - (br_if $out2 - (local.get $y) + (else + (br_if $out2 + (local.get $y) + ) ) ) (nop) ) (if (i32.const 1234) - (if - (local.get $x) - (block - (nop) - (br_if $out - (local.get $y) + (then + (if + (local.get $x) + (then + (nop) + (br_if $out + (local.get $y) + ) + (nop) ) - (nop) - ) - (block - (nop) - (br_if $out2 - (local.get $y) + (else + (nop) + (br_if $out2 + (local.get $y) + ) + (nop) ) - (nop) ) ) ) (if (local.get $x) - (block $left - (br_if $left - (local.get $y) + (then + (block $left + (br_if $left + (local.get $y) + ) + (nop) ) - (nop) ) - (block + (else (br_if $out (local.get $y) ) @@ -524,17 +566,19 @@ ) (if (local.get $x) - (block + (then (br_if $out (local.get $y) ) (nop) ) - (block $right - (br_if $right - (local.get $y) + (else + (block $right + (br_if $right + (local.get $y) + ) + (nop) ) - (nop) ) ) ) @@ -550,11 +594,15 @@ (block $x (if (i32.const 0) - (br $x) + (then + (br $x) + ) ) (if (i32.const 0) - (br $x) + (then + (br $x) + ) ) (br $x) ) @@ -569,7 +617,7 @@ (block $x (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -581,7 +629,7 @@ ) (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -604,7 +652,7 @@ (block $x (if (i32.const 0) - (block + (then (drop (i32.const 1000) ) @@ -613,7 +661,7 @@ ) (if (i32.const 0) - (block + (then (drop (i32.const 2000) ) @@ -665,10 +713,12 @@ (block (if (i32.const 1) - (drop - (i32.const 3) + (then + (drop + (i32.const 3) + ) ) - (block + (else (drop (i32.const 4) ) @@ -725,7 +775,9 @@ (block $x (if (i32.const 0) - (br $x) + (then + (br $x) + ) ) ) (drop @@ -739,7 +791,7 @@ (block $y (result i32) (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -766,7 +818,7 @@ (block $z (result i32) (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -790,7 +842,7 @@ (block $w (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -812,7 +864,7 @@ (block $x1 (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -837,7 +889,7 @@ ) (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -860,7 +912,7 @@ ) (if (i32.const 0) - (block + (then (drop (i32.const 1) ) @@ -884,15 +936,21 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) ) (return) @@ -915,15 +973,21 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (unreachable) ) @@ -947,15 +1011,21 @@ (block (result i32) (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (i32.const 4) ) @@ -979,15 +1049,19 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (block + (then (nop) (nop) (nop) @@ -1028,15 +1102,19 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner1) + (then + (br $folding-inner1) + ) ) (if (i32.const 3) - (block + (then (drop (i32.const 10) ) @@ -1069,19 +1147,27 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 1) - (br $folding-inner1) + (then + (br $folding-inner1) + ) ) (if (i32.const 1) - (br $folding-inner1) + (then + (br $folding-inner1) + ) ) ) (return) @@ -1124,15 +1210,21 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) ) (return) @@ -1145,7 +1237,7 @@ (func $terminating-not-worth-it (if (i32.const 1) - (block + (then (nop) (nop) (unreachable) @@ -1153,7 +1245,7 @@ ) (if (i32.const 2) - (block + (then (nop) (nop) (unreachable) @@ -1161,7 +1253,7 @@ ) (if (i32.const 3) - (block + (then (nop) (nop) (unreachable) @@ -1173,15 +1265,21 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) ) (return) @@ -1204,19 +1302,25 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (block + (then (nop) (return (i32.add @@ -1245,19 +1349,25 @@ (block (result i32) (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (block + (then (nop) (return (i32.add @@ -1284,27 +1394,39 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 4) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 5) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 6) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (unreachable) ) @@ -1321,26 +1443,36 @@ (block (if (i32.const 1) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 2) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 4) - (br $folding-inner0) + (then + (br $folding-inner0) + ) ) (if (i32.const 3) - (return - (i32.add - (i32.const 1) - (i32.const 234567) + (then + (return + (i32.add + (i32.const 1) + (i32.const 234567) + ) ) ) ) @@ -1368,7 +1500,9 @@ (func $drop-if-with-value-but-unreachable (if (i32.const 0) - (nop) + (then + (nop) + ) ) (block (drop @@ -1380,8 +1514,12 @@ ) (if (i32.const 0) - (nop) - (unreachable) + (then + (nop) + ) + (else + (unreachable) + ) ) (nop) (drop @@ -1400,13 +1538,17 @@ (drop (if (result i32) (i32.const 0) - (i32.add - (i32.const 1) - (i32.const 2) + (then + (i32.add + (i32.const 1) + (i32.const 2) + ) ) - (i32.add - (i32.const 1) - (i32.const 333333333) + (else + (i32.add + (i32.const 1) + (i32.const 333333333) + ) ) ) ) @@ -1417,17 +1559,23 @@ (block $x (if (i32.const 0) - (br $x) + (then + (br $x) + ) ) (if (i32.const 0) - (br $x) + (then + (br $x) + ) ) (br $x) ) (if (i32.const 1) - (br $out) + (then + (br $out) + ) ) (drop (i32.const 1) @@ -1447,27 +1595,33 @@ (block (if (i32.const 0) - (block + (then (if (i32.const 1) - (br $out) + (then + (br $out) + ) ) (br $folding-inner0) ) ) (if (i32.const 0) - (block + (then (if (i32.const 1) - (br $out) + (then + (br $out) + ) ) (br $folding-inner0) ) ) (if (i32.const 1) - (br $out) + (then + (br $out) + ) ) (br $folding-inner0) ) @@ -1492,26 +1646,30 @@ (block (if (i32.const 0) - (block + (then (if (i32.add (i32.const 0) (i32.const 1) ) - (br $middle) + (then + (br $middle) + ) ) (br $folding-inner0) ) ) (if (i32.const 0) - (block + (then (if (i32.add (i32.const 0) (i32.const 1) ) - (br $middle) + (then + (br $middle) + ) ) (br $folding-inner0) ) @@ -1521,7 +1679,9 @@ (i32.const 0) (i32.const 1) ) - (br $middle) + (then + (br $middle) + ) ) (br $folding-inner0) ) @@ -1546,26 +1706,30 @@ (block (if (i32.const 0) - (block + (then (if (i32.add (i32.const 0) (i32.const 1) ) - (br $middle) + (then + (br $middle) + ) ) (br $out) ) ) (if (i32.const 0) - (block + (then (if (i32.add (i32.const 0) (i32.const 1) ) - (br $middle) + (then + (br $middle) + ) ) (br $out) ) @@ -1575,7 +1739,9 @@ (i32.const 0) (i32.const 1) ) - (br $middle) + (then + (br $middle) + ) ) ) ) @@ -1613,11 +1779,15 @@ (block (if (i32.const 0) - (br $out) + (then + (br $out) + ) ) (if (i32.const 0) - (br $out) + (then + (br $out) + ) ) (br $out) ) @@ -1628,7 +1798,9 @@ (i32.const 0) (i32.const 1) ) - (br $x) + (then + (br $x) + ) ) (drop (i32.const 1) @@ -1649,11 +1821,15 @@ (block (if (i32.const 0) - (br $out) + (then + (br $out) + ) ) (if (i32.const 0) - (br $out) + (then + (br $out) + ) ) (br $out) ) @@ -1664,7 +1840,9 @@ (i32.const 0) (i32.const 1) ) - (br $x) + (then + (br $x) + ) ) ) (drop @@ -1682,11 +1860,13 @@ (block (if (local.get $x) - (block + (then ) - (drop - (call $if-suffix - (i32.const -1) + (else + (drop + (call $if-suffix + (i32.const -1) + ) ) ) ) @@ -1697,11 +1877,13 @@ (block (result i32) (if (local.get $x) - (block + (then ) - (drop - (call $if-suffix - (i32.const -2) + (else + (drop + (call $if-suffix + (i32.const -2) + ) ) ) ) diff --git a/test/passes/remove-unused-names_code-folding.wast b/test/passes/remove-unused-names_code-folding.wast index 9979a0a3c..642bbdf7c 100644 --- a/test/passes/remove-unused-names_code-folding.wast +++ b/test/passes/remove-unused-names_code-folding.wast @@ -1,162 +1,222 @@ (module (func $ifs - (if (i32.const 0) (nop)) - (if (i32.const 0) (nop) (nop)) - (if (i32.const 0) (nop) (unreachable)) + (if (i32.const 0) (then (nop))) + (if (i32.const 0) (then (nop) )(else (nop))) + (if (i32.const 0) (then (nop) )(else (unreachable))) (drop (if (result i32) (i32.const 0) - (i32.add (i32.const 1) (i32.const 2)) - (i32.add (i32.const 1) (i32.const 2)) + (then + (i32.add (i32.const 1) (i32.const 2)) + ) + (else + (i32.add (i32.const 1) (i32.const 2)) + ) ) ) (drop (if (result i32) (i32.const 0) - (i32.add (i32.const 1) (i32.const 2)) - (i32.add (i32.const 1) (i32.const 333333333)) + (then + (i32.add (i32.const 1) (i32.const 2)) + ) + (else + (i32.add (i32.const 1) (i32.const 333333333)) + ) ) ) ) (func $ifs-blocks (if (i32.const 0) - (block - (nop) + (then + (block + (nop) + ) ) - (block - (nop) + (else + (block + (nop) + ) ) ) (if (i32.const 0) - (block - (unreachable) - (nop) + (then + (block + (unreachable) + (nop) + ) ) - (block - (nop) + (else + (block + (nop) + ) ) ) (if (i32.const 0) - (block - (nop) + (then + (block + (nop) + ) ) - (block - (unreachable) - (nop) + (else + (block + (unreachable) + (nop) + ) ) ) (if (i32.const 0) - (block - (nop) - (unreachable) + (then + (block + (nop) + (unreachable) + ) ) - (block - (nop) + (else + (block + (nop) + ) ) ) (if (i32.const 0) - (block - (nop) + (then + (block + (nop) + ) ) - (block - (nop) - (unreachable) + (else + (block + (nop) + (unreachable) + ) ) ) ) (func $ifs-blocks-big (if (i32.const 0) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) + (else + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 0) - (block - (unreachable) - (drop (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (unreachable) + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) + (else + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 0) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) - (block - (unreachable) - (drop (i32.add (i32.const 1) (i32.const 2))) + (else + (block + (unreachable) + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 0) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) - (unreachable) + (then + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + (unreachable) + ) ) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) + (else + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 0) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + ) ) - (block - (drop (i32.add (i32.const 1) (i32.const 2))) - (unreachable) + (else + (block + (drop (i32.add (i32.const 1) (i32.const 2))) + (unreachable) + ) ) ) ) (func $ifs-blocks-long (if (i32.const 1) - (block - (drop (i32.const -1234)) - (drop (i32.const -1000)) - (drop (i32.const 1)) - (nop) - (unreachable) - ) - (block - (drop (i32.const 999)) - (drop (i32.const 1)) - (nop) - (unreachable) - ) - ) - (drop - (if (result i32) (i32.const 2) - (block (result i32) + (then + (block (drop (i32.const -1234)) (drop (i32.const -1000)) (drop (i32.const 1)) (nop) (unreachable) - (i32.const 2) ) - (block (result i32) + ) + (else + (block (drop (i32.const 999)) (drop (i32.const 1)) (nop) (unreachable) - (i32.const 2) + ) + ) + ) + (drop + (if (result i32) (i32.const 2) + (then + (block (result i32) + (drop (i32.const -1234)) + (drop (i32.const -1000)) + (drop (i32.const 1)) + (nop) + (unreachable) + (i32.const 2) + ) + ) + (else + (block (result i32) + (drop (i32.const 999)) + (drop (i32.const 1)) + (nop) + (unreachable) + (i32.const 2) + ) ) ) ) (drop (if (result i32) (i32.const 3) - (block (result i32) - (drop (i32.const -1234)) - (drop (i32.const -1000)) - (drop (i32.const 1)) - (nop) - (i32.const 2) + (then + (block (result i32) + (drop (i32.const -1234)) + (drop (i32.const -1000)) + (drop (i32.const 1)) + (nop) + (i32.const 2) + ) ) - (block (result i32) - (drop (i32.const 999)) - (drop (i32.const 1)) - (nop) - (i32.const 2) + (else + (block (result i32) + (drop (i32.const 999)) + (drop (i32.const 1)) + (nop) + (i32.const 2) + ) ) ) ) @@ -164,84 +224,112 @@ (func $if-worth-it-i-dunno ;; just 2, so not worth it (if (i32.const 0) ;; (put them in ifs, so no block outside which would make us more confident in creating a block in hopes it would vanish) - (if (i32.const 0) - (block - (drop (i32.const -1234)) - (drop (i32.const -1000)) - (unreachable) - (unreachable) - ) - (block - (drop (i32.const 999)) - (drop (i32.const 1)) - (unreachable) - (unreachable) + (then + (if (i32.const 0) + (then + (block + (drop (i32.const -1234)) + (drop (i32.const -1000)) + (unreachable) + (unreachable) + ) + ) + (else + (block + (drop (i32.const 999)) + (drop (i32.const 1)) + (unreachable) + (unreachable) + ) + ) ) ) ) ;; 3, so why not (if (i32.const 0) ;; (put them in ifs, so no block outside which would make us more confident in creating a block in hopes it would vanish) - (if (i32.const 0) - (block - (drop (i32.const -1234)) - (drop (i32.const -1000)) - (unreachable) - (unreachable) - (unreachable) - ) - (block - (drop (i32.const 999)) - (drop (i32.const 1)) - (unreachable) - (unreachable) - (unreachable) + (then + (if (i32.const 0) + (then + (block + (drop (i32.const -1234)) + (drop (i32.const -1000)) + (unreachable) + (unreachable) + (unreachable) + ) + ) + (else + (block + (drop (i32.const 999)) + (drop (i32.const 1)) + (unreachable) + (unreachable) + (unreachable) + ) + ) ) ) ) ;; just 2, but we'll empty out a block (if (i32.const 0) ;; (put them in ifs, so no block outside which would make us more confident in creating a block in hopes it would vanish) - (if (i32.const 0) - (block - (unreachable) - (unreachable) - ) - (block - (drop (i32.const 999)) - (drop (i32.const 1)) - (unreachable) - (unreachable) + (then + (if (i32.const 0) + (then + (block + (unreachable) + (unreachable) + ) + ) + (else + (block + (drop (i32.const 999)) + (drop (i32.const 1)) + (unreachable) + (unreachable) + ) + ) ) ) ) ;; just 2, but we'll empty out a block (if (i32.const 0) ;; (put them in ifs, so no block outside which would make us more confident in creating a block in hopes it would vanish) - (if (i32.const 0) - (block - (drop (i32.const -1234)) - (drop (i32.const -1000)) - (unreachable) - (unreachable) - ) - (block - (unreachable) - (unreachable) + (then + (if (i32.const 0) + (then + (block + (drop (i32.const -1234)) + (drop (i32.const -1000)) + (unreachable) + (unreachable) + ) + ) + (else + (block + (unreachable) + (unreachable) + ) + ) ) ) ) ;; just two, but on a block, so we hope to merge, and can optimize here (block $a-holding-block (if (i32.const 9999) - (block - (drop (i32.const -51234)) - (drop (i32.const -51000)) - (unreachable) - (unreachable) + (then + (block + (drop (i32.const -51234)) + (drop (i32.const -51000)) + (unreachable) + (unreachable) + ) ) - (block - (drop (i32.const 5999)) - (drop (i32.const 51)) - (unreachable) - (unreachable) + (else + (block + (drop (i32.const 5999)) + (drop (i32.const 51)) + (unreachable) + (unreachable) + ) ) ) ) @@ -249,17 +337,21 @@ (drop (block $b-holding-block (result i32) (if (result i32) (i32.const 9999) - (block (result i32) - (drop (i32.const -51234)) - (drop (i32.const -51000)) - (unreachable) - (i32.const 10) + (then + (block (result i32) + (drop (i32.const -51234)) + (drop (i32.const -51000)) + (unreachable) + (i32.const 10) + ) ) - (block (result i32) - (drop (i32.const 5999)) - (drop (i32.const 51)) - (unreachable) - (i32.const 10) + (else + (block (result i32) + (drop (i32.const 5999)) + (drop (i32.const 51)) + (unreachable) + (i32.const 10) + ) ) ) ) @@ -268,17 +360,21 @@ (block $c-holding-block (drop (if (result i32) (i32.const 9999) - (block (result i32) - (drop (i32.const -51234)) - (drop (i32.const -51000)) - (unreachable) - (i32.const 10) + (then + (block (result i32) + (drop (i32.const -51234)) + (drop (i32.const -51000)) + (unreachable) + (i32.const 10) + ) ) - (block (result i32) - (drop (i32.const 5999)) - (drop (i32.const 51)) - (unreachable) - (i32.const 10) + (else + (block (result i32) + (drop (i32.const 5999)) + (drop (i32.const 51)) + (unreachable) + (i32.const 10) + ) ) ) ) @@ -287,29 +383,15 @@ (func $no-grandparent ;; if we had a parent block, we might optimize this (if (i32.const 9999) - (block - (drop (i32.const -51234)) - (drop (i32.const -51000)) - (unreachable) - (unreachable) - ) - (block - (drop (i32.const 5999)) - (drop (i32.const 51)) - (unreachable) - (unreachable) - ) - ) - ) - (func $yes-grandparent - (block - (if (i32.const 9999) + (then (block (drop (i32.const -51234)) (drop (i32.const -51000)) (unreachable) (unreachable) ) + ) + (else (block (drop (i32.const 5999)) (drop (i32.const 51)) @@ -319,61 +401,105 @@ ) ) ) - (func $ifs-named-block (param $x i32) (param $y i32) (result i32) - (block $out - (block $out2 - (if (local.get $x) + (func $yes-grandparent + (block + (if (i32.const 9999) + (then (block - (br_if $out (local.get $y i32)) - (nop) + (drop (i32.const -51234)) + (drop (i32.const -51000)) + (unreachable) + (unreachable) ) + ) + (else (block - (br_if $out (local.get $y i32)) - (nop) + (drop (i32.const 5999)) + (drop (i32.const 51)) + (unreachable) + (unreachable) ) ) + ) + ) + ) + (func $ifs-named-block (param $x i32) (param $y i32) (result i32) + (block $out + (block $out2 (if (local.get $x) - (block - (br_if $out (local.get $y i32)) - (nop) + (then + (block + (br_if $out (local.get $y i32)) + (nop) + ) ) - (block - (br_if $out2 (local.get $y i32)) - (nop) + (else + (block + (br_if $out (local.get $y i32)) + (nop) + ) ) ) - (if (i32.const 1234) - (if (local.get $x) + (if (local.get $x) + (then (block - (nop) (br_if $out (local.get $y i32)) (nop) ) + ) + (else (block - (nop) (br_if $out2 (local.get $y i32)) (nop) ) ) ) + (if (i32.const 1234) + (then + (if (local.get $x) + (then + (block + (nop) + (br_if $out (local.get $y i32)) + (nop) + ) + ) + (else + (block + (nop) + (br_if $out2 (local.get $y i32)) + (nop) + ) + ) + ) + ) + ) (if (local.get $x) - (block $left - (br_if $left (local.get $y i32)) - (nop) + (then + (block $left + (br_if $left (local.get $y i32)) + (nop) + ) ) - (block - (br_if $out (local.get $y i32)) - (nop) + (else + (block + (br_if $out (local.get $y i32)) + (nop) + ) ) ) (if (local.get $x) - (block - (br_if $out (local.get $y i32)) - (nop) + (then + (block + (br_if $out (local.get $y i32)) + (nop) + ) ) - (block $right - (br_if $right (local.get $y i32)) - (nop) + (else + (block $right + (br_if $right (local.get $y i32)) + (nop) + ) ) ) ) @@ -384,17 +510,21 @@ (func $block (block $x (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) ) ) (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) ) ) ;; no fallthrough, another thing to merge @@ -406,17 +536,21 @@ (func $block2 (block $x (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 333333)) - (br $x) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 333333)) + (br $x) + ) ) ) (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) ) ) ;; no fallthrough, another thing to merge @@ -428,20 +562,24 @@ (func $block3 (block $x (if (i32.const 0) - (block - (drop (i32.const 1000)) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) + (then + (block + (drop (i32.const 1000)) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) ) ) (if (i32.const 0) - (block - (drop (i32.const 2000)) - (drop (i32.const 3000)) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) + (then + (block + (drop (i32.const 2000)) + (drop (i32.const 3000)) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) ) ) (drop (i32.const 4000)) @@ -456,59 +594,75 @@ (func $mixture (block $out ;; then we reach the block, and the tail infos are stale, should ignore (if (i32.const 1) ;; then we optimize the if, pushing those brs outside! - (block - (drop (i32.const 2)) ;; first we note the block tails for $out - (nop) (nop) (nop) (nop) (nop) (nop) ;; totally worth it - (br $out) + (then + (block + (drop (i32.const 2)) ;; first we note the block tails for $out + (nop) (nop) (nop) (nop) (nop) (nop) ;; totally worth it + (br $out) + ) ) - (block - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out) + (else + (block + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out) + ) ) ) ) (block $out2 (if (i32.const 1) - (block - (drop (i32.const 3)) ;; leave something - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out2) + (then + (block + (drop (i32.const 3)) ;; leave something + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out2) + ) ) - (block - (drop (i32.const 4)) ;; leave something - (drop (i32.const 5)) ;; leave something - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out2) + (else + (block + (drop (i32.const 4)) ;; leave something + (drop (i32.const 5)) ;; leave something + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out2) + ) ) ) ) ;; now a case where do **do** want to fold for the block (which we can only do in a later pass) (block $out3 (if (i32.const 1) - (block - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out3) + (then + (block + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out3) + ) ) - (block - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out3) + (else + (block + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out3) + ) ) ) (if (i32.const 1) - (block - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out3) + (then + (block + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out3) + ) ) - (block - (drop (i32.const 2)) - (nop) (nop) (nop) (nop) (nop) (nop) - (br $out3) + (else + (block + (drop (i32.const 2)) + (nop) (nop) (nop) (nop) (nop) (nop) + (br $out3) + ) ) ) (drop (i32.const 2)) @@ -520,10 +674,12 @@ ;; these should be merged (block $x (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) + ) ) ) (drop (i32.const 1)) @@ -534,10 +690,12 @@ (drop (block $y (result i32) (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $y (i32.const 3)) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $y (i32.const 3)) + ) ) ) (drop (i32.const 1)) @@ -548,10 +706,12 @@ (drop (block $z (result i32) (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $z (i32.const 2)) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $z (i32.const 2)) + ) ) ) (drop (i32.const 1)) @@ -562,10 +722,12 @@ ;; condition (block $w (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br_if $w (i32.const 3)) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br_if $w (i32.const 3)) + ) ) ) (drop (i32.const 1)) @@ -574,11 +736,13 @@ ;; not at the end (block $x1 (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x1) - (nop) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x1) + (nop) + ) ) ) (drop (i32.const 1)) @@ -589,10 +753,12 @@ (block $x2 (br_table $x2 $side (i32.const 0)) (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x2) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x2) + ) ) ) (drop (i32.const 1)) @@ -601,10 +767,12 @@ (block $x3 (br_table $side $x3 (i32.const 0)) (if (i32.const 0) - (block - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x3) + (then + (block + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x3) + ) ) ) (drop (i32.const 1)) @@ -614,267 +782,339 @@ ) (func $terminating (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) ) (func $terminating-unreachable (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (unreachable) ) (func $terminating-value (result i32) (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (i32.const 4) ) (func $terminating-just-2 (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (drop (i32.const 10)) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (drop (i32.const 10)) + (unreachable) + ) ) ) ) (func $terminating-shortness (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) ;; shorter. we do the two long ones greedily, then the merged one and this can also be opted - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) ;; shorter. we do the two long ones greedily, then the merged one and this can also be opted + (unreachable) + ) ) ) (if (i32.const 3) - (block - (drop (i32.const 10)) - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (unreachable) + (then + (block + (drop (i32.const 10)) + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (unreachable) + ) ) ) ) (func $terminating-multiple-separate (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (drop (i32.const 1)) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (drop (i32.const 1)) + (unreachable) + ) ) ) (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (drop (i32.const 1)) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (drop (i32.const 1)) + (unreachable) + ) ) ) (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (drop (i32.const 2)) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (drop (i32.const 2)) + (unreachable) + ) ) ) (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (drop (i32.const 2)) - (unreachable) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (drop (i32.const 2)) + (unreachable) + ) ) ) ) (func $terminating-just-worth-it (if (i32.const 1) - (block - (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) (nop) + (unreachable) + ) ) ) ) (func $terminating-not-worth-it (if (i32.const 1) - (block - (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) + (unreachable) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) - (unreachable) + (then + (block + (nop) (nop) + (unreachable) + ) ) ) ) (func $terminating-return (if (i32.const 1) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (return) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (return) + ) ) ) (if (i32.const 2) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (return) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (return) + ) ) ) (if (i32.const 3) - (block - (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) - (return) + (then + (block + (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) (nop) + (return) + ) ) ) ) (func $terminating-return-value (result i32) (if (i32.const 1) - (block - (nop) - (return (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (nop) + (return (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 2) - (block - (nop) - (return (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (nop) + (return (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 3) - (block - (nop) - (return (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (nop) + (return (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 3) - (block - (nop) - (return (i32.add (i32.const 111111111) (i32.const 2222222))) + (then + (block + (nop) + (return (i32.add (i32.const 111111111) (i32.const 2222222))) + ) ) ) (return (i32.const 1234)) ) (func $terminating-fallthrough-value (result i32) (if (i32.const 1) - (block - (nop) - (return (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (nop) + (return (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 2) - (block - (nop) - (return (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (nop) + (return (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 3) - (block - (nop) - (return (i32.add (i32.const 1) (i32.const 2))) + (then + (block + (nop) + (return (i32.add (i32.const 1) (i32.const 2))) + ) ) ) (if (i32.const 3) - (block - (nop) - (return (i32.add (i32.const 111111111) (i32.const 2222222))) + (then + (block + (nop) + (return (i32.add (i32.const 111111111) (i32.const 2222222))) + ) ) ) (i32.const 1234) ) (func $big-return (result i32) - (if (i32.const 1) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 2) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 3) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 4) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 5) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 6) (return (i32.add (i32.const 1) (i32.const 2)))) + (if (i32.const 1) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 2) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 3) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 4) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 5) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 6) (then (return (i32.add (i32.const 1) (i32.const 2))))) (unreachable) ) (func $return-mix (result i32) - (if (i32.const 1) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 2) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 3) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 4) (return (i32.add (i32.const 1) (i32.const 2)))) - (if (i32.const 3) (return (i32.add (i32.const 1) (i32.const 234567)))) + (if (i32.const 1) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 2) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 3) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 4) (then (return (i32.add (i32.const 1) (i32.const 2))))) + (if (i32.const 3) (then (return (i32.add (i32.const 1) (i32.const 234567))))) (return (i32.add (i32.const 1) (i32.const 2))) ;; on a block, and the toplevel in fact ) (func $just-unreachable @@ -887,42 +1127,56 @@ (block $label$0 (if (i32.const 0) - (block $label$1 - (nop) + (then + (block $label$1 + (nop) + ) ) ) (if (i32.const 0) - (block $label$2 - (nop) + (then + (block $label$2 + (nop) + ) ) - (block $label$3 - (nop) + (else + (block $label$3 + (nop) + ) ) ) (if (i32.const 0) - (block $label$4 - (nop) + (then + (block $label$4 + (nop) + ) ) - (block $label$5 - (unreachable) + (else + (block $label$5 + (unreachable) + ) ) ) (nop) (drop (if (result i32) ;; we replace this if, must replace with same type! (unreachable) - (block $label$6 (result i32) - (i32.add - (i32.const 1) - (i32.const 2) + (then + (block $label$6 (result i32) + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) - (block $label$7 (result i32) - (i32.add - (i32.const 1) - (i32.const 2) + (else + (block $label$7 (result i32) + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) ) @@ -930,16 +1184,20 @@ (drop (if (result i32) (i32.const 0) - (block $label$8 (result i32) - (i32.add - (i32.const 1) - (i32.const 2) + (then + (block $label$8 (result i32) + (i32.add + (i32.const 1) + (i32.const 2) + ) ) ) - (block $label$9 (result i32) - (i32.add - (i32.const 1) - (i32.const 333333333) + (else + (block $label$9 (result i32) + (i32.add + (i32.const 1) + (i32.const 333333333) + ) ) ) ) @@ -950,28 +1208,38 @@ (block $out (block $x (if (i32.const 0) - (block - (if (i32.const 1) - (br $out) + (then + (block + (if (i32.const 1) + (then + (br $out) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) ) ) (if (i32.const 0) - (block - (if (i32.const 1) - (br $out) + (then + (block + (if (i32.const 1) + (then + (br $out) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $x) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $x) ) ) ;; no fallthrough, another thing to merge (if (i32.const 1) - (br $out) + (then + (br $out) + ) ) (drop (i32.const 1)) (drop (i32.const 2)) @@ -984,28 +1252,38 @@ (block $out (block $x (if (i32.const 0) - (block - (if (i32.const 1) - (br $out) ;; this br cannot be moved out of the $out block! + (then + (block + (if (i32.const 1) + (then + (br $out) ;; this br cannot be moved out of the $out block! + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (return) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (return) ) ) (if (i32.const 0) - (block - (if (i32.const 1) - (br $out) + (then + (block + (if (i32.const 1) + (then + (br $out) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (return) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (return) ) ) ;; no fallthrough, another thing to merge (if (i32.const 1) - (br $out) + (then + (br $out) + ) ) (drop (i32.const 1)) (drop (i32.const 2)) @@ -1019,28 +1297,38 @@ (block $middle (block $x (if (i32.const 0) - (block - (if (i32.add (i32.const 0) (i32.const 1)) - (br $middle) + (then + (block + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $middle) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (return) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (return) ) ) (if (i32.const 0) - (block - (if (i32.add (i32.const 0) (i32.const 1)) - (br $middle) + (then + (block + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $middle) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (return) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (return) ) ) ;; no fallthrough, another thing to merge (if (i32.add (i32.const 0) (i32.const 1)) - (br $middle) + (then + (br $middle) + ) ) (drop (i32.const 1)) (drop (i32.const 2)) @@ -1055,40 +1343,50 @@ (block $middle (block $x (if (i32.const 0) - (block - (if (i32.add (i32.const 0) (i32.const 1)) - (br $middle) ;; this is dangerous - we branch to middle with is inside out, so we can't move this out of out + (then + (block + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $middle) ;; this is dangerous - we branch to middle with is inside out, so we can't move this out of out + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (drop (i32.const 3)) + (drop (i32.const 4)) + (drop (i32.const 1)) + (drop (i32.const 2)) + (drop (i32.const 3)) + (drop (i32.const 4)) + (br $out) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (drop (i32.const 3)) - (drop (i32.const 4)) - (drop (i32.const 1)) - (drop (i32.const 2)) - (drop (i32.const 3)) - (drop (i32.const 4)) - (br $out) ) ) (if (i32.const 0) - (block - (if (i32.add (i32.const 0) (i32.const 1)) - (br $middle) + (then + (block + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $middle) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (drop (i32.const 3)) + (drop (i32.const 4)) + (drop (i32.const 1)) + (drop (i32.const 2)) + (drop (i32.const 3)) + (drop (i32.const 4)) + (br $out) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (drop (i32.const 3)) - (drop (i32.const 4)) - (drop (i32.const 1)) - (drop (i32.const 2)) - (drop (i32.const 3)) - (drop (i32.const 4)) - (br $out) ) ) ;; no fallthrough, another thing to merge (if (i32.add (i32.const 0) (i32.const 1)) - (br $middle) + (then + (br $middle) + ) ) ) ) @@ -1100,28 +1398,38 @@ (block $out (block $middle (if (i32.const 0) - (block - (if (i32.add (i32.const 0) (i32.const 1)) - (br $x) ;; this is ok - we branch to x which is outside of out + (then + (block + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $x) ;; this is ok - we branch to x which is outside of out + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $out) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $out) ) ) (if (i32.const 0) - (block - (if (i32.add (i32.const 0) (i32.const 1)) - (br $x) + (then + (block + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $x) + ) + ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $out) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $out) ) ) ;; no fallthrough, another thing to merge (if (i32.add (i32.const 0) (i32.const 1)) - (br $x) + (then + (br $x) + ) ) (drop (i32.const 1)) (drop (i32.const 2)) @@ -1137,33 +1445,43 @@ (block $out (block $middle (if (i32.const 0) - (block - (block $x - (if (i32.add (i32.const 0) (i32.const 1)) - (br $x) ;; this is ok - we branch to x which is nested in us + (then + (block + (block $x + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $x) ;; this is ok - we branch to x which is nested in us + ) + ) ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $out) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $out) ) ) (if (i32.const 0) - (block - (block $x - (if (i32.add (i32.const 0) (i32.const 1)) - (br $x) ;; this is ok - we branch to x which is nested in us + (then + (block + (block $x + (if (i32.add (i32.const 0) (i32.const 1)) + (then + (br $x) ;; this is ok - we branch to x which is nested in us + ) + ) ) + (drop (i32.const 1)) + (drop (i32.const 2)) + (br $out) ) - (drop (i32.const 1)) - (drop (i32.const 2)) - (br $out) ) ) ;; no fallthrough, another thing to merge (block $x (if (i32.add (i32.const 0) (i32.const 1)) - (br $x) ;; this is ok - we branch to x which is nested in us + (then + (br $x) ;; this is ok - we branch to x which is nested in us + ) ) ) (drop (i32.const 1)) @@ -1176,19 +1494,27 @@ (func $if-suffix (param $x i32) (result i32) (if (local.get $x) - (local.set $x (i32.const 1)) - (block - (drop (call $if-suffix (i32.const -1))) + (then (local.set $x (i32.const 1)) ) + (else + (block + (drop (call $if-suffix (i32.const -1))) + (local.set $x (i32.const 1)) + ) + ) ) (if (result i32) (local.get $x) - (i32.const 2) - (block (result i32) - (drop (call $if-suffix (i32.const -2))) + (then (i32.const 2) ) + (else + (block (result i32) + (drop (call $if-suffix (i32.const -2))) + (i32.const 2) + ) + ) ) ) ) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index ac7647507..05f27ea4c 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -767,14 +767,16 @@ (local.get $0) (local.get $1) ) - (nop) + (then + (nop) + ) ) ) (func $do-reorder (type $i) (param $x i32) (local $y i32) (if (i32.const 1) - (block + (then (local.set $y (i32.const 5) ) @@ -791,14 +793,16 @@ (local $y i32) (if (i32.const 1) - (local.set $x - (i32.le_u - (local.get $y) - (block (result i32) - (local.set $y - (i32.const 5) + (then + (local.set $x + (i32.le_u + (local.get $y) + (block (result i32) + (local.set $y + (i32.const 5) + ) + (i32.const 10) ) - (i32.const 10) ) ) ) @@ -959,8 +963,10 @@ (block $l5 (if (i32.const 10) - (br_if $l5 - (i32.const 11) + (then + (br_if $l5 + (i32.const 11) + ) ) ) (drop @@ -1100,8 +1106,10 @@ (loop $l5 (if (i32.const 10) - (br_if $l5 - (i32.const 11) + (then + (br_if $l5 + (i32.const 11) + ) ) ) ) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.wast b/test/passes/remove-unused-names_merge-blocks_all-features.wast index 1063e2463..3a159abd9 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.wast +++ b/test/passes/remove-unused-names_merge-blocks_all-features.wast @@ -945,19 +945,23 @@ (local.get $1) ) ) - (nop) + (then + (nop) + ) ) ) (func $do-reorder (param $x i32) (local $y i32) (if (i32.const 1) - (block - (local.set $x - (i32.le_u - (local.get $x) - (block (result i32) - (local.set $y (i32.const 5)) - (i32.const 10) + (then + (block + (local.set $x + (i32.le_u + (local.get $x) + (block (result i32) + (local.set $y (i32.const 5)) + (i32.const 10) + ) ) ) ) @@ -967,13 +971,15 @@ (func $do-not-reorder (param $x i32) (local $y i32) (if (i32.const 1) - (block - (local.set $x - (i32.le_u - (local.get $y) - (block (result i32) - (local.set $y (i32.const 5)) - (i32.const 10) + (then + (block + (local.set $x + (i32.le_u + (local.get $y) + (block (result i32) + (local.set $y (i32.const 5)) + (i32.const 10) + ) ) ) ) @@ -1123,7 +1129,9 @@ ) (block $l5 (if (i32.const 10) - (br_if $l5 (i32.const 11)) + (then + (br_if $l5 (i32.const 11)) + ) ) (drop (i32.const 12)) ) @@ -1201,7 +1209,9 @@ ) (loop $l5 (if (i32.const 10) - (br_if $l5 (i32.const 11)) + (then + (br_if $l5 (i32.const 11)) + ) ) (drop (i32.const 12)) ) diff --git a/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt b/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt index a5e0c17ff..2a157dcf9 100644 --- a/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt +++ b/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt @@ -68,28 +68,38 @@ (local $var$8 i32) (if (local.get $var$4) - (block $label$3 - (block - (if - (local.get $var$8) - (loop $label$8 - (if - (local.get $var$3) - (br $label$8) - ) - ) + (then + (block $label$3 + (block (if - (i32.eqz - (local.get $var$6) + (local.get $var$8) + (then + (loop $label$8 + (if + (local.get $var$3) + (then + (br $label$8) + ) + ) + ) + ) + (else + (if + (i32.eqz + (local.get $var$6) + ) + (then + (br $label$3) + ) + ) ) - (br $label$3) ) - ) - (drop - (call $23 - (local.get $var$7) - (local.get $var$4) - (local.get $var$0) + (drop + (call $23 + (local.get $var$7) + (local.get $var$4) + (local.get $var$0) + ) ) ) ) diff --git a/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast b/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast index f1e1d6ad3..54d0fbdf9 100644 --- a/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast +++ b/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast @@ -78,42 +78,56 @@ (block $label$3 (if (local.get $var$4) - (block $label$4 - (if - (local.get $var$8) - (block $label$7 - (loop $label$8 - (block $label$9 + (then + (block $label$4 + (if + (local.get $var$8) + (then + (block $label$7 + (loop $label$8 + (block $label$9 + (if + (local.get $var$3) + (then + (block $label$12 ;; these empty blocks must never be unreachable-typed + ) + ) + (else + (block $label$13 + (br $label$9) + ) + ) + ) + (br $label$8) + ) + ) + ) + ) + (else + (block $label$16 (if - (local.get $var$3) - (block $label$12 ;; these empty blocks must never be unreachable-typed + (local.get $var$6) + (then + (block $label$17 + ) ) - (block $label$13 - (br $label$9) + (else + (block $label$18 + (br $label$3) + ) ) ) - (br $label$8) ) ) ) - (block $label$16 - (if - (local.get $var$6) - (block $label$17 - ) - (block $label$18 - (br $label$3) - ) + (drop + (call $23 + (local.get $var$7) + (local.get $var$4) + (local.get $var$0) ) ) ) - (drop - (call $23 - (local.get $var$7) - (local.get $var$4) - (local.get $var$0) - ) - ) ) ) ) @@ -130,10 +144,14 @@ (i32.load8_s (i32.const 201460482) ) - (br $label$0) - (block $label$3 - (br_if $label$3 - (local.get $0) + (then + (br $label$0) + ) + (else + (block $label$3 + (br_if $label$3 + (local.get $0) + ) ) ) ) diff --git a/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.wast b/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.wast index 532fdc7c8..e6ccc84aa 100644 --- a/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.wast +++ b/test/passes/remove-unused-names_vacuum_ignore-implicit-traps.wast @@ -27,18 +27,22 @@ (drop (if (result f64) (i32.const 1) - (block (result f64) - (nop) - (f64.load - (i32.const 19) + (then + (block (result f64) + (nop) + (f64.load + (i32.const 19) + ) ) ) - (block - (drop - (f64.const 1) + (else + (block + (drop + (f64.const 1) + ) + (br $label$1) + (nop) ) - (br $label$1) - (nop) ) ) ) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt index b54087b81..88998c6ca 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt @@ -292,8 +292,12 @@ (f64.const 1) (f64.const 1) ) - (f64.const 1) - (f64.const 0) + (then + (f64.const 1) + ) + (else + (f64.const 0) + ) ) ) ) @@ -306,11 +310,15 @@ (f64.const 1) (f64.const 1) ) - (call_indirect $0 (type $0) - (f64.const 1) - (i32.const 0) + (then + (call_indirect $0 (type $0) + (f64.const 1) + (i32.const 0) + ) + ) + (else + (f64.const 0) ) - (f64.const 0) ) ) ) @@ -324,8 +332,12 @@ (f64.const 1) (f64.const 1) ) - (f64.const 1) - (f64.const 0) + (then + (f64.const 1) + ) + (else + (f64.const 0) + ) ) ) ) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.wast b/test/passes/remove-unused-nonfunction-module-elements_all-features.wast index 942a20ee7..5ed444ca2 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.wast +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.wast @@ -227,8 +227,12 @@ (f64.const 1) (f64.const 1) ) - (f64.const 1) - (f64.const 0) + (then + (f64.const 1) + ) + (else + (f64.const 0) + ) ) ) ) @@ -241,8 +245,12 @@ (f64.const 1) (f64.const 1) ) - (call_indirect (type $0) (f64.const 1) (i32.const 0)) - (f64.const 0) + (then + (call_indirect (type $0) (f64.const 1) (i32.const 0)) + ) + (else + (f64.const 0) + ) ) ) ) @@ -256,8 +264,12 @@ (f64.const 1) (f64.const 1) ) - (f64.const 1) - (f64.const 0) + (then + (f64.const 1) + ) + (else + (f64.const 0) + ) ) ) ) diff --git a/test/passes/reverse_dwarf_abbrevs.bin.txt b/test/passes/reverse_dwarf_abbrevs.bin.txt index cbc04ac43..2500b625b 100644 --- a/test/passes/reverse_dwarf_abbrevs.bin.txt +++ b/test/passes/reverse_dwarf_abbrevs.bin.txt @@ -175,10 +175,12 @@ file_names[ 1]: ;; code offset: 0x1d (local.get $0) ) - ;; code offset: 0x24 - (return - ;; code offset: 0x22 - (i32.const 0) + (then + ;; code offset: 0x24 + (return + ;; code offset: 0x22 + (i32.const 0) + ) ) ) ;; code offset: 0x2a @@ -325,177 +327,179 @@ file_names[ 1]: ) ) ) - ;; code offset: 0xa7 - (loop $label$5 - ;; code offset: 0xb3 - (br_if $label$3 - ;; code offset: 0xb2 - (i32.eq - ;; code offset: 0xa9 - (local.get $6) - ;; code offset: 0xb0 - (local.tee $4 - ;; code offset: 0xad - (i32.load offset=12 - ;; code offset: 0xab - (local.get $3) + (then + ;; code offset: 0xa7 + (loop $label$5 + ;; code offset: 0xb3 + (br_if $label$3 + ;; code offset: 0xb2 + (i32.eq + ;; code offset: 0xa9 + (local.get $6) + ;; code offset: 0xb0 + (local.tee $4 + ;; code offset: 0xad + (i32.load offset=12 + ;; code offset: 0xab + (local.get $3) + ) ) ) ) - ) - ;; code offset: 0xba - (br_if $label$2 - ;; code offset: 0xb9 - (i32.le_s - ;; code offset: 0xb5 - (local.get $4) - ;; code offset: 0xb7 - (i32.const -1) + ;; code offset: 0xba + (br_if $label$2 + ;; code offset: 0xb9 + (i32.le_s + ;; code offset: 0xb5 + (local.get $4) + ;; code offset: 0xb7 + (i32.const -1) + ) ) - ) - ;; code offset: 0xe2 - (i32.store - ;; code offset: 0xce - (local.tee $9 - ;; code offset: 0xcd - (i32.add - ;; code offset: 0xbc - (local.get $1) - ;; code offset: 0xcc - (i32.shl - ;; code offset: 0xc8 - (local.tee $5 - ;; code offset: 0xc7 - (i32.gt_u - ;; code offset: 0xbe - (local.get $4) - ;; code offset: 0xc5 - (local.tee $8 - ;; code offset: 0xc2 - (i32.load offset=4 - ;; code offset: 0xc0 - (local.get $1) + ;; code offset: 0xe2 + (i32.store + ;; code offset: 0xce + (local.tee $9 + ;; code offset: 0xcd + (i32.add + ;; code offset: 0xbc + (local.get $1) + ;; code offset: 0xcc + (i32.shl + ;; code offset: 0xc8 + (local.tee $5 + ;; code offset: 0xc7 + (i32.gt_u + ;; code offset: 0xbe + (local.get $4) + ;; code offset: 0xc5 + (local.tee $8 + ;; code offset: 0xc2 + (i32.load offset=4 + ;; code offset: 0xc0 + (local.get $1) + ) ) ) ) + ;; code offset: 0xca + (i32.const 3) + ) + ) + ) + ;; code offset: 0xe1 + (i32.add + ;; code offset: 0xda + (local.tee $8 + ;; code offset: 0xd9 + (i32.sub + ;; code offset: 0xd0 + (local.get $4) + ;; code offset: 0xd8 + (select + ;; code offset: 0xd2 + (local.get $8) + ;; code offset: 0xd4 + (i32.const 0) + ;; code offset: 0xd6 + (local.get $5) + ) ) - ;; code offset: 0xca - (i32.const 3) + ) + ;; code offset: 0xde + (i32.load + ;; code offset: 0xdc + (local.get $9) ) ) ) - ;; code offset: 0xe1 - (i32.add - ;; code offset: 0xda - (local.tee $8 - ;; code offset: 0xd9 - (i32.sub - ;; code offset: 0xd0 - (local.get $4) - ;; code offset: 0xd8 + ;; code offset: 0xf9 + (i32.store + ;; code offset: 0xef + (local.tee $9 + ;; code offset: 0xee + (i32.add + ;; code offset: 0xe5 + (local.get $1) + ;; code offset: 0xed (select - ;; code offset: 0xd2 - (local.get $8) - ;; code offset: 0xd4 - (i32.const 0) - ;; code offset: 0xd6 + ;; code offset: 0xe7 + (i32.const 12) + ;; code offset: 0xe9 + (i32.const 4) + ;; code offset: 0xeb (local.get $5) ) ) ) - ;; code offset: 0xde - (i32.load - ;; code offset: 0xdc - (local.get $9) - ) - ) - ) - ;; code offset: 0xf9 - (i32.store - ;; code offset: 0xef - (local.tee $9 - ;; code offset: 0xee - (i32.add - ;; code offset: 0xe5 - (local.get $1) - ;; code offset: 0xed - (select - ;; code offset: 0xe7 - (i32.const 12) - ;; code offset: 0xe9 - (i32.const 4) - ;; code offset: 0xeb - (local.get $5) + ;; code offset: 0xf8 + (i32.sub + ;; code offset: 0xf3 + (i32.load + ;; code offset: 0xf1 + (local.get $9) ) + ;; code offset: 0xf6 + (local.get $8) ) ) - ;; code offset: 0xf8 - (i32.sub - ;; code offset: 0xf3 - (i32.load - ;; code offset: 0xf1 - (local.get $9) + ;; code offset: 0x101 + (local.set $6 + ;; code offset: 0x100 + (i32.sub + ;; code offset: 0xfc + (local.get $6) + ;; code offset: 0xfe + (local.get $4) ) - ;; code offset: 0xf6 - (local.get $8) - ) - ) - ;; code offset: 0x101 - (local.set $6 - ;; code offset: 0x100 - (i32.sub - ;; code offset: 0xfc - (local.get $6) - ;; code offset: 0xfe - (local.get $4) ) - ) - ;; code offset: 0x125 - (br_if $label$5 - ;; code offset: 0x124 - (i32.eqz - ;; code offset: 0x122 - (call $4 - ;; code offset: 0x120 - (call $fimport$0 - ;; code offset: 0x105 - (i32.load offset=60 - ;; code offset: 0x103 - (local.get $0) - ) - ;; code offset: 0x112 - (local.tee $1 - ;; code offset: 0x111 - (select - ;; code offset: 0x10c - (i32.add - ;; code offset: 0x108 + ;; code offset: 0x125 + (br_if $label$5 + ;; code offset: 0x124 + (i32.eqz + ;; code offset: 0x122 + (call $4 + ;; code offset: 0x120 + (call $fimport$0 + ;; code offset: 0x105 + (i32.load offset=60 + ;; code offset: 0x103 + (local.get $0) + ) + ;; code offset: 0x112 + (local.tee $1 + ;; code offset: 0x111 + (select + ;; code offset: 0x10c + (i32.add + ;; code offset: 0x108 + (local.get $1) + ;; code offset: 0x10a + (i32.const 8) + ) + ;; code offset: 0x10d (local.get $1) - ;; code offset: 0x10a - (i32.const 8) + ;; code offset: 0x10f + (local.get $5) ) - ;; code offset: 0x10d - (local.get $1) - ;; code offset: 0x10f - (local.get $5) ) - ) - ;; code offset: 0x119 - (local.tee $7 - ;; code offset: 0x118 - (i32.sub - ;; code offset: 0x114 - (local.get $7) - ;; code offset: 0x116 - (local.get $5) + ;; code offset: 0x119 + (local.tee $7 + ;; code offset: 0x118 + (i32.sub + ;; code offset: 0x114 + (local.get $7) + ;; code offset: 0x116 + (local.get $5) + ) + ) + ;; code offset: 0x11f + (i32.add + ;; code offset: 0x11b + (local.get $3) + ;; code offset: 0x11d + (i32.const 12) ) - ) - ;; code offset: 0x11f - (i32.add - ;; code offset: 0x11b - (local.get $3) - ;; code offset: 0x11d - (i32.const 12) ) ) ) @@ -682,7 +686,7 @@ file_names[ 1]: ;; code offset: 0x1c0 (i32.const 8) ) - (block + (then ;; code offset: 0x1cc (i32.store ;; code offset: 0x1c5 @@ -760,7 +764,7 @@ file_names[ 1]: ;; code offset: 0x208 (i32.const 512) ) - (block + (then ;; code offset: 0x216 (drop ;; code offset: 0x214 @@ -809,7 +813,7 @@ file_names[ 1]: (i32.const 3) ) ) - (block + (then ;; code offset: 0x22f (block $label$4 ;; code offset: 0x236 @@ -821,7 +825,7 @@ file_names[ 1]: ;; code offset: 0x233 (i32.const 1) ) - (block + (then ;; code offset: 0x23a (local.set $2 ;; code offset: 0x238 @@ -843,7 +847,7 @@ file_names[ 1]: (i32.const 3) ) ) - (block + (then ;; code offset: 0x249 (local.set $2 ;; code offset: 0x247 @@ -1204,7 +1208,7 @@ file_names[ 1]: ;; code offset: 0x378 (i32.const 4) ) - (block + (then ;; code offset: 0x37f (local.set $2 ;; code offset: 0x37d @@ -1231,7 +1235,7 @@ file_names[ 1]: ;; code offset: 0x38b (local.get $0) ) - (block + (then ;; code offset: 0x392 (local.set $2 ;; code offset: 0x390 @@ -1327,44 +1331,46 @@ file_names[ 1]: ;; code offset: 0x3dc (local.get $3) ) - ;; code offset: 0x3e1 - (loop $label$15 - ;; code offset: 0x3ea - (i32.store8 - ;; code offset: 0x3e3 - (local.get $2) - ;; code offset: 0x3e7 - (i32.load8_u - ;; code offset: 0x3e5 - (local.get $1) + (then + ;; code offset: 0x3e1 + (loop $label$15 + ;; code offset: 0x3ea + (i32.store8 + ;; code offset: 0x3e3 + (local.get $2) + ;; code offset: 0x3e7 + (i32.load8_u + ;; code offset: 0x3e5 + (local.get $1) + ) ) - ) - ;; code offset: 0x3f2 - (local.set $1 - ;; code offset: 0x3f1 - (i32.add - ;; code offset: 0x3ed - (local.get $1) - ;; code offset: 0x3ef - (i32.const 1) + ;; code offset: 0x3f2 + (local.set $1 + ;; code offset: 0x3f1 + (i32.add + ;; code offset: 0x3ed + (local.get $1) + ;; code offset: 0x3ef + (i32.const 1) + ) ) - ) - ;; code offset: 0x3fe - (br_if $label$15 - ;; code offset: 0x3fd - (i32.ne - ;; code offset: 0x3f9 - (local.tee $2 - ;; code offset: 0x3f8 - (i32.add - ;; code offset: 0x3f4 - (local.get $2) - ;; code offset: 0x3f6 - (i32.const 1) + ;; code offset: 0x3fe + (br_if $label$15 + ;; code offset: 0x3fd + (i32.ne + ;; code offset: 0x3f9 + (local.tee $2 + ;; code offset: 0x3f8 + (i32.add + ;; code offset: 0x3f4 + (local.get $2) + ;; code offset: 0x3f6 + (i32.const 1) + ) ) + ;; code offset: 0x3fb + (local.get $3) ) - ;; code offset: 0x3fb - (local.get $3) ) ) ) @@ -1395,7 +1401,7 @@ file_names[ 1]: ) ) ) - (block + (then ;; code offset: 0x422 (br_if $label$1 ;; code offset: 0x420 @@ -1433,20 +1439,22 @@ file_names[ 1]: (local.get $1) ) ) - ;; code offset: 0x44a - (return - ;; code offset: 0x447 - (call_indirect (type $1) - ;; code offset: 0x43c - (local.get $2) - ;; code offset: 0x43e - (local.get $0) - ;; code offset: 0x440 - (local.get $1) - ;; code offset: 0x444 - (i32.load offset=36 - ;; code offset: 0x442 + (then + ;; code offset: 0x44a + (return + ;; code offset: 0x447 + (call_indirect (type $1) + ;; code offset: 0x43c (local.get $2) + ;; code offset: 0x43e + (local.get $0) + ;; code offset: 0x440 + (local.get $1) + ;; code offset: 0x444 + (i32.load offset=36 + ;; code offset: 0x442 + (local.get $2) + ) ) ) ) @@ -1638,7 +1646,7 @@ file_names[ 1]: ;; code offset: 0x4dc (i32.const -1) ) - (block + (then ;; code offset: 0x4e9 (local.set $0 ;; code offset: 0x4e7 @@ -1698,16 +1706,18 @@ file_names[ 1]: ;; code offset: 0x50a (local.get $4) ) - ;; code offset: 0x516 - (return - ;; code offset: 0x515 - (select - ;; code offset: 0x50f - (local.get $2) - ;; code offset: 0x511 - (i32.const 0) - ;; code offset: 0x513 - (local.get $1) + (then + ;; code offset: 0x516 + (return + ;; code offset: 0x515 + (select + ;; code offset: 0x50f + (local.get $2) + ;; code offset: 0x511 + (i32.const 0) + ;; code offset: 0x513 + (local.get $1) + ) ) ) ) @@ -1790,7 +1800,7 @@ file_names[ 1]: ) ) ) - (block + (then ;; code offset: 0x560 (local.set $2 ;; code offset: 0x55e @@ -1950,12 +1960,14 @@ file_names[ 1]: ;; code offset: 0x5df (i32.const 0) ) - ;; code offset: 0x5e8 - (local.set $2 - ;; code offset: 0x5e6 - (call $15 - ;; code offset: 0x5e4 - (local.get $1) + (then + ;; code offset: 0x5e8 + (local.set $2 + ;; code offset: 0x5e6 + (call $15 + ;; code offset: 0x5e4 + (local.get $1) + ) ) ) ) @@ -2060,10 +2072,12 @@ file_names[ 1]: (if ;; code offset: 0x638 (local.get $2) - ;; code offset: 0x63e - (call $16 - ;; code offset: 0x63c - (local.get $1) + (then + ;; code offset: 0x63e + (call $16 + ;; code offset: 0x63c + (local.get $1) + ) ) ) ;; code offset: 0x641 @@ -2112,10 +2126,12 @@ file_names[ 1]: (local.get $0) ) ) - ;; code offset: 0x670 - (return - ;; code offset: 0x66e - (i32.const 0) + (then + ;; code offset: 0x670 + (return + ;; code offset: 0x66e + (i32.const 0) + ) ) ) ;; code offset: 0x672 @@ -2215,14 +2231,16 @@ file_names[ 1]: (i32.const 255) ) ) - ;; code offset: 0x6c3 - (return - ;; code offset: 0x6c2 - (i32.sub - ;; code offset: 0x6be - (local.get $2) - ;; code offset: 0x6c0 - (local.get $0) + (then + ;; code offset: 0x6c3 + (return + ;; code offset: 0x6c2 + (i32.sub + ;; code offset: 0x6be + (local.get $2) + ;; code offset: 0x6c0 + (local.get $0) + ) ) ) ) diff --git a/test/passes/roundtrip_signed.bin.txt b/test/passes/roundtrip_signed.bin.txt index ea3fb8646..686a35260 100644 --- a/test/passes/roundtrip_signed.bin.txt +++ b/test/passes/roundtrip_signed.bin.txt @@ -9,7 +9,9 @@ (i32.eqz (global.get $global$0) ) - (return) + (then + (return) + ) ) (global.set $global$0 (i32.sub diff --git a/test/passes/rse_all-features.txt b/test/passes/rse_all-features.txt index 33032d47b..acc037290 100644 --- a/test/passes/rse_all-features.txt +++ b/test/passes/rse_all-features.txt @@ -118,11 +118,15 @@ (local $x i32) (if (i32.const 0) - (local.set $x - (i32.const 1) + (then + (local.set $x + (i32.const 1) + ) ) - (local.set $x - (i32.const 1) + (else + (local.set $x + (i32.const 1) + ) ) ) (drop @@ -135,11 +139,15 @@ (local.tee $x (i32.const 1) ) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (drop - (i32.const 1) + (else + (drop + (i32.const 1) + ) ) ) (drop @@ -152,11 +160,15 @@ (local.tee $x (i32.const 1) ) - (drop - (i32.const 1) + (then + (drop + (i32.const 1) + ) ) - (local.set $x - (i32.const 2) + (else + (local.set $x + (i32.const 2) + ) ) ) (local.set $x @@ -180,8 +192,12 @@ ) (if (i32.const 1) - (nop) - (nop) + (then + (nop) + ) + (else + (nop) + ) ) (local.set $y (local.get $x) @@ -191,8 +207,12 @@ ) (if (i32.const 1) - (nop) - (nop) + (then + (nop) + ) + (else + (nop) + ) ) (drop (i32.const 2) @@ -259,8 +279,12 @@ ) (if (i32.const 1) - (nop) - (nop) + (then + (nop) + ) + (else + (nop) + ) ) (local.set $y (local.get $x) @@ -278,8 +302,12 @@ ) (if (i32.const 1) - (nop) - (nop) + (then + (nop) + ) + (else + (nop) + ) ) (drop (local.get $x) @@ -310,11 +338,15 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 1) + (then + (local.set $x + (i32.const 1) + ) ) - (local.set $x - (i32.const 1) + (else + (local.set $x + (i32.const 1) + ) ) ) (drop @@ -347,9 +379,13 @@ ) (if (i32.const 1) - (nop) - (drop - (local.get $1) + (then + (nop) + ) + (else + (drop + (local.get $1) + ) ) ) ) @@ -359,8 +395,10 @@ ) (if (i32.const 1) - (drop - (local.get $1) + (then + (drop + (local.get $1) + ) ) ) ) @@ -388,8 +426,10 @@ ) (if (i32.const 0) - (drop - (local.get $0) + (then + (drop + (local.get $0) + ) ) ) ) @@ -399,7 +439,7 @@ (block $label$5 (if (i32.const 1) - (block + (then (local.set $x (i32.const 203) ) @@ -415,10 +455,16 @@ (if (if (result i32) (i32.const 3) - (i32.const 4) - (i32.const 5) + (then + (i32.const 4) + ) + (else + (i32.const 5) + ) + ) + (then + (br $label$7) ) - (br $label$7) ) ) ) @@ -426,10 +472,14 @@ (local $var$1 i32) (if (i32.const 0) - (if - (i32.const 1) - (local.set $var$1 - (i32.const 2) + (then + (if + (i32.const 1) + (then + (local.set $var$1 + (i32.const 2) + ) + ) ) ) ) @@ -437,8 +487,10 @@ (block $label$11 (if (i32.const 5) - (br_if $label$11 - (i32.const 6) + (then + (br_if $label$11 + (i32.const 6) + ) ) ) (br $label$10) @@ -469,8 +521,10 @@ ) (if (i32.const 0) - (drop - (local.get $0) + (then + (drop + (local.get $0) + ) ) ) ) diff --git a/test/passes/rse_all-features.wast b/test/passes/rse_all-features.wast index 7ac7a0579..6e08a1c94 100644 --- a/test/passes/rse_all-features.wast +++ b/test/passes/rse_all-features.wast @@ -59,24 +59,36 @@ (func $if (local $x i32) (if (local.tee $x (i32.const 0)) - (local.set $x (i32.const 1)) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) + (else + (local.set $x (i32.const 1)) + ) ) (local.set $x (i32.const 1)) ) (func $if2 (local $x i32) (if (local.tee $x (i32.const 1)) - (local.set $x (i32.const 1)) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) + (else + (local.set $x (i32.const 1)) + ) ) (local.set $x (i32.const 1)) ) (func $if3 (local $x i32) (if (local.tee $x (i32.const 1)) - (local.set $x (i32.const 1)) - (local.set $x (i32.const 2)) + (then + (local.set $x (i32.const 1)) + ) + (else + (local.set $x (i32.const 2)) + ) ) (local.set $x (i32.const 1)) ) @@ -87,10 +99,10 @@ (local.set $y (local.get $x)) (local.set $y (i32.const 1)) (local.set $x (i32.const 2)) - (if (i32.const 1) (nop) (nop)) ;; control flow + (if (i32.const 1) (then (nop) )(else (nop))) ;; control flow (local.set $y (local.get $x)) (local.set $y (i32.const 2)) - (if (i32.const 1) (nop) (nop)) ;; control flow + (if (i32.const 1) (then (nop) )(else (nop))) ;; control flow (local.set $y (i32.const 2)) ;; flip (local.set $x (i32.const 3)) @@ -116,12 +128,12 @@ (local.set $y (local.get $x)) (local.set $y (local.get $x)) (local.set $x (i32.eqz (i32.const 789))) - (if (i32.const 1) (nop) (nop)) ;; control flow + (if (i32.const 1) (then (nop) )(else (nop))) ;; control flow (local.set $y (local.get $x)) (local.set $y (local.get $x)) (local.set $x (i32.eqz (i32.const 1000))) (local.set $y (local.get $x)) - (if (i32.const 1) (nop) (nop)) ;; control flow + (if (i32.const 1) (then (nop) )(else (nop))) ;; control flow (local.set $y (local.get $x)) ) (func $identical_complex (param $x i32) @@ -136,8 +148,12 @@ (func $merge (local $x i32) (if (i32.const 1) - (local.set $x (i32.const 1)) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) + (else + (local.set $x (i32.const 1)) + ) ) (local.set $x (i32.const 1)) (local.set $x (i32.const 2)) @@ -157,9 +173,13 @@ ) (if (i32.const 1) - (nop) - (local.set $3 - (local.get $1) + (then + (nop) + ) + (else + (local.set $3 + (local.get $1) + ) ) ) ) @@ -171,8 +191,10 @@ ) (if (i32.const 1) - (local.set $3 - (local.get $1) + (then + (local.set $3 + (local.get $1) + ) ) ) ) @@ -200,8 +222,10 @@ ) (if (i32.const 0) - (local.set $1 ;; we can drop this - (local.get $0) + (then + (local.set $1 ;; we can drop this + (local.get $0) + ) ) ) ) @@ -211,11 +235,13 @@ (block $label$5 (if (i32.const 1) - (block - (local.set $x - (i32.const 203) + (then + (block + (local.set $x + (i32.const 203) + ) + (br $label$5) ) - (br $label$5) ) ) (br_if $label$4 @@ -227,10 +253,16 @@ (if (if (result i32) (i32.const 3) - (i32.const 4) - (i32.const 5) + (then + (i32.const 4) + ) + (else + (i32.const 5) + ) + ) + (then + (br $label$7) ) - (br $label$7) ) ) ) @@ -238,10 +270,14 @@ (local $var$1 i32) (if (i32.const 0) - (if - (i32.const 1) - (local.set $var$1 - (i32.const 2) + (then + (if + (i32.const 1) + (then + (local.set $var$1 + (i32.const 2) + ) + ) ) ) ) @@ -249,8 +285,10 @@ (block $label$11 (if (i32.const 5) - (br_if $label$11 - (i32.const 6) + (then + (br_if $label$11 + (i32.const 6) + ) ) ) (br $label$10) @@ -281,8 +319,10 @@ ) (if (i32.const 0) - (local.set $1 ;; we can drop this - (local.get $0) + (then + (local.set $1 ;; we can drop this + (local.get $0) + ) ) ) ) diff --git a/test/passes/safe-heap_disable-simd.txt b/test/passes/safe-heap_disable-simd.txt index a678bc0dc..bb55667b1 100644 --- a/test/passes/safe-heap_disable-simd.txt +++ b/test/passes/safe-heap_disable-simd.txt @@ -37,7 +37,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -67,7 +69,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -97,7 +101,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -127,14 +133,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -164,7 +174,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -194,14 +206,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -231,7 +247,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -261,14 +279,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -298,14 +320,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -335,7 +361,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -365,7 +393,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -395,7 +425,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -425,14 +457,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -462,7 +498,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -492,14 +530,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -529,7 +571,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -559,14 +603,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -596,14 +644,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -633,7 +685,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -663,14 +717,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -700,14 +758,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -737,7 +799,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -767,14 +831,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -804,14 +872,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -841,14 +913,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -878,7 +954,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -908,14 +986,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -945,14 +1027,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -982,7 +1068,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -1012,14 +1100,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -1049,14 +1141,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -1086,14 +1182,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -1123,7 +1223,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -1154,7 +1256,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -1185,14 +1289,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -1223,7 +1331,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -1254,14 +1364,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -1292,14 +1406,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -1330,7 +1448,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -1361,7 +1481,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -1392,14 +1514,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -1430,7 +1556,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -1461,14 +1589,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -1499,14 +1631,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -1537,7 +1673,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -1568,14 +1706,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -1606,14 +1748,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -1644,14 +1790,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -1682,7 +1832,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -1713,14 +1865,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -1751,14 +1907,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -1789,7 +1949,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -1820,14 +1982,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -1858,14 +2024,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -1896,14 +2066,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -1950,7 +2124,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -1980,7 +2156,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -2010,7 +2188,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -2040,14 +2220,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -2077,7 +2261,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -2107,14 +2293,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -2144,7 +2334,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -2174,14 +2366,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -2211,14 +2407,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -2248,7 +2448,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -2278,7 +2480,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -2308,7 +2512,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -2338,14 +2544,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -2375,7 +2585,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -2405,14 +2617,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -2442,7 +2658,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -2472,14 +2690,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -2509,14 +2731,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -2546,7 +2772,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -2576,14 +2804,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -2613,14 +2845,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -2650,7 +2886,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -2680,14 +2918,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -2717,14 +2959,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -2754,14 +3000,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -2791,7 +3041,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -2821,14 +3073,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -2858,14 +3114,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -2895,7 +3155,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -2925,14 +3187,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -2962,14 +3228,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -2999,14 +3269,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -3036,7 +3310,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -3067,7 +3343,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -3098,14 +3376,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -3136,7 +3418,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -3167,14 +3451,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -3205,14 +3493,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -3243,7 +3535,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -3274,7 +3568,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -3305,14 +3601,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -3343,7 +3643,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -3374,14 +3676,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -3412,14 +3718,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -3450,7 +3760,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -3481,14 +3793,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -3519,14 +3835,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -3557,14 +3877,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -3595,7 +3919,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -3626,14 +3952,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -3664,14 +3994,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -3702,7 +4036,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -3733,14 +4069,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -3771,14 +4111,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -3809,14 +4153,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -3871,7 +4219,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -3901,7 +4251,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -3931,7 +4283,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -3961,14 +4315,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -3998,7 +4356,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -4028,14 +4388,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -4065,7 +4429,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -4095,14 +4461,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -4132,14 +4502,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -4169,7 +4543,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -4199,7 +4575,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -4229,7 +4607,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -4259,14 +4639,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -4296,7 +4680,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -4326,14 +4712,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -4363,7 +4753,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -4393,14 +4785,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -4430,14 +4826,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -4467,7 +4867,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -4497,14 +4899,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -4534,14 +4940,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -4571,7 +4981,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -4601,14 +5013,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -4638,14 +5054,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -4675,14 +5095,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -4712,7 +5136,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -4742,14 +5168,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -4779,14 +5209,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -4816,7 +5250,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -4846,14 +5282,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -4883,14 +5323,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -4920,14 +5364,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -4957,7 +5405,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -4988,7 +5438,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -5019,14 +5471,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -5057,7 +5513,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -5088,14 +5546,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -5126,14 +5588,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -5164,7 +5630,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -5195,7 +5663,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -5226,14 +5696,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -5264,7 +5738,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -5295,14 +5771,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -5333,14 +5813,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -5371,7 +5855,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -5402,14 +5888,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -5440,14 +5930,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -5478,14 +5972,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -5516,7 +6014,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -5547,14 +6047,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -5585,14 +6089,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -5623,7 +6131,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -5654,14 +6164,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -5692,14 +6206,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -5730,14 +6248,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) diff --git a/test/passes/safe-heap_enable-threads_enable-simd.txt b/test/passes/safe-heap_enable-threads_enable-simd.txt index c1f811007..aeea4f02c 100644 --- a/test/passes/safe-heap_enable-threads_enable-simd.txt +++ b/test/passes/safe-heap_enable-threads_enable-simd.txt @@ -208,7 +208,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.shr_s (i32.shl @@ -244,7 +246,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -274,7 +278,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.load8_u (local.get $2) @@ -304,7 +310,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -334,7 +342,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -364,14 +374,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.shr_s (i32.shl @@ -407,14 +421,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -444,7 +462,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -474,14 +494,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load16_u (local.get $2) @@ -511,14 +535,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -548,7 +576,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -578,14 +608,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -615,14 +649,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load (local.get $2) @@ -652,14 +690,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -689,7 +731,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.shr_s (i64.shl @@ -725,7 +769,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -755,7 +801,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.load8_u (local.get $2) @@ -785,7 +833,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -815,7 +865,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -845,14 +897,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -888,14 +944,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -925,7 +985,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -955,14 +1017,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load16_u (local.get $2) @@ -992,14 +1058,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -1029,7 +1099,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -1059,14 +1131,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -1096,14 +1172,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -1139,14 +1219,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -1176,7 +1260,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -1206,14 +1292,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -1243,14 +1333,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load32_u (local.get $2) @@ -1280,14 +1374,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -1317,7 +1415,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -1347,14 +1447,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -1384,14 +1488,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -1421,14 +1529,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load (local.get $2) @@ -1458,14 +1570,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -1495,7 +1611,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -1525,14 +1643,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -1562,14 +1684,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -1599,7 +1725,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -1629,14 +1757,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -1666,14 +1798,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -1703,14 +1839,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -1740,7 +1880,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -1770,14 +1912,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -1807,14 +1953,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -1844,14 +1994,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -1881,14 +2035,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -1918,7 +2076,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.store8 (local.get $3) @@ -1949,7 +2109,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -1980,7 +2142,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -2011,14 +2175,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store16 (local.get $3) @@ -2049,14 +2217,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -2087,7 +2259,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -2118,14 +2292,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -2156,14 +2334,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store (local.get $3) @@ -2194,14 +2376,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -2232,7 +2418,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.store8 (local.get $3) @@ -2263,7 +2451,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -2294,7 +2484,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -2325,14 +2517,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store16 (local.get $3) @@ -2363,14 +2559,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -2401,7 +2601,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -2432,14 +2634,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -2470,14 +2676,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store32 (local.get $3) @@ -2508,14 +2718,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -2546,7 +2760,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -2577,14 +2793,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -2615,14 +2835,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -2653,14 +2877,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store (local.get $3) @@ -2691,14 +2919,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -2729,7 +2961,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -2760,14 +2994,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -2798,14 +3036,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -2836,7 +3078,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -2867,14 +3111,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -2905,14 +3153,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -2943,14 +3195,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -2981,7 +3237,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -3012,14 +3270,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -3050,14 +3312,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -3088,14 +3354,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -3126,14 +3396,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) @@ -3190,7 +3464,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -3220,7 +3496,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -3250,7 +3528,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -3280,14 +3560,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -3317,7 +3601,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -3347,14 +3633,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -3384,7 +3674,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -3414,14 +3706,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -3451,14 +3747,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -3488,7 +3788,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -3518,7 +3820,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -3548,7 +3852,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -3578,14 +3884,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -3615,7 +3925,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -3645,14 +3957,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -3682,7 +3998,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -3712,14 +4030,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -3749,14 +4071,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -3786,7 +4112,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -3816,14 +4144,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -3853,14 +4185,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -3890,7 +4226,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -3920,14 +4258,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -3957,14 +4299,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -3994,14 +4340,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -4031,7 +4381,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -4061,14 +4413,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -4098,14 +4454,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -4135,7 +4495,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -4165,14 +4527,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -4202,14 +4568,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -4239,14 +4609,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -4276,7 +4650,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -4306,14 +4682,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -4343,14 +4723,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -4380,14 +4764,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -4417,14 +4805,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -4454,7 +4846,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -4485,7 +4879,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -4516,14 +4912,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -4554,7 +4954,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -4585,14 +4987,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -4623,14 +5029,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -4661,7 +5071,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -4692,7 +5104,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -4723,14 +5137,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -4761,7 +5179,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -4792,14 +5212,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -4830,14 +5254,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -4868,7 +5296,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -4899,14 +5329,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -4937,14 +5371,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -4975,14 +5413,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -5013,7 +5455,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -5044,14 +5488,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -5082,14 +5530,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -5120,7 +5572,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -5151,14 +5605,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -5189,14 +5647,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -5227,14 +5689,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -5265,7 +5731,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -5296,14 +5764,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -5334,14 +5806,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -5372,14 +5848,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -5410,14 +5890,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) @@ -5479,7 +5963,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.shr_s (i32.shl @@ -5515,7 +6001,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -5545,7 +6033,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.load8_u (local.get $2) @@ -5575,7 +6065,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -5605,7 +6097,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -5635,14 +6129,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.shr_s (i32.shl @@ -5678,14 +6176,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -5715,7 +6217,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -5745,14 +6249,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load16_u (local.get $2) @@ -5782,14 +6290,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -5819,7 +6331,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -5849,14 +6363,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -5886,14 +6404,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load (local.get $2) @@ -5923,14 +6445,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -5960,7 +6486,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.shr_s (i64.shl @@ -5996,7 +6524,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -6026,7 +6556,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.load8_u (local.get $2) @@ -6056,7 +6588,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -6086,7 +6620,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -6116,14 +6652,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -6159,14 +6699,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -6196,7 +6740,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -6226,14 +6772,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load16_u (local.get $2) @@ -6263,14 +6813,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -6300,7 +6854,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -6330,14 +6886,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -6367,14 +6927,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -6410,14 +6974,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -6447,7 +7015,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -6477,14 +7047,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -6514,14 +7088,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load32_u (local.get $2) @@ -6551,14 +7129,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -6588,7 +7170,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -6618,14 +7202,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -6655,14 +7243,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -6692,14 +7284,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load (local.get $2) @@ -6729,14 +7325,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -6766,7 +7366,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -6796,14 +7398,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -6833,14 +7439,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -6870,7 +7480,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -6900,14 +7512,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -6937,14 +7553,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -6974,14 +7594,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -7011,7 +7635,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -7041,14 +7667,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -7078,14 +7708,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -7115,14 +7749,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -7152,14 +7790,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -7189,7 +7831,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.store8 (local.get $3) @@ -7220,7 +7864,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -7251,7 +7897,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -7282,14 +7930,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store16 (local.get $3) @@ -7320,14 +7972,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -7358,7 +8014,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -7389,14 +8047,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -7427,14 +8089,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store (local.get $3) @@ -7465,14 +8131,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -7503,7 +8173,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.store8 (local.get $3) @@ -7534,7 +8206,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -7565,7 +8239,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -7596,14 +8272,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store16 (local.get $3) @@ -7634,14 +8314,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -7672,7 +8356,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -7703,14 +8389,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -7741,14 +8431,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store32 (local.get $3) @@ -7779,14 +8473,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -7817,7 +8515,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -7848,14 +8548,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -7886,14 +8590,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -7924,14 +8632,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store (local.get $3) @@ -7962,14 +8674,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -8000,7 +8716,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -8031,14 +8749,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -8069,14 +8791,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -8107,7 +8833,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -8138,14 +8866,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -8176,14 +8908,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -8214,14 +8950,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -8252,7 +8992,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -8283,14 +9025,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -8321,14 +9067,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -8359,14 +9109,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -8397,14 +9151,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) diff --git a/test/passes/safe-heap_enable-threads_enable-simd64.txt b/test/passes/safe-heap_enable-threads_enable-simd64.txt index 49319377e..c76b664d5 100644 --- a/test/passes/safe-heap_enable-threads_enable-simd64.txt +++ b/test/passes/safe-heap_enable-threads_enable-simd64.txt @@ -208,7 +208,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.shr_s (i32.shl @@ -244,7 +246,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -274,7 +278,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.load8_u (local.get $2) @@ -304,7 +310,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -334,7 +342,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -364,7 +374,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -373,7 +385,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.shr_s (i32.shl @@ -409,7 +423,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -418,7 +434,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -448,7 +466,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -478,7 +498,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -487,7 +509,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load16_u (local.get $2) @@ -517,7 +541,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -526,7 +552,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -556,7 +584,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -586,7 +616,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -595,7 +627,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -625,7 +659,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -634,7 +670,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load (local.get $2) @@ -664,7 +702,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -673,7 +713,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -703,7 +745,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.shr_s (i64.shl @@ -739,7 +783,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -769,7 +815,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.load8_u (local.get $2) @@ -799,7 +847,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -829,7 +879,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -859,7 +911,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -868,7 +922,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -904,7 +960,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -913,7 +971,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -943,7 +1003,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -973,7 +1035,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -982,7 +1046,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load16_u (local.get $2) @@ -1012,7 +1078,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1021,7 +1089,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -1051,7 +1121,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -1081,7 +1153,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1090,7 +1164,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -1120,7 +1196,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1129,7 +1207,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -1165,7 +1245,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1174,7 +1256,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -1204,7 +1288,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -1234,7 +1320,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1243,7 +1331,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -1273,7 +1363,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1282,7 +1374,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load32_u (local.get $2) @@ -1312,7 +1406,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1321,7 +1417,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -1351,7 +1449,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -1381,7 +1481,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1390,7 +1492,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -1420,7 +1524,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1429,7 +1535,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -1459,7 +1567,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1468,7 +1578,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load (local.get $2) @@ -1498,7 +1610,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1507,7 +1621,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -1537,7 +1653,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -1567,7 +1685,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1576,7 +1696,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -1606,7 +1728,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1615,7 +1739,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -1645,7 +1771,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -1675,7 +1803,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1684,7 +1814,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -1714,7 +1846,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1723,7 +1857,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -1753,7 +1889,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1762,7 +1900,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -1792,7 +1932,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -1822,7 +1964,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1831,7 +1975,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -1861,7 +2007,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1870,7 +2018,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -1900,7 +2050,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1909,7 +2061,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -1939,7 +2093,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -1948,7 +2104,9 @@ ) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -1978,7 +2136,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.store8 (local.get $3) @@ -2009,7 +2169,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -2040,7 +2202,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -2071,7 +2235,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2080,7 +2246,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store16 (local.get $3) @@ -2111,7 +2279,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2120,7 +2290,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -2151,7 +2323,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -2182,7 +2356,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2191,7 +2367,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -2222,7 +2400,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2231,7 +2411,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store (local.get $3) @@ -2262,7 +2444,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2271,7 +2455,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -2302,7 +2488,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.store8 (local.get $3) @@ -2333,7 +2521,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -2364,7 +2554,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -2395,7 +2587,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2404,7 +2598,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store16 (local.get $3) @@ -2435,7 +2631,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2444,7 +2642,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -2475,7 +2675,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -2506,7 +2708,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2515,7 +2719,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -2546,7 +2752,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2555,7 +2763,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store32 (local.get $3) @@ -2586,7 +2796,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2595,7 +2807,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -2626,7 +2840,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -2657,7 +2873,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2666,7 +2884,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -2697,7 +2917,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2706,7 +2928,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -2737,7 +2961,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2746,7 +2972,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store (local.get $3) @@ -2777,7 +3005,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2786,7 +3016,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -2817,7 +3049,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -2848,7 +3082,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2857,7 +3093,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -2888,7 +3126,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2897,7 +3137,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -2928,7 +3170,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -2959,7 +3203,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -2968,7 +3214,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -2999,7 +3247,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3008,7 +3258,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -3039,7 +3291,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3048,7 +3302,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -3079,7 +3335,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -3110,7 +3368,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3119,7 +3379,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -3150,7 +3412,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3159,7 +3423,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -3190,7 +3456,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3199,7 +3467,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -3230,7 +3500,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3239,7 +3511,9 @@ ) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) @@ -3296,7 +3570,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -3326,7 +3602,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -3356,7 +3634,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -3386,7 +3666,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3395,7 +3677,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -3425,7 +3709,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -3455,7 +3741,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3464,7 +3752,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -3494,7 +3784,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -3524,7 +3816,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3533,7 +3827,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -3563,7 +3859,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3572,7 +3870,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -3602,7 +3902,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -3632,7 +3934,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -3662,7 +3966,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -3692,7 +3998,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3701,7 +4009,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -3731,7 +4041,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -3761,7 +4073,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3770,7 +4084,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -3800,7 +4116,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -3830,7 +4148,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3839,7 +4159,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -3869,7 +4191,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3878,7 +4202,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -3908,7 +4234,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -3938,7 +4266,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3947,7 +4277,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -3977,7 +4309,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -3986,7 +4320,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -4016,7 +4352,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -4046,7 +4384,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4055,7 +4395,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -4085,7 +4427,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4094,7 +4438,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -4124,7 +4470,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4133,7 +4481,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -4163,7 +4513,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -4193,7 +4545,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4202,7 +4556,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -4232,7 +4588,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4241,7 +4599,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -4271,7 +4631,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -4301,7 +4663,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4310,7 +4674,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -4340,7 +4706,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4349,7 +4717,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -4379,7 +4749,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4388,7 +4760,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -4418,7 +4792,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -4448,7 +4824,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4457,7 +4835,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -4487,7 +4867,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4496,7 +4878,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -4526,7 +4910,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4535,7 +4921,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -4565,7 +4953,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4574,7 +4964,9 @@ ) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -4604,7 +4996,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -4635,7 +5029,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -4666,7 +5062,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4675,7 +5073,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -4706,7 +5106,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -4737,7 +5139,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4746,7 +5150,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -4777,7 +5183,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4786,7 +5194,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -4817,7 +5227,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -4848,7 +5260,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -4879,7 +5293,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4888,7 +5304,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -4919,7 +5337,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -4950,7 +5370,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4959,7 +5381,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -4990,7 +5414,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -4999,7 +5425,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -5030,7 +5458,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -5061,7 +5491,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5070,7 +5502,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -5101,7 +5535,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5110,7 +5546,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -5141,7 +5579,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5150,7 +5590,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -5181,7 +5623,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -5212,7 +5656,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5221,7 +5667,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -5252,7 +5700,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5261,7 +5711,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -5292,7 +5744,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -5323,7 +5777,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5332,7 +5788,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -5363,7 +5821,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5372,7 +5832,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -5403,7 +5865,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5412,7 +5876,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -5443,7 +5909,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -5474,7 +5942,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5483,7 +5953,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -5514,7 +5986,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5523,7 +5997,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -5554,7 +6030,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5563,7 +6041,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -5594,7 +6074,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5603,7 +6085,9 @@ ) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) @@ -5665,7 +6149,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.shr_s (i32.shl @@ -5701,7 +6187,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -5731,7 +6219,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.load8_u (local.get $2) @@ -5761,7 +6251,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -5791,7 +6283,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -5821,7 +6315,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5830,7 +6326,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.shr_s (i32.shl @@ -5866,7 +6364,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5875,7 +6375,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -5905,7 +6407,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -5935,7 +6439,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5944,7 +6450,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load16_u (local.get $2) @@ -5974,7 +6482,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -5983,7 +6493,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -6013,7 +6525,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -6043,7 +6557,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6052,7 +6568,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -6082,7 +6600,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6091,7 +6611,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load (local.get $2) @@ -6121,7 +6643,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6130,7 +6654,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -6160,7 +6686,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.shr_s (i64.shl @@ -6196,7 +6724,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -6226,7 +6756,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.load8_u (local.get $2) @@ -6256,7 +6788,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -6286,7 +6820,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -6316,7 +6852,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6325,7 +6863,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -6361,7 +6901,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6370,7 +6912,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -6400,7 +6944,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -6430,7 +6976,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6439,7 +6987,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load16_u (local.get $2) @@ -6469,7 +7019,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6478,7 +7030,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -6508,7 +7062,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -6538,7 +7094,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6547,7 +7105,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -6577,7 +7137,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6586,7 +7148,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -6622,7 +7186,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6631,7 +7197,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -6661,7 +7229,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -6691,7 +7261,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6700,7 +7272,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -6730,7 +7304,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6739,7 +7315,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load32_u (local.get $2) @@ -6769,7 +7347,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6778,7 +7358,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -6808,7 +7390,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -6838,7 +7422,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6847,7 +7433,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -6877,7 +7465,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6886,7 +7476,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -6916,7 +7508,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6925,7 +7519,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load (local.get $2) @@ -6955,7 +7551,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -6964,7 +7562,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -6994,7 +7594,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -7024,7 +7626,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7033,7 +7637,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -7063,7 +7669,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7072,7 +7680,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -7102,7 +7712,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -7132,7 +7744,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7141,7 +7755,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -7171,7 +7787,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7180,7 +7798,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -7210,7 +7830,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7219,7 +7841,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -7249,7 +7873,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -7279,7 +7905,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7288,7 +7916,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -7318,7 +7948,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7327,7 +7959,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -7357,7 +7991,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7366,7 +8002,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -7396,7 +8034,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7405,7 +8045,9 @@ ) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -7435,7 +8077,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.store8 (local.get $3) @@ -7466,7 +8110,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -7497,7 +8143,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -7528,7 +8176,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7537,7 +8187,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store16 (local.get $3) @@ -7568,7 +8220,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7577,7 +8231,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -7608,7 +8264,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -7639,7 +8297,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7648,7 +8308,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -7679,7 +8341,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7688,7 +8352,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store (local.get $3) @@ -7719,7 +8385,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7728,7 +8396,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -7759,7 +8429,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.store8 (local.get $3) @@ -7790,7 +8462,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -7821,7 +8495,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -7852,7 +8528,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7861,7 +8539,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store16 (local.get $3) @@ -7892,7 +8572,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7901,7 +8583,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -7932,7 +8616,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -7963,7 +8649,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -7972,7 +8660,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -8003,7 +8693,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8012,7 +8704,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store32 (local.get $3) @@ -8043,7 +8737,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8052,7 +8748,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -8083,7 +8781,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -8114,7 +8814,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8123,7 +8825,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -8154,7 +8858,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8163,7 +8869,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -8194,7 +8902,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8203,7 +8913,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store (local.get $3) @@ -8234,7 +8946,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8243,7 +8957,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -8274,7 +8990,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -8305,7 +9023,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8314,7 +9034,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -8345,7 +9067,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8354,7 +9078,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -8385,7 +9111,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -8416,7 +9144,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8425,7 +9155,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -8456,7 +9188,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8465,7 +9199,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -8496,7 +9232,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8505,7 +9243,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -8536,7 +9276,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -8567,7 +9309,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8576,7 +9320,9 @@ ) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -8607,7 +9353,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8616,7 +9364,9 @@ ) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -8647,7 +9397,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8656,7 +9408,9 @@ ) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -8687,7 +9441,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and @@ -8696,7 +9452,9 @@ ) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) diff --git a/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt b/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt index 53b048331..02904abad 100644 --- a/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt +++ b/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt @@ -208,7 +208,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.shr_s (i32.shl @@ -244,7 +246,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -274,7 +278,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.load8_u (local.get $2) @@ -304,7 +310,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -334,7 +342,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -364,14 +374,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.shr_s (i32.shl @@ -407,14 +421,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -444,7 +462,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -474,14 +494,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load16_u (local.get $2) @@ -511,14 +535,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -548,7 +576,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -578,14 +608,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -615,14 +649,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load (local.get $2) @@ -652,14 +690,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -689,7 +731,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.shr_s (i64.shl @@ -725,7 +769,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -755,7 +801,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.load8_u (local.get $2) @@ -785,7 +833,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -815,7 +865,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -845,14 +897,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -888,14 +944,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -925,7 +985,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -955,14 +1017,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load16_u (local.get $2) @@ -992,14 +1058,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -1029,7 +1099,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -1059,14 +1131,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -1096,14 +1172,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -1139,14 +1219,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -1176,7 +1260,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -1206,14 +1292,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -1243,14 +1333,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load32_u (local.get $2) @@ -1280,14 +1374,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -1317,7 +1415,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -1347,14 +1447,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -1384,14 +1488,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -1421,14 +1529,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load (local.get $2) @@ -1458,14 +1570,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -1495,7 +1611,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -1525,14 +1643,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -1562,14 +1684,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -1599,7 +1725,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -1629,14 +1757,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -1666,14 +1798,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -1703,14 +1839,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -1740,7 +1880,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -1770,14 +1912,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -1807,14 +1953,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -1844,14 +1994,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -1881,14 +2035,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -1918,7 +2076,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.store8 (local.get $3) @@ -1949,7 +2109,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -1980,7 +2142,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -2011,14 +2175,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store16 (local.get $3) @@ -2049,14 +2217,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -2087,7 +2259,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -2118,14 +2292,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -2156,14 +2334,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store (local.get $3) @@ -2194,14 +2376,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -2232,7 +2418,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.store8 (local.get $3) @@ -2263,7 +2451,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -2294,7 +2484,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -2325,14 +2517,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store16 (local.get $3) @@ -2363,14 +2559,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -2401,7 +2601,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -2432,14 +2634,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -2470,14 +2676,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store32 (local.get $3) @@ -2508,14 +2718,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -2546,7 +2760,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -2577,14 +2793,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -2615,14 +2835,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -2653,14 +2877,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store (local.get $3) @@ -2691,14 +2919,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -2729,7 +2961,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -2760,14 +2994,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -2798,14 +3036,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -2836,7 +3078,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -2867,14 +3111,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -2905,14 +3153,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -2943,14 +3195,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -2981,7 +3237,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -3012,14 +3270,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -3050,14 +3312,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -3088,14 +3354,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -3126,14 +3396,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) @@ -3190,7 +3464,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -3220,7 +3496,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -3250,7 +3528,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -3280,14 +3560,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -3317,7 +3601,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -3347,14 +3633,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -3384,7 +3674,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -3414,14 +3706,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -3451,14 +3747,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -3488,7 +3788,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -3518,7 +3820,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -3548,7 +3852,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -3578,14 +3884,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -3615,7 +3925,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -3645,14 +3957,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -3682,7 +3998,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -3712,14 +4030,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -3749,14 +4071,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -3786,7 +4112,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -3816,14 +4144,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -3853,14 +4185,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -3890,7 +4226,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -3920,14 +4258,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -3957,14 +4299,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -3994,14 +4340,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -4031,7 +4381,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -4061,14 +4413,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -4098,14 +4454,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -4135,7 +4495,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -4165,14 +4527,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -4202,14 +4568,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -4239,14 +4609,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -4276,7 +4650,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -4306,14 +4682,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -4343,14 +4723,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -4380,14 +4764,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -4417,14 +4805,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -4454,7 +4846,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -4485,7 +4879,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -4516,14 +4912,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -4554,7 +4954,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -4585,14 +4987,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -4623,14 +5029,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -4661,7 +5071,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -4692,7 +5104,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -4723,14 +5137,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -4761,7 +5179,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -4792,14 +5212,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -4830,14 +5254,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -4868,7 +5296,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -4899,14 +5329,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -4937,14 +5371,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -4975,14 +5413,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -5013,7 +5455,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -5044,14 +5488,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -5082,14 +5530,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -5120,7 +5572,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -5151,14 +5605,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -5189,14 +5647,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -5227,14 +5689,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -5265,7 +5731,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -5296,14 +5764,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -5334,14 +5806,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -5372,14 +5848,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -5410,14 +5890,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) @@ -5479,7 +5963,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.shr_s (i32.shl @@ -5515,7 +6001,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -5545,7 +6033,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.load8_u (local.get $2) @@ -5575,7 +6065,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -5605,7 +6097,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -5635,14 +6129,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.shr_s (i32.shl @@ -5678,14 +6176,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -5715,7 +6217,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -5745,14 +6249,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load16_u (local.get $2) @@ -5782,14 +6290,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -5819,7 +6331,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -5849,14 +6363,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -5886,14 +6404,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.load (local.get $2) @@ -5923,14 +6445,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -5960,7 +6486,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.shr_s (i64.shl @@ -5996,7 +6524,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -6026,7 +6556,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.load8_u (local.get $2) @@ -6056,7 +6588,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -6086,7 +6620,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -6116,14 +6652,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -6159,14 +6699,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -6196,7 +6740,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -6226,14 +6772,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load16_u (local.get $2) @@ -6263,14 +6813,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -6300,7 +6854,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -6330,14 +6886,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -6367,14 +6927,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.shr_s (i64.shl @@ -6410,14 +6974,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -6447,7 +7015,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -6477,14 +7047,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -6514,14 +7088,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load32_u (local.get $2) @@ -6551,14 +7129,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -6588,7 +7170,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -6618,14 +7202,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -6655,14 +7243,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -6692,14 +7284,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.load (local.get $2) @@ -6729,14 +7325,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -6766,7 +7366,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -6796,14 +7398,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -6833,14 +7439,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -6870,7 +7480,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -6900,14 +7512,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -6937,14 +7553,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -6974,14 +7594,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -7011,7 +7635,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.load align=1 (local.get $2) @@ -7041,14 +7667,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=2 (local.get $2) @@ -7078,14 +7708,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=4 (local.get $2) @@ -7115,14 +7749,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load align=8 (local.get $2) @@ -7152,14 +7790,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.load (local.get $2) @@ -7189,7 +7831,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.atomic.store8 (local.get $3) @@ -7220,7 +7864,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -7251,7 +7897,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -7282,14 +7930,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store16 (local.get $3) @@ -7320,14 +7972,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -7358,7 +8014,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -7389,14 +8047,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -7427,14 +8089,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.atomic.store (local.get $3) @@ -7465,14 +8131,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -7503,7 +8173,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.atomic.store8 (local.get $3) @@ -7534,7 +8206,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -7565,7 +8239,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -7596,14 +8272,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store16 (local.get $3) @@ -7634,14 +8314,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -7672,7 +8356,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -7703,14 +8389,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -7741,14 +8431,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store32 (local.get $3) @@ -7779,14 +8473,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -7817,7 +8515,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -7848,14 +8548,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -7886,14 +8590,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -7924,14 +8632,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.atomic.store (local.get $3) @@ -7962,14 +8674,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -8000,7 +8716,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -8031,14 +8749,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -8069,14 +8791,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -8107,7 +8833,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -8138,14 +8866,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -8176,14 +8908,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -8214,14 +8950,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) @@ -8252,7 +8992,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (v128.store align=1 (local.get $3) @@ -8283,14 +9025,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=2 (local.get $3) @@ -8321,14 +9067,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=4 (local.get $3) @@ -8359,14 +9109,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store align=8 (local.get $3) @@ -8397,14 +9151,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 15) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (v128.store (local.get $3) diff --git a/test/passes/safe-heap_start-function.txt b/test/passes/safe-heap_start-function.txt index ae7559a97..11b258945 100644 --- a/test/passes/safe-heap_start-function.txt +++ b/test/passes/safe-heap_start-function.txt @@ -74,7 +74,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_s (local.get $2) @@ -104,7 +106,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load8_u (local.get $2) @@ -134,7 +138,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_s align=1 (local.get $2) @@ -164,14 +170,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_s (local.get $2) @@ -201,7 +211,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load16_u align=1 (local.get $2) @@ -231,14 +243,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load16_u (local.get $2) @@ -268,7 +284,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.load align=1 (local.get $2) @@ -298,14 +316,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load align=2 (local.get $2) @@ -335,14 +357,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.load (local.get $2) @@ -372,7 +398,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_s (local.get $2) @@ -402,7 +430,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load8_u (local.get $2) @@ -432,7 +462,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_s align=1 (local.get $2) @@ -462,14 +494,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_s (local.get $2) @@ -499,7 +535,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load16_u align=1 (local.get $2) @@ -529,14 +567,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load16_u (local.get $2) @@ -566,7 +608,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_s align=1 (local.get $2) @@ -596,14 +640,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s align=2 (local.get $2) @@ -633,14 +681,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_s (local.get $2) @@ -670,7 +722,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load32_u align=1 (local.get $2) @@ -700,14 +754,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u align=2 (local.get $2) @@ -737,14 +795,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load32_u (local.get $2) @@ -774,7 +836,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.load align=1 (local.get $2) @@ -804,14 +868,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=2 (local.get $2) @@ -841,14 +909,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load align=4 (local.get $2) @@ -878,14 +950,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.load (local.get $2) @@ -915,7 +991,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.load align=1 (local.get $2) @@ -945,14 +1023,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load align=2 (local.get $2) @@ -982,14 +1064,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.load (local.get $2) @@ -1019,7 +1105,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.load align=1 (local.get $2) @@ -1049,14 +1137,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=2 (local.get $2) @@ -1086,14 +1178,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load align=4 (local.get $2) @@ -1123,14 +1219,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $2) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.load (local.get $2) @@ -1160,7 +1260,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store8 (local.get $3) @@ -1191,7 +1293,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store16 align=1 (local.get $3) @@ -1222,14 +1326,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store16 (local.get $3) @@ -1260,7 +1368,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i32.store align=1 (local.get $3) @@ -1291,14 +1401,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store align=2 (local.get $3) @@ -1329,14 +1443,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i32.store (local.get $3) @@ -1367,7 +1485,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store8 (local.get $3) @@ -1398,7 +1518,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store16 align=1 (local.get $3) @@ -1429,14 +1551,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store16 (local.get $3) @@ -1467,7 +1593,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store32 align=1 (local.get $3) @@ -1498,14 +1626,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 align=2 (local.get $3) @@ -1536,14 +1668,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store32 (local.get $3) @@ -1574,7 +1710,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (i64.store align=1 (local.get $3) @@ -1605,14 +1743,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=2 (local.get $3) @@ -1643,14 +1785,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store align=4 (local.get $3) @@ -1681,14 +1827,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (i64.store (local.get $3) @@ -1719,7 +1869,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f32.store align=1 (local.get $3) @@ -1750,14 +1902,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store align=2 (local.get $3) @@ -1788,14 +1944,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f32.store (local.get $3) @@ -1826,7 +1986,9 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (f64.store align=1 (local.get $3) @@ -1857,14 +2019,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 1) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=2 (local.get $3) @@ -1895,14 +2061,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 3) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store align=4 (local.get $3) @@ -1933,14 +2103,18 @@ ) ) ) - (call $segfault) + (then + (call $segfault) + ) ) (if (i32.and (local.get $3) (i32.const 7) ) - (call $alignfault) + (then + (call $alignfault) + ) ) (f64.store (local.get $3) diff --git a/test/passes/simplify-globals-optimizing_all-features.txt b/test/passes/simplify-globals-optimizing_all-features.txt index 72c0620a6..3f8d4374b 100644 --- a/test/passes/simplify-globals-optimizing_all-features.txt +++ b/test/passes/simplify-globals-optimizing_all-features.txt @@ -82,8 +82,10 @@ ) (if (local.get $0) - (return - (i32.const 0) + (then + (return + (i32.const 0) + ) ) ) (if @@ -93,8 +95,10 @@ (global.get $g2) ) ) - (return - (i32.const 1) + (then + (return + (i32.const 1) + ) ) ) (global.set $g1 diff --git a/test/passes/simplify-globals-optimizing_all-features.wast b/test/passes/simplify-globals-optimizing_all-features.wast index 988650a74..2b26654c9 100644 --- a/test/passes/simplify-globals-optimizing_all-features.wast +++ b/test/passes/simplify-globals-optimizing_all-features.wast @@ -69,14 +69,14 @@ (func $f (param $x i32) (result i32) (global.set $g1 (i32.const 100)) (global.set $g2 (local.get $x)) - (if (local.get $x) (return (i32.const 0))) + (if (local.get $x) (then (return (i32.const 0)))) (local.set $x (i32.add (global.get $g1) (global.get $g2) ) ) - (if (local.get $x) (return (i32.const 1))) + (if (local.get $x) (then (return (i32.const 1)))) (global.set $g1 (i32.const 200)) (global.set $g2 (local.get $x)) (local.set $x @@ -137,7 +137,9 @@ (i32.eqz (global.get $global$1) ) - (unreachable) + (then + (unreachable) + ) ) (i32.const 2) ) diff --git a/test/passes/simplify-globals_all-features.txt b/test/passes/simplify-globals_all-features.txt index e885b3cfe..5bb7213f2 100644 --- a/test/passes/simplify-globals_all-features.txt +++ b/test/passes/simplify-globals_all-features.txt @@ -120,8 +120,10 @@ ) (if (local.get $x) - (return - (i32.const 0) + (then + (return + (i32.const 0) + ) ) ) (local.set $x @@ -132,8 +134,10 @@ ) (if (local.get $x) - (return - (i32.const 1) + (then + (return + (i32.const 1) + ) ) ) (global.set $g1 diff --git a/test/passes/simplify-globals_all-features.wast b/test/passes/simplify-globals_all-features.wast index 52d57b656..6efe5eaa8 100644 --- a/test/passes/simplify-globals_all-features.wast +++ b/test/passes/simplify-globals_all-features.wast @@ -69,14 +69,14 @@ (func $f (param $x i32) (result i32) (global.set $g1 (i32.const 100)) (global.set $g2 (local.get $x)) - (if (local.get $x) (return (i32.const 0))) + (if (local.get $x) (then (return (i32.const 0)))) (local.set $x (i32.add (global.get $g1) (global.get $g2) ) ) - (if (local.get $x) (return (i32.const 1))) + (if (local.get $x) (then (return (i32.const 1)))) (global.set $g1 (i32.const 200)) (global.set $g2 (local.get $x)) (local.set $x diff --git a/test/passes/simplify-locals-nonesting.txt b/test/passes/simplify-locals-nonesting.txt index abc3aecb9..a5dd4d343 100644 --- a/test/passes/simplify-locals-nonesting.txt +++ b/test/passes/simplify-locals-nonesting.txt @@ -87,7 +87,7 @@ ) (if (local.get $8) - (block + (then (block $block1 (nop) (nop) @@ -127,7 +127,7 @@ ) (unreachable) ) - (block + (else (unreachable) (unreachable) ) @@ -157,7 +157,7 @@ ) (if (local.get $2) - (block + (then (nop) (nop) (local.set $x @@ -168,7 +168,7 @@ ) (nop) ) - (block + (else (nop) (nop) (local.set $x diff --git a/test/passes/simplify-locals-nonesting.wast b/test/passes/simplify-locals-nonesting.wast index b49ffe138..8c4da0168 100644 --- a/test/passes/simplify-locals-nonesting.wast +++ b/test/passes/simplify-locals-nonesting.wast @@ -113,69 +113,73 @@ ) (if (local.get $8) - (block - (block $block - (local.set $9 - (local.get $a) - ) - (local.set $10 - (local.get $x) - ) - (local.set $11 - (i64.eq - (local.get $9) - (local.get $10) + (then + (block + (block $block + (local.set $9 + (local.get $a) ) - ) - (local.set $i - (local.get $11) - ) - (nop) - (local.set $12 - (local.get $a) - ) - (local.set $13 - (local.get $y) - ) - (local.set $14 - (i64.ne - (local.get $12) - (local.get $13) + (local.set $10 + (local.get $x) ) - ) - (local.set $j - (local.get $14) - ) - (nop) - (local.set $15 - (local.get $i) - ) - (local.set $16 - (local.get $j) - ) - (local.set $17 - (i32.and - (local.get $15) - (local.get $16) + (local.set $11 + (i64.eq + (local.get $9) + (local.get $10) + ) ) - ) - (local.set $r - (local.get $17) - ) - (nop) - (local.set $18 - (local.get $r) - ) - (return - (local.get $18) + (local.set $i + (local.get $11) + ) + (nop) + (local.set $12 + (local.get $a) + ) + (local.set $13 + (local.get $y) + ) + (local.set $14 + (i64.ne + (local.get $12) + (local.get $13) + ) + ) + (local.set $j + (local.get $14) + ) + (nop) + (local.set $15 + (local.get $i) + ) + (local.set $16 + (local.get $j) + ) + (local.set $17 + (i32.and + (local.get $15) + (local.get $16) + ) + ) + (local.set $r + (local.get $17) + ) + (nop) + (local.set $18 + (local.get $r) + ) + (return + (local.get $18) + ) + (unreachable) ) (unreachable) ) - (unreachable) ) - (block - (unreachable) - (unreachable) + (else + (block + (unreachable) + (unreachable) + ) ) ) ) @@ -205,35 +209,39 @@ ) (if (local.get $2) - (block - (local.set $3 - (local.get $x) - ) - (local.set $4 - (i32.add - (local.get $3) - (i32.const 1) + (then + (block + (local.set $3 + (local.get $x) ) + (local.set $4 + (i32.add + (local.get $3) + (i32.const 1) + ) + ) + (local.set $x + (local.get $4) + ) + (nop) ) - (local.set $x - (local.get $4) - ) - (nop) ) - (block - (local.set $5 - (local.get $x) - ) - (local.set $6 - (i32.add - (local.get $5) - (i32.const 2) + (else + (block + (local.set $5 + (local.get $x) ) + (local.set $6 + (i32.add + (local.get $5) + (i32.const 2) + ) + ) + (local.set $x + (local.get $6) + ) + (nop) ) - (local.set $x - (local.get $6) - ) - (nop) ) ) ) diff --git a/test/passes/simplify-locals-nostructure.txt b/test/passes/simplify-locals-nostructure.txt index f0be46edc..18b7052d4 100644 --- a/test/passes/simplify-locals-nostructure.txt +++ b/test/passes/simplify-locals-nostructure.txt @@ -14,18 +14,26 @@ (local.tee $x (i32.const 1) ) - (nop) + (then + (nop) + ) ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (nop) (drop (if (result i32) (i32.const 2) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) ) (nop) @@ -36,11 +44,15 @@ ) (if (i32.const 6) - (local.set $a - (i32.const 7) + (then + (local.set $a + (i32.const 7) + ) ) - (local.set $a - (i32.const 8) + (else + (local.set $a + (i32.const 8) + ) ) ) (drop @@ -49,7 +61,7 @@ (block $val (if (i32.const 10) - (block + (then (local.set $b (i32.const 11) ) @@ -97,8 +109,10 @@ ) (if (i32.const 1) - (drop - (local.get $other) + (then + (drop + (local.get $other) + ) ) ) ) @@ -119,10 +133,12 @@ (local $y i32) (if (i32.const 1) - (local.set $x - (i32.const 2) + (then + (local.set $x + (i32.const 2) + ) ) - (block + (else (nop) (nop) ) diff --git a/test/passes/simplify-locals-nostructure.wast b/test/passes/simplify-locals-nostructure.wast index 4dc6cfb82..e93a77ced 100644 --- a/test/passes/simplify-locals-nostructure.wast +++ b/test/passes/simplify-locals-nostructure.wast @@ -7,22 +7,28 @@ (local $a i32) (local $b i32) (local.set $x (i32.const 1)) - (if (local.get $x) (nop)) - (if (local.get $x) (nop)) - (local.set $y (if (result i32) (i32.const 2) (i32.const 3) (i32.const 4))) + (if (local.get $x) (then (nop))) + (if (local.get $x) (then (nop))) + (local.set $y (if (result i32) (i32.const 2) (then (i32.const 3) )(else (i32.const 4)))) (drop (local.get $y)) (local.set $z (block (result i32) (i32.const 5))) (drop (local.get $z)) (if (i32.const 6) - (local.set $a (i32.const 7)) - (local.set $a (i32.const 8)) + (then + (local.set $a (i32.const 7)) + ) + (else + (local.set $a (i32.const 8)) + ) ) (drop (local.get $a)) (block $val (if (i32.const 10) - (block - (local.set $b (i32.const 11)) - (br $val) + (then + (block + (local.set $b (i32.const 11)) + (br $val) + ) ) ) (local.set $b (i32.const 12)) @@ -65,8 +71,10 @@ (local.get $var$0) ) (if (i32.const 1) - (drop - (local.get $other) + (then + (drop + (local.get $other) + ) ) ) ) @@ -88,10 +96,14 @@ (func $if-value-structure-equivalent (param $x i32) (result i32) (local $y i32) (if (i32.const 1) - (local.set $x (i32.const 2)) - (block - (local.set $y (local.get $x)) - (local.set $x (local.get $y)) + (then + (local.set $x (i32.const 2)) + ) + (else + (block + (local.set $y (local.get $x)) + (local.set $x (local.get $y)) + ) ) ) (local.get $x) diff --git a/test/passes/simplify-locals-notee-nostructure.txt b/test/passes/simplify-locals-notee-nostructure.txt index 0c8a3d78b..6015fc833 100644 --- a/test/passes/simplify-locals-notee-nostructure.txt +++ b/test/passes/simplify-locals-notee-nostructure.txt @@ -11,18 +11,26 @@ ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (nop) (drop (if (result i32) (i32.const 2) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) ) (nop) @@ -33,11 +41,15 @@ ) (if (i32.const 6) - (local.set $a - (i32.const 7) + (then + (local.set $a + (i32.const 7) + ) ) - (local.set $a - (i32.const 8) + (else + (local.set $a + (i32.const 8) + ) ) ) (drop @@ -46,7 +58,7 @@ (block $val (if (i32.const 10) - (block + (then (local.set $b (i32.const 11) ) diff --git a/test/passes/simplify-locals-notee-nostructure.wast b/test/passes/simplify-locals-notee-nostructure.wast index 8185bbe35..51f910eeb 100644 --- a/test/passes/simplify-locals-notee-nostructure.wast +++ b/test/passes/simplify-locals-notee-nostructure.wast @@ -6,22 +6,28 @@ (local $a i32) (local $b i32) (local.set $x (i32.const 1)) - (if (local.get $x) (nop)) - (if (local.get $x) (nop)) - (local.set $y (if (result i32) (i32.const 2) (i32.const 3) (i32.const 4))) + (if (local.get $x) (then (nop))) + (if (local.get $x) (then (nop))) + (local.set $y (if (result i32) (i32.const 2) (then (i32.const 3) )(else (i32.const 4)))) (drop (local.get $y)) (local.set $z (block (result i32) (i32.const 5))) (drop (local.get $z)) (if (i32.const 6) - (local.set $a (i32.const 7)) - (local.set $a (i32.const 8)) + (then + (local.set $a (i32.const 7)) + ) + (else + (local.set $a (i32.const 8)) + ) ) (drop (local.get $a)) (block $val (if (i32.const 10) - (block - (local.set $b (i32.const 11)) - (br $val) + (then + (block + (local.set $b (i32.const 11)) + (br $val) + ) ) ) (local.set $b (i32.const 12)) diff --git a/test/passes/simplify-locals-notee.txt b/test/passes/simplify-locals-notee.txt index 56ac575f2..ae12af8c9 100644 --- a/test/passes/simplify-locals-notee.txt +++ b/test/passes/simplify-locals-notee.txt @@ -11,18 +11,26 @@ ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (nop) (drop (if (result i32) (i32.const 2) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) ) (nop) @@ -35,11 +43,11 @@ (drop (if (result i32) (i32.const 6) - (block (result i32) + (then (nop) (i32.const 7) ) - (block (result i32) + (else (nop) (i32.const 8) ) @@ -50,7 +58,7 @@ (block $val (result i32) (if (i32.const 10) - (block + (then (nop) (br $val (i32.const 11) diff --git a/test/passes/simplify-locals-notee.wast b/test/passes/simplify-locals-notee.wast index 8185bbe35..51f910eeb 100644 --- a/test/passes/simplify-locals-notee.wast +++ b/test/passes/simplify-locals-notee.wast @@ -6,22 +6,28 @@ (local $a i32) (local $b i32) (local.set $x (i32.const 1)) - (if (local.get $x) (nop)) - (if (local.get $x) (nop)) - (local.set $y (if (result i32) (i32.const 2) (i32.const 3) (i32.const 4))) + (if (local.get $x) (then (nop))) + (if (local.get $x) (then (nop))) + (local.set $y (if (result i32) (i32.const 2) (then (i32.const 3) )(else (i32.const 4)))) (drop (local.get $y)) (local.set $z (block (result i32) (i32.const 5))) (drop (local.get $z)) (if (i32.const 6) - (local.set $a (i32.const 7)) - (local.set $a (i32.const 8)) + (then + (local.set $a (i32.const 7)) + ) + (else + (local.set $a (i32.const 8)) + ) ) (drop (local.get $a)) (block $val (if (i32.const 10) - (block - (local.set $b (i32.const 11)) - (br $val) + (then + (block + (local.set $b (i32.const 11)) + (br $val) + ) ) ) (local.set $b (i32.const 12)) diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt index 4225a7033..36a635e29 100644 --- a/test/passes/simplify-locals_all-features.txt +++ b/test/passes/simplify-locals_all-features.txt @@ -31,18 +31,26 @@ (local.tee $x (i32.const 1) ) - (nop) + (then + (nop) + ) ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (nop) (drop (if (result i32) (i32.const 2) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) ) (nop) @@ -55,11 +63,11 @@ (drop (if (result i32) (i32.const 6) - (block (result i32) + (then (nop) (i32.const 7) ) - (block (result i32) + (else (nop) (i32.const 8) ) @@ -70,7 +78,7 @@ (block $val (result i32) (if (i32.const 10) - (block + (then (nop) (br $val (i32.const 11) @@ -488,8 +496,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -503,8 +515,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -514,8 +530,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -533,8 +553,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -548,8 +572,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -559,8 +587,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -672,11 +704,11 @@ (local.set $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 13) ) - (block (result i32) + (else (nop) (i32.const 24) ) @@ -689,13 +721,13 @@ (local.tee $x (if (result i32) (i32.const 1) - (block (result i32) + (then (block $block3 (nop) ) (i32.const 14) ) - (block (result i32) + (else (block $block5 (nop) ) @@ -820,19 +852,23 @@ (drop (if (result i32) (local.get $x) - (block $block53 (result i32) - (nop) - (local.set $temp - (local.get $y) + (then + (block $block53 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) - (block $block54 (result i32) - (nop) - (local.set $temp - (local.get $y) + (else + (block $block54 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) ) ) @@ -852,19 +888,21 @@ (local.get $label) (i32.const 15) ) - (block $block - (nop) - (nop) - (drop - (br_if $label$break$L4 - (local.tee $label - (i32.const 0) - ) - (i32.eqz - (i32.eq - (local.get $$$0151) + (then + (block $block + (nop) + (nop) + (drop + (br_if $label$break$L4 + (local.tee $label (i32.const 0) ) + (i32.eqz + (i32.eq + (local.get $$$0151) + (i32.const 0) + ) + ) ) ) ) @@ -887,11 +925,15 @@ (func $if-return-but-unreachable (type $11) (param $var$0 i64) (if (unreachable) - (drop - (local.get $var$0) + (then + (drop + (local.get $var$0) + ) ) - (local.set $var$0 - (i64.const 1) + (else + (local.set $var$0 + (i64.const 1) + ) ) ) ) @@ -901,11 +943,13 @@ (local.tee $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (local.get $x) + (else + (local.get $x) + ) ) ) ) @@ -918,11 +962,13 @@ (local.set $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (local.get $x) + (else + (local.get $x) + ) ) ) (local.get $y) @@ -935,22 +981,24 @@ (local.get $0) (i32.const -1073741824) ) - (block (result i32) + (then (nop) (i32.const -1073741824) ) - (block (result i32) + (else (nop) (if (result i32) (i32.gt_s (local.get $0) (i32.const 1073741823) ) - (block (result i32) + (then (nop) (i32.const 1073741823) ) - (local.get $0) + (else + (local.get $0) + ) ) ) ) @@ -967,8 +1015,12 @@ (local.set $x (if (result i32) (i32.const -1) - (i32.const -2) - (local.get $x) + (then + (i32.const -2) + ) + (else + (local.get $x) + ) ) ) (drop @@ -976,8 +1028,12 @@ (local.tee $x (if (result i32) (i32.const -3) - (i32.const -4) - (local.get $x) + (then + (i32.const -4) + ) + (else + (local.get $x) + ) ) ) ) @@ -988,8 +1044,12 @@ (local.tee $y (if (result i32) (i32.const -5) - (i32.const -6) - (local.get $y) + (then + (i32.const -6) + ) + (else + (local.get $y) + ) ) ) ) @@ -1000,8 +1060,12 @@ (local.tee $z (if (result i32) (i32.const -7) - (i32.const -8) - (local.get $z) + (then + (i32.const -8) + ) + (else + (local.get $z) + ) ) ) (local.get $z) @@ -1016,22 +1080,28 @@ (local.tee $4 (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (local.get $4) + (else + (local.get $4) + ) ) ) - (block (result i32) + (then (nop) (i32.const 0) ) - (local.get $4) + (else + (local.get $4) + ) ) ) ) - (unreachable) + (then + (unreachable) + ) ) (i32.const 0) ) @@ -1040,16 +1110,28 @@ (local.tee $20 (if (result i32) (i32.const 1) - (if (result i32) - (i32.const 2) + (then (if (result i32) - (i32.const 3) - (i32.const 4) - (local.get $20) + (i32.const 2) + (then + (if (result i32) + (i32.const 3) + (then + (i32.const 4) + ) + (else + (local.get $20) + ) + ) + ) + (else + (local.get $20) + ) ) + ) + (else (local.get $20) ) - (local.get $20) ) ) ) @@ -1085,8 +1167,12 @@ (i32.eqz (local.get $0) ) - (f32.const 4623408228068004207103214e13) - (local.get $3) + (then + (f32.const 4623408228068004207103214e13) + ) + (else + (local.get $3) + ) ) ) ) @@ -1098,7 +1184,7 @@ ) (if (result f64) (global.get $global$0) - (block + (then (global.set $global$0 (i32.sub (global.get $global$0) @@ -1116,7 +1202,9 @@ ) (br $label$1) ) - (f64.const -70) + (else + (f64.const -70) + ) ) ) ) @@ -1319,11 +1407,11 @@ (drop (if (result i32) (i32.const 1) - (block + (then (br $out) (nop) ) - (block (result i32) + (else (nop) (i32.const 2) ) @@ -1332,11 +1420,11 @@ (drop (if (result i32) (i32.const 3) - (block (result i32) + (then (nop) (i32.const 4) ) - (block + (else (br $out) (nop) ) @@ -1344,8 +1432,12 @@ ) (if (i32.const 5) - (br $out) - (br $out) + (then + (br $out) + ) + (else + (br $out) + ) ) ) ) @@ -1356,13 +1448,13 @@ (drop (if (result i32) (i32.const 1) - (block + (then (nop) (nop) (br $out) (nop) ) - (block (result i32) + (else (nop) (nop) (i32.const 4) @@ -1372,12 +1464,12 @@ (drop (if (result i32) (i32.const 6) - (block (result i32) + (then (nop) (nop) (i32.const 7) ) - (block + (else (nop) (nop) (br $out) @@ -1387,12 +1479,12 @@ ) (if (i32.const 11) - (block + (then (nop) (nop) (br $out) ) - (block + (else (nop) (nop) (br $out) @@ -1428,11 +1520,11 @@ (nop) (if (result i32) (i32.const 0) - (block (result i32) + (then (nop) (i32.const 0) ) - (block + (else (loop $label$4 (br $label$4) ) @@ -1453,11 +1545,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $x) + (else + (local.get $x) + ) ) ) (drop @@ -1476,11 +1570,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (drop @@ -1508,11 +1604,13 @@ (local.set $y (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (local.set $x @@ -1521,11 +1619,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (nop) @@ -1542,11 +1642,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (nop) @@ -1603,11 +1705,11 @@ (local.tee $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (block (result i32) + (else (nop) (nop) (local.get $x) @@ -1660,11 +1762,11 @@ (nop) (if (result f32) (call $fimport$0) - (block (result f32) + (then (nop) (f32.const -2048) ) - (block + (else (call $fimport$1 (i32.const -25732) ) diff --git a/test/passes/simplify-locals_all-features.wast b/test/passes/simplify-locals_all-features.wast index f46f9fd71..b302a317d 100644 --- a/test/passes/simplify-locals_all-features.wast +++ b/test/passes/simplify-locals_all-features.wast @@ -21,22 +21,28 @@ (local $a i32) (local $b i32) (local.set $x (i32.const 1)) - (if (local.get $x) (nop)) - (if (local.get $x) (nop)) - (local.set $y (if (result i32) (i32.const 2) (i32.const 3) (i32.const 4))) + (if (local.get $x) (then (nop))) + (if (local.get $x) (then (nop))) + (local.set $y (if (result i32) (i32.const 2) (then (i32.const 3) )(else (i32.const 4)))) (drop (local.get $y)) (local.set $z (block (result i32) (i32.const 5))) (drop (local.get $z)) (if (i32.const 6) - (local.set $a (i32.const 7)) - (local.set $a (i32.const 8)) + (then + (local.set $a (i32.const 7)) + ) + (else + (local.set $a (i32.const 8)) + ) ) (drop (local.get $a)) (block $val (if (i32.const 10) - (block - (local.set $b (i32.const 11)) - (br $val) + (then + (block + (local.set $b (i32.const 11)) + (br $val) + ) ) ) (local.set $b (i32.const 12)) @@ -502,8 +508,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -517,8 +527,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -528,8 +542,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -547,8 +565,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -562,8 +584,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -573,8 +599,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -681,23 +711,31 @@ (block $waka2 (if (i32.const 1) - (local.set $x - (i32.const 13) + (then + (local.set $x + (i32.const 13) + ) ) - (local.set $x - (i32.const 24) + (else + (local.set $x + (i32.const 24) + ) ) ) (if (i32.const 1) - (block $block3 - (local.set $x - (i32.const 14) + (then + (block $block3 + (local.set $x + (i32.const 14) + ) ) ) - (block $block5 - (local.set $x - (i32.const 25) + (else + (block $block5 + (local.set $x + (i32.const 25) + ) ) ) ) @@ -811,19 +849,23 @@ (drop (if (result i32) (local.get $x) - (block $block53 (result i32) - (nop) - (local.set $temp - (local.get $y) + (then + (block $block53 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) - (block $block54 (result i32) - (nop) - (local.set $temp - (local.get $y) + (else + (block $block54 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) ) ) @@ -839,19 +881,21 @@ (local.get $label) (i32.const 15) ) - (block $block - (local.set $label - (i32.const 0) - ) - (local.set $$cond2 - (i32.eq - (local.get $$$0151) + (then + (block $block + (local.set $label (i32.const 0) ) - ) - (br_if $label$break$L4 ;; when we add a value to this, its type changes as it returns the value too, so must be dropped - (i32.eqz - (local.get $$cond2) + (local.set $$cond2 + (i32.eq + (local.get $$$0151) + (i32.const 0) + ) + ) + (br_if $label$break$L4 ;; when we add a value to this, its type changes as it returns the value too, so must be dropped + (i32.eqz + (local.get $$cond2) + ) ) ) ) @@ -876,11 +920,15 @@ (func $if-return-but-unreachable (param $var$0 i64) (if (unreachable) - (local.set $var$0 - (local.get $var$0) + (then + (local.set $var$0 + (local.get $var$0) + ) ) - (local.set $var$0 - (i64.const 1) + (else + (local.set $var$0 + (i64.const 1) + ) ) ) ) @@ -888,8 +936,10 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 2) + (then + (local.set $x + (i32.const 2) + ) ) ) (local.get $x) @@ -902,8 +952,10 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 2) + (then + (local.set $x + (i32.const 2) + ) ) ) (local.get $y) @@ -914,16 +966,22 @@ (local.get $0) (i32.const -1073741824) ) - (local.set $0 - (i32.const -1073741824) - ) - (if - (i32.gt_s - (local.get $0) - (i32.const 1073741823) - ) + (then (local.set $0 - (i32.const 1073741823) + (i32.const -1073741824) + ) + ) + (else + (if + (i32.gt_s + (local.get $0) + (i32.const 1073741823) + ) + (then + (local.set $0 + (i32.const 1073741823) + ) + ) ) ) ) @@ -941,8 +999,12 @@ (local.set $x (if (result i32) (i32.const -1) - (i32.const -2) - (local.get $x) + (then + (i32.const -2) + ) + (else + (local.get $x) + ) ) ) ;; oops, this one is a tee @@ -951,8 +1013,12 @@ (local.tee $x (if (result i32) (i32.const -3) - (i32.const -4) - (local.get $x) + (then + (i32.const -4) + ) + (else + (local.get $x) + ) ) ) ) @@ -961,8 +1027,12 @@ (local.set $y (if (result i32) (i32.const -5) - (i32.const -6) - (local.get $y) + (then + (i32.const -6) + ) + (else + (local.get $y) + ) ) ) (drop (i32.eqz (local.get $y))) @@ -970,8 +1040,12 @@ (local.set $z (if (result i32) (i32.const -7) - (i32.const -8) - (local.get $z) + (then + (i32.const -8) + ) + (else + (local.get $z) + ) ) ) (drop @@ -984,19 +1058,25 @@ (block $label$1 (result i32) (if (i32.const 1) - (local.set $4 - (i32.const 2) + (then + (local.set $4 + (i32.const 2) + ) ) ) (if (local.get $4) - (local.set $4 - (i32.const 0) + (then + (local.set $4 + (i32.const 0) + ) ) ) (local.get $4) ) - (unreachable) + (then + (unreachable) + ) ) (i32.const 0) ) @@ -1004,16 +1084,28 @@ (local.set $20 (if (result i32) (i32.const 1) - (if (result i32) - (i32.const 2) + (then (if (result i32) - (i32.const 3) - (i32.const 4) - (local.get $20) + (i32.const 2) + (then + (if (result i32) + (i32.const 3) + (then + (i32.const 4) + ) + (else + (local.get $20) + ) + ) + ) + (else + (local.get $20) + ) ) + ) + (else (local.get $20) ) - (local.get $20) ) ) (local.get $20) @@ -1050,8 +1142,12 @@ (i32.eqz (local.get $0) ) - (f32.const 4623408228068004207103214e13) - (local.get $3) + (then + (f32.const 4623408228068004207103214e13) + ) + (else + (local.get $3) + ) ) ) ) @@ -1063,25 +1159,29 @@ ) (if (result f64) (global.get $global$0) - (block - (global.set $global$0 - (i32.sub - (global.get $global$0) - (i32.const 1) + (then + (block + (global.set $global$0 + (i32.sub + (global.get $global$0) + (i32.const 1) + ) ) - ) - (local.set $0 - (i32.const -65) - ) - (global.set $global$0 - (i32.sub - (global.get $global$0) - (i32.const 1) + (local.set $0 + (i32.const -65) + ) + (global.set $global$0 + (i32.sub + (global.get $global$0) + (i32.const 1) + ) ) + (br $label$1) ) - (br $label$1) ) - (f64.const -70) + (else + (f64.const -70) + ) ) ) ) @@ -1199,22 +1299,34 @@ (block $out (if (i32.const 1) - (br $out) - (local.set $x - (i32.const 2) + (then + (br $out) + ) + (else + (local.set $x + (i32.const 2) + ) ) ) (if (i32.const 3) - (local.set $x - (i32.const 4) + (then + (local.set $x + (i32.const 4) + ) + ) + (else + (br $out) ) - (br $out) ) (if (i32.const 5) - (br $out) - (br $out) + (then + (br $out) + ) + (else + (br $out) + ) ) ) ) @@ -1224,63 +1336,75 @@ (block $out (if (i32.const 1) - (block - (local.set $x - (i32.const 2) - ) - (local.set $y - (i32.const 3) + (then + (block + (local.set $x + (i32.const 2) + ) + (local.set $y + (i32.const 3) + ) + (br $out) ) - (br $out) ) - (block - (local.set $x - (i32.const 4) - ) - (local.set $y - (i32.const 5) + (else + (block + (local.set $x + (i32.const 4) + ) + (local.set $y + (i32.const 5) + ) ) ) ) (if (i32.const 6) - (block - (local.set $x - (i32.const 7) - ) - (local.set $y - (i32.const 8) + (then + (block + (local.set $x + (i32.const 7) + ) + (local.set $y + (i32.const 8) + ) ) ) - (block - (local.set $x - (i32.const 9) - ) - (local.set $y - (i32.const 10) + (else + (block + (local.set $x + (i32.const 9) + ) + (local.set $y + (i32.const 10) + ) + (br $out) ) - (br $out) ) ) (if (i32.const 11) - (block - (local.set $x - (i32.const 12) - ) - (local.set $y - (i32.const 13) + (then + (block + (local.set $x + (i32.const 12) + ) + (local.set $y + (i32.const 13) + ) + (br $out) ) - (br $out) ) - (block - (local.set $x - (i32.const 14) - ) - (local.set $y - (i32.const 15) + (else + (block + (local.set $x + (i32.const 14) + ) + (local.set $y + (i32.const 15) + ) + (br $out) ) - (br $out) ) ) ) @@ -1308,11 +1432,15 @@ (local $0 i32) (if (i32.const 0) - (local.set $0 - (i32.const 0) + (then + (local.set $0 + (i32.const 0) + ) ) - (loop $label$4 - (br $label$4) + (else + (loop $label$4 + (br $label$4) + ) ) ) (local.get $0) @@ -1322,11 +1450,13 @@ (block $label$2 (if (i32.const 0) - (block - (local.set $var$0 - (i32.const -1) + (then + (block + (local.set $var$0 + (i32.const -1) + ) + (br $label$2) ) - (br $label$2) ) ) (local.set $var$0 @@ -1341,7 +1471,9 @@ (local $y i32) (local.set $x (local.get $y)) (if (i32.const 1) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) ) (local.set $x (local.get $y)) (local.set $x (local.get $y)) @@ -1351,7 +1483,9 @@ (local $y i32) (local.set $y (local.get $x)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $y (local.get $x)) (local.set $y (local.get $x)) @@ -1366,11 +1500,15 @@ (local.set $w (local.get $z)) (local.set $x (local.get $z)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $x (local.get $z)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $y (local.get $x)) (local.set $z (local.get $y)) @@ -1378,7 +1516,9 @@ (local.set $z (i32.const 2)) (local.set $x (local.get $z)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $y (local.get $x)) (local.set $z (local.get $y)) @@ -1425,10 +1565,14 @@ (func $if-value-structure-equivalent (param $x i32) (result i32) (local $y i32) (if (i32.const 1) - (local.set $x (i32.const 2)) - (block - (local.set $y (local.get $x)) - (local.set $x (local.get $y)) + (then + (local.set $x (i32.const 2)) + ) + (else + (block + (local.set $y (local.get $x)) + (local.set $x (local.get $y)) + ) ) ) (local.get $x) @@ -1472,14 +1616,18 @@ ) (if (local.get $0) - (local.set $5 - (f32.const -2048) + (then + (local.set $5 + (f32.const -2048) + ) ) - (block - (call $fimport$1 - (i32.const -25732) + (else + (block + (call $fimport$1 + (i32.const -25732) + ) + (br $label$2) ) - (br $label$2) ) ) ) diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.txt b/test/passes/simplify-locals_all-features_disable-exception-handling.txt index 6ee89372d..f14253c3e 100644 --- a/test/passes/simplify-locals_all-features_disable-exception-handling.txt +++ b/test/passes/simplify-locals_all-features_disable-exception-handling.txt @@ -31,18 +31,26 @@ (local.tee $x (i32.const 1) ) - (nop) + (then + (nop) + ) ) (if (local.get $x) - (nop) + (then + (nop) + ) ) (nop) (drop (if (result i32) (i32.const 2) - (i32.const 3) - (i32.const 4) + (then + (i32.const 3) + ) + (else + (i32.const 4) + ) ) ) (nop) @@ -55,11 +63,11 @@ (drop (if (result i32) (i32.const 6) - (block (result i32) + (then (nop) (i32.const 7) ) - (block (result i32) + (else (nop) (i32.const 8) ) @@ -70,7 +78,7 @@ (block $val (result i32) (if (i32.const 10) - (block + (then (nop) (br $val (i32.const 11) @@ -492,8 +500,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -510,8 +522,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -521,8 +537,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -550,8 +570,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -568,8 +592,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -579,8 +607,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -666,11 +698,11 @@ (local.set $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 13) ) - (block (result i32) + (else (nop) (i32.const 24) ) @@ -683,13 +715,13 @@ (local.tee $x (if (result i32) (i32.const 1) - (block (result i32) + (then (block $block3 (nop) ) (i32.const 14) ) - (block (result i32) + (else (block $block5 (nop) ) @@ -814,19 +846,23 @@ (drop (if (result i32) (local.get $x) - (block $block53 (result i32) - (nop) - (local.set $temp - (local.get $y) + (then + (block $block53 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) - (block $block54 (result i32) - (nop) - (local.set $temp - (local.get $y) + (else + (block $block54 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) ) ) @@ -846,19 +882,21 @@ (local.get $label) (i32.const 15) ) - (block $block - (nop) - (nop) - (drop - (br_if $label$break$L4 - (local.tee $label - (i32.const 0) - ) - (i32.eqz - (i32.eq - (local.get $$$0151) + (then + (block $block + (nop) + (nop) + (drop + (br_if $label$break$L4 + (local.tee $label (i32.const 0) ) + (i32.eqz + (i32.eq + (local.get $$$0151) + (i32.const 0) + ) + ) ) ) ) @@ -881,11 +919,15 @@ (func $if-return-but-unreachable (type $11) (param $var$0 i64) (if (unreachable) - (drop - (local.get $var$0) + (then + (drop + (local.get $var$0) + ) ) - (local.set $var$0 - (i64.const 1) + (else + (local.set $var$0 + (i64.const 1) + ) ) ) ) @@ -895,11 +937,13 @@ (local.tee $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (local.get $x) + (else + (local.get $x) + ) ) ) ) @@ -912,11 +956,13 @@ (local.set $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (local.get $x) + (else + (local.get $x) + ) ) ) (local.get $y) @@ -929,22 +975,24 @@ (local.get $0) (i32.const -1073741824) ) - (block (result i32) + (then (nop) (i32.const -1073741824) ) - (block (result i32) + (else (nop) (if (result i32) (i32.gt_s (local.get $0) (i32.const 1073741823) ) - (block (result i32) + (then (nop) (i32.const 1073741823) ) - (local.get $0) + (else + (local.get $0) + ) ) ) ) @@ -961,8 +1009,12 @@ (local.set $x (if (result i32) (i32.const -1) - (i32.const -2) - (local.get $x) + (then + (i32.const -2) + ) + (else + (local.get $x) + ) ) ) (drop @@ -970,8 +1022,12 @@ (local.tee $x (if (result i32) (i32.const -3) - (i32.const -4) - (local.get $x) + (then + (i32.const -4) + ) + (else + (local.get $x) + ) ) ) ) @@ -982,8 +1038,12 @@ (local.tee $y (if (result i32) (i32.const -5) - (i32.const -6) - (local.get $y) + (then + (i32.const -6) + ) + (else + (local.get $y) + ) ) ) ) @@ -994,8 +1054,12 @@ (local.tee $z (if (result i32) (i32.const -7) - (i32.const -8) - (local.get $z) + (then + (i32.const -8) + ) + (else + (local.get $z) + ) ) ) (local.get $z) @@ -1010,22 +1074,28 @@ (local.tee $4 (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (local.get $4) + (else + (local.get $4) + ) ) ) - (block (result i32) + (then (nop) (i32.const 0) ) - (local.get $4) + (else + (local.get $4) + ) ) ) ) - (unreachable) + (then + (unreachable) + ) ) (i32.const 0) ) @@ -1034,16 +1104,28 @@ (local.tee $20 (if (result i32) (i32.const 1) - (if (result i32) - (i32.const 2) + (then (if (result i32) - (i32.const 3) - (i32.const 4) - (local.get $20) + (i32.const 2) + (then + (if (result i32) + (i32.const 3) + (then + (i32.const 4) + ) + (else + (local.get $20) + ) + ) + ) + (else + (local.get $20) + ) ) + ) + (else (local.get $20) ) - (local.get $20) ) ) ) @@ -1079,8 +1161,12 @@ (i32.eqz (local.get $0) ) - (f32.const 4623408228068004207103214e13) - (local.get $3) + (then + (f32.const 4623408228068004207103214e13) + ) + (else + (local.get $3) + ) ) ) ) @@ -1092,7 +1178,7 @@ ) (if (result f64) (global.get $global$0) - (block + (then (global.set $global$0 (i32.sub (global.get $global$0) @@ -1110,7 +1196,9 @@ ) (br $label$1) ) - (f64.const -70) + (else + (f64.const -70) + ) ) ) ) @@ -1313,11 +1401,11 @@ (drop (if (result i32) (i32.const 1) - (block + (then (br $out) (nop) ) - (block (result i32) + (else (nop) (i32.const 2) ) @@ -1326,11 +1414,11 @@ (drop (if (result i32) (i32.const 3) - (block (result i32) + (then (nop) (i32.const 4) ) - (block + (else (br $out) (nop) ) @@ -1338,8 +1426,12 @@ ) (if (i32.const 5) - (br $out) - (br $out) + (then + (br $out) + ) + (else + (br $out) + ) ) ) ) @@ -1350,13 +1442,13 @@ (drop (if (result i32) (i32.const 1) - (block + (then (nop) (nop) (br $out) (nop) ) - (block (result i32) + (else (nop) (nop) (i32.const 4) @@ -1366,12 +1458,12 @@ (drop (if (result i32) (i32.const 6) - (block (result i32) + (then (nop) (nop) (i32.const 7) ) - (block + (else (nop) (nop) (br $out) @@ -1381,12 +1473,12 @@ ) (if (i32.const 11) - (block + (then (nop) (nop) (br $out) ) - (block + (else (nop) (nop) (br $out) @@ -1422,11 +1514,11 @@ (nop) (if (result i32) (i32.const 0) - (block (result i32) + (then (nop) (i32.const 0) ) - (block + (else (loop $label$4 (br $label$4) ) @@ -1447,11 +1539,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $x) + (else + (local.get $x) + ) ) ) (drop @@ -1470,11 +1564,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (drop @@ -1502,11 +1598,13 @@ (local.set $y (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (local.set $x @@ -1515,11 +1613,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (nop) @@ -1536,11 +1636,13 @@ (drop (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 1) ) - (local.get $y) + (else + (local.get $y) + ) ) ) (nop) @@ -1597,11 +1699,11 @@ (local.tee $x (if (result i32) (i32.const 1) - (block (result i32) + (then (nop) (i32.const 2) ) - (block (result i32) + (else (nop) (nop) (local.get $x) @@ -1654,11 +1756,11 @@ (nop) (if (result f32) (call $fimport$0) - (block (result f32) + (then (nop) (f32.const -2048) ) - (block + (else (call $fimport$1 (i32.const -25732) ) diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.wast b/test/passes/simplify-locals_all-features_disable-exception-handling.wast index 1f308723a..9cb4bf748 100644 --- a/test/passes/simplify-locals_all-features_disable-exception-handling.wast +++ b/test/passes/simplify-locals_all-features_disable-exception-handling.wast @@ -21,22 +21,28 @@ (local $a i32) (local $b i32) (local.set $x (i32.const 1)) - (if (local.get $x) (nop)) - (if (local.get $x) (nop)) - (local.set $y (if (result i32) (i32.const 2) (i32.const 3) (i32.const 4))) + (if (local.get $x) (then (nop))) + (if (local.get $x) (then (nop))) + (local.set $y (if (result i32) (i32.const 2) (then (i32.const 3) )(else (i32.const 4)))) (drop (local.get $y)) (local.set $z (block (result i32) (i32.const 5))) (drop (local.get $z)) (if (i32.const 6) - (local.set $a (i32.const 7)) - (local.set $a (i32.const 8)) + (then + (local.set $a (i32.const 7)) + ) + (else + (local.set $a (i32.const 8)) + ) ) (drop (local.get $a)) (block $val (if (i32.const 10) - (block - (local.set $b (i32.const 11)) - (br $val) + (then + (block + (local.set $b (i32.const 11)) + (br $val) + ) ) ) (local.set $b (i32.const 12)) @@ -502,8 +508,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -517,8 +527,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -528,8 +542,12 @@ (local.get $$a$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -547,8 +565,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -562,8 +584,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 31) ) @@ -573,8 +599,12 @@ (local.get $$b$1) (i32.const 0) ) - (i32.const -1) - (i32.const 0) + (then + (i32.const -1) + ) + (else + (i32.const 0) + ) ) (i32.const 1) ) @@ -681,23 +711,31 @@ (block $waka2 (if (i32.const 1) - (local.set $x - (i32.const 13) + (then + (local.set $x + (i32.const 13) + ) ) - (local.set $x - (i32.const 24) + (else + (local.set $x + (i32.const 24) + ) ) ) (if (i32.const 1) - (block $block3 - (local.set $x - (i32.const 14) + (then + (block $block3 + (local.set $x + (i32.const 14) + ) ) ) - (block $block5 - (local.set $x - (i32.const 25) + (else + (block $block5 + (local.set $x + (i32.const 25) + ) ) ) ) @@ -811,19 +849,23 @@ (drop (if (result i32) (local.get $x) - (block $block53 (result i32) - (nop) - (local.set $temp - (local.get $y) + (then + (block $block53 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) - (block $block54 (result i32) - (nop) - (local.set $temp - (local.get $y) + (else + (block $block54 (result i32) + (nop) + (local.set $temp + (local.get $y) + ) + (local.get $z) ) - (local.get $z) ) ) ) @@ -839,19 +881,21 @@ (local.get $label) (i32.const 15) ) - (block $block - (local.set $label - (i32.const 0) - ) - (local.set $$cond2 - (i32.eq - (local.get $$$0151) + (then + (block $block + (local.set $label (i32.const 0) ) - ) - (br_if $label$break$L4 ;; when we add a value to this, its type changes as it returns the value too, so must be dropped - (i32.eqz - (local.get $$cond2) + (local.set $$cond2 + (i32.eq + (local.get $$$0151) + (i32.const 0) + ) + ) + (br_if $label$break$L4 ;; when we add a value to this, its type changes as it returns the value too, so must be dropped + (i32.eqz + (local.get $$cond2) + ) ) ) ) @@ -876,11 +920,15 @@ (func $if-return-but-unreachable (param $var$0 i64) (if (unreachable) - (local.set $var$0 - (local.get $var$0) + (then + (local.set $var$0 + (local.get $var$0) + ) ) - (local.set $var$0 - (i64.const 1) + (else + (local.set $var$0 + (i64.const 1) + ) ) ) ) @@ -888,8 +936,10 @@ (local $x i32) (if (i32.const 1) - (local.set $x - (i32.const 2) + (then + (local.set $x + (i32.const 2) + ) ) ) (local.get $x) @@ -902,8 +952,10 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 2) + (then + (local.set $x + (i32.const 2) + ) ) ) (local.get $y) @@ -914,16 +966,22 @@ (local.get $0) (i32.const -1073741824) ) - (local.set $0 - (i32.const -1073741824) - ) - (if - (i32.gt_s - (local.get $0) - (i32.const 1073741823) - ) + (then (local.set $0 - (i32.const 1073741823) + (i32.const -1073741824) + ) + ) + (else + (if + (i32.gt_s + (local.get $0) + (i32.const 1073741823) + ) + (then + (local.set $0 + (i32.const 1073741823) + ) + ) ) ) ) @@ -941,8 +999,12 @@ (local.set $x (if (result i32) (i32.const -1) - (i32.const -2) - (local.get $x) + (then + (i32.const -2) + ) + (else + (local.get $x) + ) ) ) ;; oops, this one is a tee @@ -951,8 +1013,12 @@ (local.tee $x (if (result i32) (i32.const -3) - (i32.const -4) - (local.get $x) + (then + (i32.const -4) + ) + (else + (local.get $x) + ) ) ) ) @@ -961,8 +1027,12 @@ (local.set $y (if (result i32) (i32.const -5) - (i32.const -6) - (local.get $y) + (then + (i32.const -6) + ) + (else + (local.get $y) + ) ) ) (drop (i32.eqz (local.get $y))) @@ -970,8 +1040,12 @@ (local.set $z (if (result i32) (i32.const -7) - (i32.const -8) - (local.get $z) + (then + (i32.const -8) + ) + (else + (local.get $z) + ) ) ) (drop @@ -984,19 +1058,25 @@ (block $label$1 (result i32) (if (i32.const 1) - (local.set $4 - (i32.const 2) + (then + (local.set $4 + (i32.const 2) + ) ) ) (if (local.get $4) - (local.set $4 - (i32.const 0) + (then + (local.set $4 + (i32.const 0) + ) ) ) (local.get $4) ) - (unreachable) + (then + (unreachable) + ) ) (i32.const 0) ) @@ -1004,16 +1084,28 @@ (local.set $20 (if (result i32) (i32.const 1) - (if (result i32) - (i32.const 2) + (then (if (result i32) - (i32.const 3) - (i32.const 4) - (local.get $20) + (i32.const 2) + (then + (if (result i32) + (i32.const 3) + (then + (i32.const 4) + ) + (else + (local.get $20) + ) + ) + ) + (else + (local.get $20) + ) ) + ) + (else (local.get $20) ) - (local.get $20) ) ) (local.get $20) @@ -1050,8 +1142,12 @@ (i32.eqz (local.get $0) ) - (f32.const 4623408228068004207103214e13) - (local.get $3) + (then + (f32.const 4623408228068004207103214e13) + ) + (else + (local.get $3) + ) ) ) ) @@ -1063,25 +1159,29 @@ ) (if (result f64) (global.get $global$0) - (block - (global.set $global$0 - (i32.sub - (global.get $global$0) - (i32.const 1) + (then + (block + (global.set $global$0 + (i32.sub + (global.get $global$0) + (i32.const 1) + ) ) - ) - (local.set $0 - (i32.const -65) - ) - (global.set $global$0 - (i32.sub - (global.get $global$0) - (i32.const 1) + (local.set $0 + (i32.const -65) + ) + (global.set $global$0 + (i32.sub + (global.get $global$0) + (i32.const 1) + ) ) + (br $label$1) ) - (br $label$1) ) - (f64.const -70) + (else + (f64.const -70) + ) ) ) ) @@ -1199,22 +1299,34 @@ (block $out (if (i32.const 1) - (br $out) - (local.set $x - (i32.const 2) + (then + (br $out) + ) + (else + (local.set $x + (i32.const 2) + ) ) ) (if (i32.const 3) - (local.set $x - (i32.const 4) + (then + (local.set $x + (i32.const 4) + ) + ) + (else + (br $out) ) - (br $out) ) (if (i32.const 5) - (br $out) - (br $out) + (then + (br $out) + ) + (else + (br $out) + ) ) ) ) @@ -1224,63 +1336,75 @@ (block $out (if (i32.const 1) - (block - (local.set $x - (i32.const 2) - ) - (local.set $y - (i32.const 3) + (then + (block + (local.set $x + (i32.const 2) + ) + (local.set $y + (i32.const 3) + ) + (br $out) ) - (br $out) ) - (block - (local.set $x - (i32.const 4) - ) - (local.set $y - (i32.const 5) + (else + (block + (local.set $x + (i32.const 4) + ) + (local.set $y + (i32.const 5) + ) ) ) ) (if (i32.const 6) - (block - (local.set $x - (i32.const 7) - ) - (local.set $y - (i32.const 8) + (then + (block + (local.set $x + (i32.const 7) + ) + (local.set $y + (i32.const 8) + ) ) ) - (block - (local.set $x - (i32.const 9) - ) - (local.set $y - (i32.const 10) + (else + (block + (local.set $x + (i32.const 9) + ) + (local.set $y + (i32.const 10) + ) + (br $out) ) - (br $out) ) ) (if (i32.const 11) - (block - (local.set $x - (i32.const 12) - ) - (local.set $y - (i32.const 13) + (then + (block + (local.set $x + (i32.const 12) + ) + (local.set $y + (i32.const 13) + ) + (br $out) ) - (br $out) ) - (block - (local.set $x - (i32.const 14) - ) - (local.set $y - (i32.const 15) + (else + (block + (local.set $x + (i32.const 14) + ) + (local.set $y + (i32.const 15) + ) + (br $out) ) - (br $out) ) ) ) @@ -1308,11 +1432,15 @@ (local $0 i32) (if (i32.const 0) - (local.set $0 - (i32.const 0) + (then + (local.set $0 + (i32.const 0) + ) ) - (loop $label$4 - (br $label$4) + (else + (loop $label$4 + (br $label$4) + ) ) ) (local.get $0) @@ -1322,11 +1450,13 @@ (block $label$2 (if (i32.const 0) - (block - (local.set $var$0 - (i32.const -1) + (then + (block + (local.set $var$0 + (i32.const -1) + ) + (br $label$2) ) - (br $label$2) ) ) (local.set $var$0 @@ -1341,7 +1471,9 @@ (local $y i32) (local.set $x (local.get $y)) (if (i32.const 1) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) ) (local.set $x (local.get $y)) (local.set $x (local.get $y)) @@ -1351,7 +1483,9 @@ (local $y i32) (local.set $y (local.get $x)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $y (local.get $x)) (local.set $y (local.get $x)) @@ -1366,11 +1500,15 @@ (local.set $w (local.get $z)) (local.set $x (local.get $z)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $x (local.get $z)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $y (local.get $x)) (local.set $z (local.get $y)) @@ -1378,7 +1516,9 @@ (local.set $z (i32.const 2)) (local.set $x (local.get $z)) (if (i32.const 1) - (local.set $y (i32.const 1)) + (then + (local.set $y (i32.const 1)) + ) ) (local.set $y (local.get $x)) (local.set $z (local.get $y)) @@ -1425,10 +1565,14 @@ (func $if-value-structure-equivalent (param $x i32) (result i32) (local $y i32) (if (i32.const 1) - (local.set $x (i32.const 2)) - (block - (local.set $y (local.get $x)) - (local.set $x (local.get $y)) + (then + (local.set $x (i32.const 2)) + ) + (else + (block + (local.set $y (local.get $x)) + (local.set $x (local.get $y)) + ) ) ) (local.get $x) @@ -1472,14 +1616,18 @@ ) (if (local.get $0) - (local.set $5 - (f32.const -2048) + (then + (local.set $5 + (f32.const -2048) + ) ) - (block - (call $fimport$1 - (i32.const -25732) + (else + (block + (call $fimport$1 + (i32.const -25732) + ) + (br $label$2) ) - (br $label$2) ) ) ) diff --git a/test/passes/souperify.txt b/test/passes/souperify.txt index c98e21b71..113400e67 100644 --- a/test/passes/souperify.txt +++ b/test/passes/souperify.txt @@ -13,11 +13,13 @@ infer %0 (local $0 i32) (if (i32.const 0) - (loop $label$0 - (local.set $0 - (i32.sub - (i32.const 0) - (i32.const 0) + (then + (loop $label$0 + (local.set $0 + (i32.sub + (i32.const 0) + (i32.const 0) + ) ) ) ) diff --git a/test/passes/souperify.wast b/test/passes/souperify.wast index 97227ed53..a67c7d04f 100644 --- a/test/passes/souperify.wast +++ b/test/passes/souperify.wast @@ -4,11 +4,13 @@ (func $if-loop-test (local $0 i32) (if (i32.const 0) - (loop $label$0 - (local.set $0 - (i32.sub - (i32.const 0) - (i32.const 0) + (then + (loop $label$0 + (local.set $0 + (i32.sub + (i32.const 0) + (i32.const 0) + ) ) ) ) diff --git a/test/passes/spill-pointers.txt b/test/passes/spill-pointers.txt index ebfb3b9e7..c9b9a4a3e 100644 --- a/test/passes/spill-pointers.txt +++ b/test/passes/spill-pointers.txt @@ -337,7 +337,7 @@ ) (if (i32.const 1) - (block + (then (local.set $2 (i32.const 2) ) @@ -348,7 +348,7 @@ (local.get $2) ) ) - (block + (else (local.set $3 (i32.const 3) ) @@ -985,7 +985,7 @@ ) (if (i32.const 1) - (block + (then (local.set $2 (i32.const 2) ) @@ -996,7 +996,7 @@ (local.get $2) ) ) - (block + (else (local.set $3 (i32.const 3) ) diff --git a/test/passes/spill-pointers.wast b/test/passes/spill-pointers.wast index 4eb05a721..4a9d71f14 100644 --- a/test/passes/spill-pointers.wast +++ b/test/passes/spill-pointers.wast @@ -83,8 +83,12 @@ (call $nothing) (drop (local.get $x)) (if (i32.const 1) - (return (i32.const 2)) - (return (i32.const 3)) + (then + (return (i32.const 2)) + ) + (else + (return (i32.const 3)) + ) ) (i32.const 4) ) @@ -254,8 +258,12 @@ (call $nothing) (drop (local.get $x)) (if (i32.const 1) - (return (i32.const 2)) - (return (i32.const 3)) + (then + (return (i32.const 2)) + ) + (else + (return (i32.const 3)) + ) ) (i32.const 4) ) diff --git a/test/passes/ssa-nomerge_enable-simd.txt b/test/passes/ssa-nomerge_enable-simd.txt index 55105fe91..4c7a186eb 100644 --- a/test/passes/ssa-nomerge_enable-simd.txt +++ b/test/passes/ssa-nomerge_enable-simd.txt @@ -56,14 +56,20 @@ (drop (if (result i32) (i32.const 1) - (i32.const 0) - (i32.const 0) + (then + (i32.const 0) + ) + (else + (i32.const 0) + ) ) ) (if (i32.const 1) - (local.set $x - (i32.const 1) + (then + (local.set $x + (i32.const 1) + ) ) ) (drop @@ -71,8 +77,10 @@ ) (if (i32.const 1) - (local.set $p - (i32.const 1) + (then + (local.set $p + (i32.const 1) + ) ) ) (drop @@ -80,19 +88,27 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 2) + (then + (local.set $x + (i32.const 2) + ) + ) + (else + (nop) ) - (nop) ) (drop (local.get $x) ) (if (i32.const 1) - (nop) - (local.set $x - (i32.const 3) + (then + (nop) + ) + (else + (local.set $x + (i32.const 3) + ) ) ) (drop @@ -100,11 +116,15 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 4) + (then + (local.set $x + (i32.const 4) + ) ) - (local.set $x - (i32.const 5) + (else + (local.set $x + (i32.const 5) + ) ) ) (drop @@ -112,10 +132,12 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 6) + (then + (local.set $x + (i32.const 6) + ) ) - (block + (else (local.set $3 (i32.const 7) ) @@ -131,7 +153,7 @@ (func $if2 (param $x i32) (if (i32.const 1) - (block + (then (local.set $x (i32.const 1) ) @@ -172,8 +194,10 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 4) + (then + (local.set $x + (i32.const 4) + ) ) ) (call $nomerge @@ -189,11 +213,15 @@ ) (if (i32.const 1) - (local.set $x - (i32.const 6) + (then + (local.set $x + (i32.const 6) + ) ) - (local.set $x - (i32.const 7) + (else + (local.set $x + (i32.const 7) + ) ) ) (call $nomerge diff --git a/test/passes/ssa-nomerge_enable-simd.wast b/test/passes/ssa-nomerge_enable-simd.wast index fa1187a7f..f99febe3e 100644 --- a/test/passes/ssa-nomerge_enable-simd.wast +++ b/test/passes/ssa-nomerge_enable-simd.wast @@ -25,46 +25,70 @@ (drop (if i32 (i32.const 1) - (local.get $x) - (local.get $y) + (then + (local.get $x) + ) + (else + (local.get $y) + ) ) ) (if (i32.const 1) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) ) (drop (local.get $x)) ;; same but with param (if (i32.const 1) - (local.set $p (i32.const 1)) + (then + (local.set $p (i32.const 1)) + ) ) (drop (local.get $p)) ;; if-else (if (i32.const 1) - (local.set $x (i32.const 2)) - (nop) + (then + (local.set $x (i32.const 2)) + ) + (else + (nop) + ) ) (drop (local.get $x)) (if (i32.const 1) - (nop) - (local.set $x (i32.const 3)) + (then + (nop) + ) + (else + (local.set $x (i32.const 3)) + ) ) (drop (local.get $x)) (if (i32.const 1) - (local.set $x (i32.const 4)) - (local.set $x (i32.const 5)) + (then + (local.set $x (i32.const 4)) + ) + (else + (local.set $x (i32.const 5)) + ) ) (drop (local.get $x)) (if (i32.const 1) - (local.set $x (i32.const 6)) - (block - (local.set $x (i32.const 7)) - (local.set $x (i32.const 8)) + (then + (local.set $x (i32.const 6)) + ) + (else + (block + (local.set $x (i32.const 7)) + (local.set $x (i32.const 8)) + ) ) ) (drop (local.get $x)) @@ -72,9 +96,11 @@ (func $if2 (param $x i32) (if (i32.const 1) - (block - (local.set $x (i32.const 1)) - (drop (local.get $x)) ;; use between phi set and use + (then + (block + (local.set $x (i32.const 1)) + (drop (local.get $x)) ;; use between phi set and use + ) ) ) (drop (local.get $x)) @@ -88,14 +114,20 @@ (local.set $x (i32.const 3)) ;; but this reaches a merge later (call $nomerge (local.get $x) (local.get $x)) (if (i32.const 1) - (local.set $x (i32.const 4)) + (then + (local.set $x (i32.const 4)) + ) ) (call $nomerge (local.get $x) (local.get $x)) (local.set $x (i32.const 5)) ;; this is good again (call $nomerge (local.get $x) (local.get $x)) (if (i32.const 1) - (local.set $x (i32.const 6)) ;; these merge, - (local.set $x (i32.const 7)) ;; so no + (then + (local.set $x (i32.const 6)) ;; these merge, + ) + (else + (local.set $x (i32.const 7)) ;; so no + ) ) (call $nomerge (local.get $x) (local.get $x)) ) diff --git a/test/passes/ssa_enable-threads.txt b/test/passes/ssa_enable-threads.txt index d159e0e41..e2ea811fe 100644 --- a/test/passes/ssa_enable-threads.txt +++ b/test/passes/ssa_enable-threads.txt @@ -73,17 +73,23 @@ (drop (if (result i32) (i32.const 1) - (i32.const 0) - (i32.const 0) + (then + (i32.const 0) + ) + (else + (i32.const 0) + ) ) ) (if (i32.const 1) - (local.set $3 - (local.tee $15 - (local.tee $14 - (local.tee $12 - (i32.const 1) + (then + (local.set $3 + (local.tee $15 + (local.tee $14 + (local.tee $12 + (i32.const 1) + ) ) ) ) @@ -94,9 +100,11 @@ ) (if (i32.const 1) - (local.set $4 - (local.tee $13 - (i32.const 1) + (then + (local.set $4 + (local.tee $13 + (i32.const 1) + ) ) ) ) @@ -105,24 +113,32 @@ ) (if (i32.const 1) - (local.set $5 - (local.tee $15 - (local.tee $14 - (i32.const 2) + (then + (local.set $5 + (local.tee $15 + (local.tee $14 + (i32.const 2) + ) ) ) ) - (nop) + (else + (nop) + ) ) (drop (local.get $14) ) (if (i32.const 1) - (nop) - (local.set $6 - (local.tee $15 - (i32.const 3) + (then + (nop) + ) + (else + (local.set $6 + (local.tee $15 + (i32.const 3) + ) ) ) ) @@ -131,14 +147,18 @@ ) (if (i32.const 1) - (local.set $7 - (local.tee $16 - (i32.const 4) + (then + (local.set $7 + (local.tee $16 + (i32.const 4) + ) ) ) - (local.set $8 - (local.tee $16 - (i32.const 5) + (else + (local.set $8 + (local.tee $16 + (i32.const 5) + ) ) ) ) @@ -147,12 +167,14 @@ ) (if (i32.const 1) - (local.set $9 - (local.tee $17 - (i32.const 6) + (then + (local.set $9 + (local.tee $17 + (i32.const 6) + ) ) ) - (block + (else (local.set $10 (i32.const 7) ) @@ -177,7 +199,7 @@ (block (if (i32.const 1) - (block + (then (local.set $1 (local.tee $2 (i32.const 1) @@ -239,7 +261,7 @@ ) (if (i32.const 3) - (block + (then (local.set $2 (local.tee $6 (i32.const 1) @@ -264,19 +286,27 @@ ) (if (i32.const 5) - (br $out) + (then + (br $out) + ) ) (drop (local.get $3) ) (if (i32.const 6) - (nop) + (then + (nop) + ) ) (if (i32.const 7) - (nop) - (nop) + (then + (nop) + ) + (else + (nop) + ) ) (block $in (local.set $4 @@ -453,7 +483,9 @@ (block $stop (if (i32.const 1) - (br $stop) + (then + (br $stop) + ) ) (local.set $inc (i32.add @@ -493,7 +525,9 @@ (loop $more (if (i32.const 1) - (br $stop) + (then + (br $stop) + ) ) (local.set $inc (i32.add @@ -531,7 +565,9 @@ (block $out1 (if (local.get $3) - (br $out1) + (then + (br $out1) + ) ) (local.set $1 (local.tee $4 @@ -547,7 +583,9 @@ (block $out2 (if (local.get $4) - (br $out2) + (then + (br $out2) + ) ) (local.set $2 (local.tee $4 @@ -572,7 +610,9 @@ ) (if (local.get $1) - (br $out1) + (then + (br $out1) + ) ) (br $loop1) ) @@ -581,7 +621,9 @@ (block $out2 (if (local.get $3) - (br $out2) + (then + (br $out2) + ) ) (local.set $2 (local.tee $3 @@ -612,12 +654,16 @@ (loop $loop1 (if (local.get $3) - (br $out) + (then + (br $out) + ) ) (loop $loop2 (if (local.get $4) - (br $out) + (then + (br $out) + ) ) (local.set $1 (local.tee $5 @@ -665,12 +711,16 @@ (loop $loop1 (if (local.get $3) - (br $out) + (then + (br $out) + ) ) (loop $loop2 (if (local.get $4) - (br $out) + (then + (br $out) + ) ) (local.set $1 (local.tee $5 @@ -711,8 +761,10 @@ (i32.eqz (global.get $global$0) ) - (return - (local.get $4) + (then + (return + (local.get $4) + ) ) ) (global.set $global$0 @@ -758,8 +810,10 @@ (i32.eqz (global.get $global$0) ) - (return - (i32.const 12345) + (then + (return + (i32.const 12345) + ) ) ) (global.set $global$0 @@ -769,11 +823,13 @@ (i32.eqz (local.get $7) ) - (br_if $label$1 - (i32.eqz - (local.tee $4 - (local.tee $7 - (i32.const 1) + (then + (br_if $label$1 + (i32.eqz + (local.tee $4 + (local.tee $7 + (i32.const 1) + ) ) ) ) diff --git a/test/passes/ssa_enable-threads.wast b/test/passes/ssa_enable-threads.wast index bbfad89bf..a368f3c34 100644 --- a/test/passes/ssa_enable-threads.wast +++ b/test/passes/ssa_enable-threads.wast @@ -24,46 +24,70 @@ (drop (if i32 (i32.const 1) - (local.get $x) - (local.get $y) + (then + (local.get $x) + ) + (else + (local.get $y) + ) ) ) (if (i32.const 1) - (local.set $x (i32.const 1)) + (then + (local.set $x (i32.const 1)) + ) ) (drop (local.get $x)) ;; same but with param (if (i32.const 1) - (local.set $p (i32.const 1)) + (then + (local.set $p (i32.const 1)) + ) ) (drop (local.get $p)) ;; if-else (if (i32.const 1) - (local.set $x (i32.const 2)) - (nop) + (then + (local.set $x (i32.const 2)) + ) + (else + (nop) + ) ) (drop (local.get $x)) (if (i32.const 1) - (nop) - (local.set $x (i32.const 3)) + (then + (nop) + ) + (else + (local.set $x (i32.const 3)) + ) ) (drop (local.get $x)) (if (i32.const 1) - (local.set $x (i32.const 4)) - (local.set $x (i32.const 5)) + (then + (local.set $x (i32.const 4)) + ) + (else + (local.set $x (i32.const 5)) + ) ) (drop (local.get $x)) (if (i32.const 1) - (local.set $x (i32.const 6)) - (block - (local.set $x (i32.const 7)) - (local.set $x (i32.const 8)) + (then + (local.set $x (i32.const 6)) + ) + (else + (block + (local.set $x (i32.const 7)) + (local.set $x (i32.const 8)) + ) ) ) (drop (local.get $x)) @@ -71,9 +95,11 @@ (func $if2 (param $x i32) (if (i32.const 1) - (block - (local.set $x (i32.const 1)) - (drop (local.get $x)) ;; use between phi set and use + (then + (block + (local.set $x (i32.const 1)) + (drop (local.get $x)) ;; use between phi set and use + ) ) ) (drop (local.get $x)) @@ -92,25 +118,35 @@ (br_if $out (i32.const 2)) (drop (local.get $x)) (if (i32.const 3) - (block - (local.set $x (i32.const 1)) - (drop (local.get $x)) - (br $out) + (then + (block + (local.set $x (i32.const 1)) + (drop (local.get $x)) + (br $out) + ) ) ) (drop (local.get $x)) (local.set $x (i32.const 4)) (drop (local.get $x)) (if (i32.const 5) - (br $out) + (then + (br $out) + ) ) (drop (local.get $x)) (if (i32.const 6) - (nop) + (then + (nop) + ) ) (if (i32.const 7) - (nop) - (nop) + (then + (nop) + ) + (else + (nop) + ) ) ;; finally, switching (block $in @@ -179,7 +215,9 @@ (block $stop (if (i32.const 1) - (br $stop) + (then + (br $stop) + ) ) (local.set $inc (i32.add @@ -206,7 +244,9 @@ (loop $more (if (i32.const 1) - (br $stop) + (then + (br $stop) + ) ) (local.set $inc (i32.add @@ -228,7 +268,9 @@ (block $out1 (if (local.get $param) - (br $out1) + (then + (br $out1) + ) ) (local.set $param (i32.const 1)) (br $loop1) @@ -238,7 +280,9 @@ (block $out2 (if (local.get $param) - (br $out2) + (then + (br $out2) + ) ) (local.set $param (i32.const 2)) (br $loop2) @@ -252,7 +296,9 @@ (local.set $param (i32.const 1)) (if (local.get $param) - (br $out1) + (then + (br $out1) + ) ) (br $loop1) ) @@ -261,7 +307,9 @@ (block $out2 (if (local.get $param) - (br $out2) + (then + (br $out2) + ) ) (local.set $param (i32.const 2)) (br $loop2) @@ -274,12 +322,16 @@ (loop $loop1 (if (local.get $x) - (br $out) + (then + (br $out) + ) ) (loop $loop2 (if (local.get $x) - (br $out) + (then + (br $out) + ) ) (local.set $x (i32.const 1)) (br $loop2) @@ -296,12 +348,16 @@ (loop $loop1 (if (local.get $x) - (br $out) + (then + (br $out) + ) ) (loop $loop2 (if (local.get $x) - (br $out) + (then + (br $out) + ) ) (local.set $x (i32.const 1)) (br_if $loop2 (i32.const 3)) ;; add fallthrough @@ -320,8 +376,10 @@ (i32.eqz (global.get $global$0) ) - (return - (local.get $result) ;; we eventually reach here + (then + (return + (local.get $result) ;; we eventually reach here + ) ) ) (global.set $global$0 @@ -352,8 +410,10 @@ (i32.eqz (global.get $global$0) ) - (return - (i32.const 12345) + (then + (return + (i32.const 12345) + ) ) ) (global.set $global$0 @@ -363,10 +423,12 @@ (i32.eqz (local.get $var$0) ;; check $0 here. this will get a phi var ) - (br_if $label$1 - (i32.eqz - (local.tee $var$0 ;; set $0 to 1. here the two diverge. for the phi, we'll get a set here and above - (i32.const 1) + (then + (br_if $label$1 + (i32.eqz + (local.tee $var$0 ;; set $0 to 1. here the two diverge. for the phi, we'll get a set here and above + (i32.const 1) + ) ) ) ) diff --git a/test/passes/ssa_fuzz-exec_enable-threads.txt b/test/passes/ssa_fuzz-exec_enable-threads.txt index f9d49d5bb..04d6ef59a 100644 --- a/test/passes/ssa_fuzz-exec_enable-threads.txt +++ b/test/passes/ssa_fuzz-exec_enable-threads.txt @@ -21,102 +21,120 @@ (block $label$1 (result i32) (if (result i32) (i32.const 0) - (unreachable) - (block $label$4 (result i32) - (loop $label$5 - (block $label$6 - (block $label$7 - (local.set $8 - (if (result i32) - (local.get $10) - (select - (loop $label$9 (result i32) - (if (result i32) - (local.tee $4 - (i32.const 16384) + (then + (unreachable) + ) + (else + (block $label$4 (result i32) + (loop $label$5 + (block $label$6 + (block $label$7 + (local.set $8 + (if (result i32) + (local.get $10) + (then + (select + (loop $label$9 (result i32) + (if (result i32) + (local.tee $4 + (i32.const 16384) + ) + (then + (i32.const 1) + ) + (else + (i32.const 0) + ) + ) ) - (i32.const 1) - (i32.const 0) - ) - ) - (br_if $label$4 - (i32.const 0) - (local.tee $var$1 - (local.tee $5 - (block $label$12 (result i32) - (br_if $label$5 - (br $label$6) + (br_if $label$4 + (i32.const 0) + (local.tee $var$1 + (local.tee $5 + (block $label$12 (result i32) + (br_if $label$5 + (br $label$6) + ) + (unreachable) + ) ) - (unreachable) ) ) + (i32.const 1) ) ) - (i32.const 1) - ) - (block (result i32) - (loop $label$15 - (if - (i32.const 0) - (return - (local.get $11) + (else + (loop $label$15 + (if + (i32.const 0) + (then + (return + (local.get $11) + ) + ) ) - ) - (if - (local.tee $var$1 - (local.tee $6 - (local.tee $11 + (if + (local.tee $var$1 + (local.tee $6 + (local.tee $11 + (i32.const 0) + ) + ) + ) + (then + (br_if $label$15 (i32.const 0) ) ) ) (br_if $label$15 - (i32.const 0) - ) - ) - (br_if $label$15 - (i32.eqz - (local.tee $7 - (local.tee $11 - (local.tee $10 - (i32.const 129) + (i32.eqz + (local.tee $7 + (local.tee $11 + (local.tee $10 + (i32.const 129) + ) ) ) ) ) ) + (i32.const -5742806) ) - (i32.const -5742806) ) ) ) - ) - (br_if $label$6 - (if (result i32) - (local.get $var$1) - (unreachable) - (block $label$25 (result i32) - (local.set $9 - (block $label$26 (result f64) - (drop - (br_if $label$4 - (br_if $label$25 - (br $label$5) - (i32.const 0) + (br_if $label$6 + (if (result i32) + (local.get $var$1) + (then + (unreachable) + ) + (else + (block $label$25 (result i32) + (local.set $9 + (block $label$26 (result f64) + (drop + (br_if $label$4 + (br_if $label$25 + (br $label$5) + (i32.const 0) + ) + (i32.const 0) + ) ) - (i32.const 0) + (f64.const 1) ) ) - (f64.const 1) + (i32.const 0) ) ) - (i32.const 0) ) ) ) ) + (local.get $4) ) - (local.get $4) ) ) ) diff --git a/test/passes/ssa_fuzz-exec_enable-threads.wast b/test/passes/ssa_fuzz-exec_enable-threads.wast index 5917a3eb3..7dd2fcc73 100644 --- a/test/passes/ssa_fuzz-exec_enable-threads.wast +++ b/test/passes/ssa_fuzz-exec_enable-threads.wast @@ -12,98 +12,118 @@ (block $label$1 (result i32) (if (result i32) (i32.const 0) - (unreachable) - (block $label$4 (result i32) - (loop $label$5 - (block $label$6 - (block $label$7 - (local.set $var$0 - (if (result i32) - (local.get $var$2) - (select - (loop $label$9 (result i32) - (if (result i32) - (local.tee $var$2 - (i32.const 16384) + (then + (unreachable) + ) + (else + (block $label$4 (result i32) + (loop $label$5 + (block $label$6 + (block $label$7 + (local.set $var$0 + (if (result i32) + (local.get $var$2) + (then + (select + (loop $label$9 (result i32) + (if (result i32) + (local.tee $var$2 + (i32.const 16384) + ) + (then + (i32.const 1) + ) + (else + (i32.const 0) + ) + ) ) - (i32.const 1) - (i32.const 0) - ) - ) - (br_if $label$4 - (i32.const 0) - (local.tee $var$1 - (local.tee $var$2 - (block $label$12 (result i32) - (br_if $label$5 - (br $label$6) + (br_if $label$4 + (i32.const 0) + (local.tee $var$1 + (local.tee $var$2 + (block $label$12 (result i32) + (br_if $label$5 + (br $label$6) + ) + (unreachable) + ) ) - (unreachable) ) ) + (i32.const 1) ) ) - (i32.const 1) - ) - (block (result i32) - (loop $label$15 - (if - (i32.const 0) - (return - (local.get $var$2) - ) - ) - (if - (local.tee $var$1 - (local.tee $var$2 + (else + (block (result i32) + (loop $label$15 + (if (i32.const 0) + (then + (return + (local.get $var$2) + ) + ) ) - ) - (block - (br_if $label$15 - (i32.const 0) + (if + (local.tee $var$1 + (local.tee $var$2 + (i32.const 0) + ) + ) + (then + (block + (br_if $label$15 + (i32.const 0) + ) + ) + ) ) - ) - ) - (br_if $label$15 - (i32.eqz - (local.tee $var$2 - (i32.const 129) + (br_if $label$15 + (i32.eqz + (local.tee $var$2 + (i32.const 129) + ) + ) ) ) + (i32.const -5742806) ) ) - (i32.const -5742806) ) ) ) - ) - (br_if $label$6 - (if (result i32) - (local.get $var$1) - (unreachable) - (block $label$25 (result i32) - (local.set $var$3 - (block $label$26 (result f64) - (drop - (br_if $label$4 - (br_if $label$25 - (br $label$5) - (i32.const 0) + (br_if $label$6 + (if (result i32) + (local.get $var$1) + (then + (unreachable) + ) + (else + (block $label$25 (result i32) + (local.set $var$3 + (block $label$26 (result f64) + (drop + (br_if $label$4 + (br_if $label$25 + (br $label$5) + (i32.const 0) + ) + (i32.const 0) + ) ) - (i32.const 0) + (f64.const 1) ) ) - (f64.const 1) + (i32.const 0) ) ) - (i32.const 0) ) ) ) ) + (local.get $var$2) ) - (local.get $var$2) ) ) ) diff --git a/test/passes/stack-check_enable-mutable-globals.txt b/test/passes/stack-check_enable-mutable-globals.txt index a2d7f374d..43e352bdb 100644 --- a/test/passes/stack-check_enable-mutable-globals.txt +++ b/test/passes/stack-check_enable-mutable-globals.txt @@ -22,7 +22,9 @@ (global.get $__stack_limit) ) ) - (unreachable) + (then + (unreachable) + ) ) (global.set $sp (local.get $0) diff --git a/test/passes/trap-mode-clamp.txt b/test/passes/trap-mode-clamp.txt index e41b4e0e3..27512712e 100644 --- a/test/passes/trap-mode-clamp.txt +++ b/test/passes/trap-mode-clamp.txt @@ -110,21 +110,33 @@ (local.get $0) (local.get $0) ) - (i32.const -2147483648) - (if (result i32) - (f32.ge - (local.get $0) - (f32.const 2147483648) - ) + (then (i32.const -2147483648) + ) + (else (if (result i32) - (f32.le + (f32.ge (local.get $0) - (f32.const -2147483648) + (f32.const 2147483648) ) - (i32.const -2147483648) - (i32.trunc_f32_s - (local.get $0) + (then + (i32.const -2147483648) + ) + (else + (if (result i32) + (f32.le + (local.get $0) + (f32.const -2147483648) + ) + (then + (i32.const -2147483648) + ) + (else + (i32.trunc_f32_s + (local.get $0) + ) + ) + ) ) ) ) @@ -136,21 +148,33 @@ (local.get $0) (local.get $0) ) - (i64.const -9223372036854775808) - (if (result i64) - (f32.ge - (local.get $0) - (f32.const 9223372036854775808) - ) + (then (i64.const -9223372036854775808) + ) + (else (if (result i64) - (f32.le + (f32.ge (local.get $0) - (f32.const -9223372036854775808) + (f32.const 9223372036854775808) ) - (i64.const -9223372036854775808) - (i64.trunc_f32_s - (local.get $0) + (then + (i64.const -9223372036854775808) + ) + (else + (if (result i64) + (f32.le + (local.get $0) + (f32.const -9223372036854775808) + ) + (then + (i64.const -9223372036854775808) + ) + (else + (i64.trunc_f32_s + (local.get $0) + ) + ) + ) ) ) ) @@ -162,21 +186,33 @@ (local.get $0) (local.get $0) ) - (i32.const 0) - (if (result i32) - (f32.ge - (local.get $0) - (f32.const 4294967296) - ) + (then (i32.const 0) + ) + (else (if (result i32) - (f32.le + (f32.ge (local.get $0) - (f32.const -1) + (f32.const 4294967296) ) - (i32.const 0) - (i32.trunc_f32_u - (local.get $0) + (then + (i32.const 0) + ) + (else + (if (result i32) + (f32.le + (local.get $0) + (f32.const -1) + ) + (then + (i32.const 0) + ) + (else + (i32.trunc_f32_u + (local.get $0) + ) + ) + ) ) ) ) @@ -188,21 +224,33 @@ (local.get $0) (local.get $0) ) - (i64.const 0) - (if (result i64) - (f32.ge - (local.get $0) - (f32.const 18446744073709551615) - ) + (then (i64.const 0) + ) + (else (if (result i64) - (f32.le + (f32.ge (local.get $0) - (f32.const -1) + (f32.const 18446744073709551615) ) - (i64.const 0) - (i64.trunc_f32_u - (local.get $0) + (then + (i64.const 0) + ) + (else + (if (result i64) + (f32.le + (local.get $0) + (f32.const -1) + ) + (then + (i64.const 0) + ) + (else + (i64.trunc_f32_u + (local.get $0) + ) + ) + ) ) ) ) @@ -214,21 +262,33 @@ (local.get $0) (local.get $0) ) - (i32.const -2147483648) - (if (result i32) - (f64.ge - (local.get $0) - (f64.const 2147483648) - ) + (then (i32.const -2147483648) + ) + (else (if (result i32) - (f64.le + (f64.ge (local.get $0) - (f64.const -2147483649) + (f64.const 2147483648) ) - (i32.const -2147483648) - (i32.trunc_f64_s - (local.get $0) + (then + (i32.const -2147483648) + ) + (else + (if (result i32) + (f64.le + (local.get $0) + (f64.const -2147483649) + ) + (then + (i32.const -2147483648) + ) + (else + (i32.trunc_f64_s + (local.get $0) + ) + ) + ) ) ) ) @@ -240,21 +300,33 @@ (local.get $0) (local.get $0) ) - (i64.const -9223372036854775808) - (if (result i64) - (f64.ge - (local.get $0) - (f64.const 9223372036854775808) - ) + (then (i64.const -9223372036854775808) + ) + (else (if (result i64) - (f64.le + (f64.ge (local.get $0) - (f64.const -9223372036854775808) + (f64.const 9223372036854775808) ) - (i64.const -9223372036854775808) - (i64.trunc_f64_s - (local.get $0) + (then + (i64.const -9223372036854775808) + ) + (else + (if (result i64) + (f64.le + (local.get $0) + (f64.const -9223372036854775808) + ) + (then + (i64.const -9223372036854775808) + ) + (else + (i64.trunc_f64_s + (local.get $0) + ) + ) + ) ) ) ) @@ -266,21 +338,33 @@ (local.get $0) (local.get $0) ) - (i32.const 0) - (if (result i32) - (f64.ge - (local.get $0) - (f64.const 4294967296) - ) + (then (i32.const 0) + ) + (else (if (result i32) - (f64.le + (f64.ge (local.get $0) - (f64.const -1) + (f64.const 4294967296) ) - (i32.const 0) - (i32.trunc_f64_u - (local.get $0) + (then + (i32.const 0) + ) + (else + (if (result i32) + (f64.le + (local.get $0) + (f64.const -1) + ) + (then + (i32.const 0) + ) + (else + (i32.trunc_f64_u + (local.get $0) + ) + ) + ) ) ) ) @@ -292,21 +376,33 @@ (local.get $0) (local.get $0) ) - (i64.const 0) - (if (result i64) - (f64.ge - (local.get $0) - (f64.const 18446744073709551615) - ) + (then (i64.const 0) + ) + (else (if (result i64) - (f64.le + (f64.ge (local.get $0) - (f64.const -1) + (f64.const 18446744073709551615) ) - (i64.const 0) - (i64.trunc_f64_u - (local.get $0) + (then + (i64.const 0) + ) + (else + (if (result i64) + (f64.le + (local.get $0) + (f64.const -1) + ) + (then + (i64.const 0) + ) + (else + (i64.trunc_f64_u + (local.get $0) + ) + ) + ) ) ) ) @@ -317,22 +413,30 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (if (result i32) - (i32.and - (i32.eq - (local.get $0) - (i32.const -2147483648) + (then + (i32.const 0) + ) + (else + (if (result i32) + (i32.and + (i32.eq + (local.get $0) + (i32.const -2147483648) + ) + (i32.eq + (local.get $1) + (i32.const -1) + ) ) - (i32.eq - (local.get $1) - (i32.const -1) + (then + (i32.const 0) + ) + (else + (i32.div_s + (local.get $0) + (local.get $1) + ) ) - ) - (i32.const 0) - (i32.div_s - (local.get $0) - (local.get $1) ) ) ) @@ -342,10 +446,14 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (i32.rem_s - (local.get $0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (i32.rem_s + (local.get $0) + (local.get $1) + ) ) ) ) @@ -354,10 +462,14 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (i32.div_u - (local.get $0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (i32.div_u + (local.get $0) + (local.get $1) + ) ) ) ) @@ -366,10 +478,14 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (i32.rem_u - (local.get $0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (i32.rem_u + (local.get $0) + (local.get $1) + ) ) ) ) @@ -378,22 +494,30 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (if (result i64) - (i32.and - (i64.eq - (local.get $0) - (i64.const -9223372036854775808) + (then + (i64.const 0) + ) + (else + (if (result i64) + (i32.and + (i64.eq + (local.get $0) + (i64.const -9223372036854775808) + ) + (i64.eq + (local.get $1) + (i64.const -1) + ) ) - (i64.eq - (local.get $1) - (i64.const -1) + (then + (i64.const 0) + ) + (else + (i64.div_s + (local.get $0) + (local.get $1) + ) ) - ) - (i64.const 0) - (i64.div_s - (local.get $0) - (local.get $1) ) ) ) @@ -403,10 +527,14 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (i64.rem_s - (local.get $0) - (local.get $1) + (then + (i64.const 0) + ) + (else + (i64.rem_s + (local.get $0) + (local.get $1) + ) ) ) ) @@ -415,10 +543,14 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (i64.div_u - (local.get $0) - (local.get $1) + (then + (i64.const 0) + ) + (else + (i64.div_u + (local.get $0) + (local.get $1) + ) ) ) ) @@ -427,10 +559,14 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (i64.rem_u - (local.get $0) - (local.get $1) + (then + (i64.const 0) + ) + (else + (i64.rem_u + (local.get $0) + (local.get $1) + ) ) ) ) diff --git a/test/passes/trap-mode-js.txt b/test/passes/trap-mode-js.txt index 39cb28de6..b43d7e950 100644 --- a/test/passes/trap-mode-js.txt +++ b/test/passes/trap-mode-js.txt @@ -114,21 +114,33 @@ (local.get $0) (local.get $0) ) - (i64.const -9223372036854775808) - (if (result i64) - (f32.ge - (local.get $0) - (f32.const 9223372036854775808) - ) + (then (i64.const -9223372036854775808) + ) + (else (if (result i64) - (f32.le + (f32.ge (local.get $0) - (f32.const -9223372036854775808) + (f32.const 9223372036854775808) ) - (i64.const -9223372036854775808) - (i64.trunc_f32_s - (local.get $0) + (then + (i64.const -9223372036854775808) + ) + (else + (if (result i64) + (f32.le + (local.get $0) + (f32.const -9223372036854775808) + ) + (then + (i64.const -9223372036854775808) + ) + (else + (i64.trunc_f32_s + (local.get $0) + ) + ) + ) ) ) ) @@ -140,21 +152,33 @@ (local.get $0) (local.get $0) ) - (i64.const 0) - (if (result i64) - (f32.ge - (local.get $0) - (f32.const 18446744073709551615) - ) + (then (i64.const 0) + ) + (else (if (result i64) - (f32.le + (f32.ge (local.get $0) - (f32.const -1) + (f32.const 18446744073709551615) ) - (i64.const 0) - (i64.trunc_f32_u - (local.get $0) + (then + (i64.const 0) + ) + (else + (if (result i64) + (f32.le + (local.get $0) + (f32.const -1) + ) + (then + (i64.const 0) + ) + (else + (i64.trunc_f32_u + (local.get $0) + ) + ) + ) ) ) ) @@ -166,21 +190,33 @@ (local.get $0) (local.get $0) ) - (i64.const -9223372036854775808) - (if (result i64) - (f64.ge - (local.get $0) - (f64.const 9223372036854775808) - ) + (then (i64.const -9223372036854775808) + ) + (else (if (result i64) - (f64.le + (f64.ge (local.get $0) - (f64.const -9223372036854775808) + (f64.const 9223372036854775808) ) - (i64.const -9223372036854775808) - (i64.trunc_f64_s - (local.get $0) + (then + (i64.const -9223372036854775808) + ) + (else + (if (result i64) + (f64.le + (local.get $0) + (f64.const -9223372036854775808) + ) + (then + (i64.const -9223372036854775808) + ) + (else + (i64.trunc_f64_s + (local.get $0) + ) + ) + ) ) ) ) @@ -192,21 +228,33 @@ (local.get $0) (local.get $0) ) - (i64.const 0) - (if (result i64) - (f64.ge - (local.get $0) - (f64.const 18446744073709551615) - ) + (then (i64.const 0) + ) + (else (if (result i64) - (f64.le + (f64.ge (local.get $0) - (f64.const -1) + (f64.const 18446744073709551615) ) - (i64.const 0) - (i64.trunc_f64_u - (local.get $0) + (then + (i64.const 0) + ) + (else + (if (result i64) + (f64.le + (local.get $0) + (f64.const -1) + ) + (then + (i64.const 0) + ) + (else + (i64.trunc_f64_u + (local.get $0) + ) + ) + ) ) ) ) @@ -217,22 +265,30 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (if (result i32) - (i32.and - (i32.eq - (local.get $0) - (i32.const -2147483648) + (then + (i32.const 0) + ) + (else + (if (result i32) + (i32.and + (i32.eq + (local.get $0) + (i32.const -2147483648) + ) + (i32.eq + (local.get $1) + (i32.const -1) + ) ) - (i32.eq - (local.get $1) - (i32.const -1) + (then + (i32.const 0) + ) + (else + (i32.div_s + (local.get $0) + (local.get $1) + ) ) - ) - (i32.const 0) - (i32.div_s - (local.get $0) - (local.get $1) ) ) ) @@ -242,10 +298,14 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (i32.rem_s - (local.get $0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (i32.rem_s + (local.get $0) + (local.get $1) + ) ) ) ) @@ -254,10 +314,14 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (i32.div_u - (local.get $0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (i32.div_u + (local.get $0) + (local.get $1) + ) ) ) ) @@ -266,10 +330,14 @@ (i32.eqz (local.get $1) ) - (i32.const 0) - (i32.rem_u - (local.get $0) - (local.get $1) + (then + (i32.const 0) + ) + (else + (i32.rem_u + (local.get $0) + (local.get $1) + ) ) ) ) @@ -278,22 +346,30 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (if (result i64) - (i32.and - (i64.eq - (local.get $0) - (i64.const -9223372036854775808) + (then + (i64.const 0) + ) + (else + (if (result i64) + (i32.and + (i64.eq + (local.get $0) + (i64.const -9223372036854775808) + ) + (i64.eq + (local.get $1) + (i64.const -1) + ) ) - (i64.eq - (local.get $1) - (i64.const -1) + (then + (i64.const 0) + ) + (else + (i64.div_s + (local.get $0) + (local.get $1) + ) ) - ) - (i64.const 0) - (i64.div_s - (local.get $0) - (local.get $1) ) ) ) @@ -303,10 +379,14 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (i64.rem_s - (local.get $0) - (local.get $1) + (then + (i64.const 0) + ) + (else + (i64.rem_s + (local.get $0) + (local.get $1) + ) ) ) ) @@ -315,10 +395,14 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (i64.div_u - (local.get $0) - (local.get $1) + (then + (i64.const 0) + ) + (else + (i64.div_u + (local.get $0) + (local.get $1) + ) ) ) ) @@ -327,10 +411,14 @@ (i64.eqz (local.get $1) ) - (i64.const 0) - (i64.rem_u - (local.get $0) - (local.get $1) + (then + (i64.const 0) + ) + (else + (i64.rem_u + (local.get $0) + (local.get $1) + ) ) ) ) |