diff options
-rw-r--r-- | src/asm2wasm.h | 3 | ||||
-rw-r--r-- | test/debugInfo.fromasm.imprecise.no-opts | 1 | ||||
-rw-r--r-- | test/debugInfo.fromasm.no-opts | 1 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 2 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 2 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise.no-opts | 21 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.no-opts | 21 | ||||
-rw-r--r-- | test/two_sides.fromasm.imprecise.no-opts | 3 | ||||
-rw-r--r-- | test/two_sides.fromasm.no-opts | 3 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise.no-opts | 6 | ||||
-rw-r--r-- | test/unit.fromasm.no-opts | 6 | ||||
-rw-r--r-- | test/unreachable-import_wasm-only.fromasm | 9 | ||||
-rw-r--r-- | test/unreachable-import_wasm-only.fromasm.imprecise | 9 | ||||
-rw-r--r-- | test/unreachable-import_wasm-only.fromasm.imprecise.no-opts | 1 | ||||
-rw-r--r-- | test/unreachable-import_wasm-only.fromasm.no-opts | 1 | ||||
-rw-r--r-- | test/wasm-only.fromasm | 1 | ||||
-rw-r--r-- | test/wasm-only.fromasm.imprecise | 1 | ||||
-rw-r--r-- | test/wasm-only.fromasm.imprecise.no-opts | 5 | ||||
-rw-r--r-- | test/wasm-only.fromasm.no-opts | 5 |
19 files changed, 96 insertions, 5 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index b952521ae..daf4d9af1 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -1248,9 +1248,6 @@ void Asm2WasmBuilder::processAsm(Ref ast) { passRunner.add<ApplyDebugInfo>(this); passRunner.add("vacuum"); // FIXME maybe just remove the nops that were debuginfo nodes, if not optimizing? } - // make sure to not emit unreachable code at all, even in -O0, as wasm rules for it are complex - // and changing. - passRunner.add("dce"); passRunner.run(); // remove the debug info intrinsic diff --git a/test/debugInfo.fromasm.imprecise.no-opts b/test/debugInfo.fromasm.imprecise.no-opts index ea20a12f2..26c4885c8 100644 --- a/test/debugInfo.fromasm.imprecise.no-opts +++ b/test/debugInfo.fromasm.imprecise.no-opts @@ -42,6 +42,7 @@ (i32.const 1) ) ) + (unreachable) ) (func $opts (param $x i32) (param $y i32) (result i32) ;; even-opted.cpp:1 diff --git a/test/debugInfo.fromasm.no-opts b/test/debugInfo.fromasm.no-opts index af52ca902..ca91651d5 100644 --- a/test/debugInfo.fromasm.no-opts +++ b/test/debugInfo.fromasm.no-opts @@ -42,6 +42,7 @@ (i32.const 1) ) ) + (unreachable) ) (func $i32s-rem (param $0 i32) (param $1 i32) (result i32) (if i32 diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index ecbadd304..050a16775 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -6639,6 +6639,7 @@ ) ) ) + (br $__rjto$8) ) (set_local $5 (call $_fmt_u @@ -6868,6 +6869,7 @@ (br $__rjti$7) ) ) + (br $__rjto$8) ) (call $_pad (get_local $0) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index 52fa498da..355f6e4e8 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -6576,6 +6576,7 @@ ) ) ) + (br $__rjto$8) ) (set_local $5 (call $_fmt_u @@ -6805,6 +6806,7 @@ (br $__rjti$7) ) ) + (br $__rjto$8) ) (call $_pad (get_local $0) diff --git a/test/emcc_hello_world.fromasm.imprecise.no-opts b/test/emcc_hello_world.fromasm.imprecise.no-opts index b4dcbcaa3..9488b62c2 100644 --- a/test/emcc_hello_world.fromasm.imprecise.no-opts +++ b/test/emcc_hello_world.fromasm.imprecise.no-opts @@ -5982,6 +5982,7 @@ (i32.const 9) ) (br $label$break$L9) + (br $switch) ) ) (block @@ -5992,6 +5993,7 @@ (get_local $$incdec$ptr169274) ) (br $label$break$L9) + (br $switch) ) ) (nop) @@ -7879,6 +7881,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -7904,6 +7907,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -7963,6 +7967,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -7994,6 +7999,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8025,6 +8031,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8050,6 +8057,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8109,6 +8117,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8127,6 +8136,7 @@ (br $label$continue$L1) ) ) + (br $switch17) ) ) (block @@ -13135,6 +13145,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch17) ) ) (block @@ -14755,6 +14766,7 @@ (get_local $$6) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -14871,6 +14883,7 @@ (get_local $$15) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -14972,6 +14985,7 @@ (i32.const 0) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15093,6 +15107,7 @@ (get_local $$42) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15224,6 +15239,7 @@ (get_local $$56) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15331,6 +15347,7 @@ (i32.const 0) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15462,6 +15479,7 @@ (get_local $$81) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15569,6 +15587,7 @@ (i32.const 0) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15651,6 +15670,7 @@ (get_local $$103) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15733,6 +15753,7 @@ (get_local $$110) ) (br $label$break$L1) + (br $switch) ) ) (br $label$break$L1) diff --git a/test/emcc_hello_world.fromasm.no-opts b/test/emcc_hello_world.fromasm.no-opts index 1b51d826c..e318c6251 100644 --- a/test/emcc_hello_world.fromasm.no-opts +++ b/test/emcc_hello_world.fromasm.no-opts @@ -6045,6 +6045,7 @@ (i32.const 9) ) (br $label$break$L9) + (br $switch) ) ) (block @@ -6055,6 +6056,7 @@ (get_local $$incdec$ptr169274) ) (br $label$break$L9) + (br $switch) ) ) (nop) @@ -7942,6 +7944,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -7967,6 +7970,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8026,6 +8030,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8057,6 +8062,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8088,6 +8094,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8113,6 +8120,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8172,6 +8180,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch18) ) ) (block @@ -8190,6 +8199,7 @@ (br $label$continue$L1) ) ) + (br $switch17) ) ) (block @@ -13198,6 +13208,7 @@ (get_local $$l10n$3) ) (br $label$continue$L1) + (br $switch17) ) ) (block @@ -14818,6 +14829,7 @@ (get_local $$6) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -14934,6 +14946,7 @@ (get_local $$15) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15035,6 +15048,7 @@ (i32.const 0) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15156,6 +15170,7 @@ (get_local $$42) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15287,6 +15302,7 @@ (get_local $$56) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15394,6 +15410,7 @@ (i32.const 0) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15525,6 +15542,7 @@ (get_local $$81) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15632,6 +15650,7 @@ (i32.const 0) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15714,6 +15733,7 @@ (get_local $$103) ) (br $label$break$L1) + (br $switch) ) ) (block @@ -15796,6 +15816,7 @@ (get_local $$110) ) (br $label$break$L1) + (br $switch) ) ) (br $label$break$L1) diff --git a/test/two_sides.fromasm.imprecise.no-opts b/test/two_sides.fromasm.imprecise.no-opts index 94bca7245..2abda5dca 100644 --- a/test/two_sides.fromasm.imprecise.no-opts +++ b/test/two_sides.fromasm.imprecise.no-opts @@ -79,5 +79,8 @@ ) ) ) + (return + (i32.const 0) + ) ) ) diff --git a/test/two_sides.fromasm.no-opts b/test/two_sides.fromasm.no-opts index 0976e4c90..f49fc79b3 100644 --- a/test/two_sides.fromasm.no-opts +++ b/test/two_sides.fromasm.no-opts @@ -81,5 +81,8 @@ ) ) ) + (return + (i32.const 0) + ) ) ) diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts index c872d9053..6a12e39c6 100644 --- a/test/unit.fromasm.imprecise.no-opts +++ b/test/unit.fromasm.imprecise.no-opts @@ -302,6 +302,7 @@ (loop $while-in (block $while-out (br $while-out) + (br $while-in) ) ) (br $label$break$Lout) @@ -311,8 +312,10 @@ (loop $while-in8 (block $while-out7 (br $label$break$Lout) + (br $while-in8) ) ) + (br $label$break$Lout) ) ) (loop $label$continue$L1 @@ -333,6 +336,7 @@ ) (block (br $label$break$L1) + (br $switch10) ) ) (block @@ -344,6 +348,7 @@ ) (block (br $label$break$L3) + (br $switch10) ) ) (br $label$break$L1) @@ -1732,6 +1737,7 @@ (i32.const 14) ) (br $while-out) + (br $while-in) ) ) (if diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index d912a09cb..f4c014288 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -306,6 +306,7 @@ (loop $while-in (block $while-out (br $while-out) + (br $while-in) ) ) (br $label$break$Lout) @@ -315,8 +316,10 @@ (loop $while-in8 (block $while-out7 (br $label$break$Lout) + (br $while-in8) ) ) + (br $label$break$Lout) ) ) (loop $label$continue$L1 @@ -337,6 +340,7 @@ ) (block (br $label$break$L1) + (br $switch10) ) ) (block @@ -348,6 +352,7 @@ ) (block (br $label$break$L3) + (br $switch10) ) ) (br $label$break$L1) @@ -1748,6 +1753,7 @@ (i32.const 14) ) (br $while-out) + (br $while-in) ) ) (if diff --git a/test/unreachable-import_wasm-only.fromasm b/test/unreachable-import_wasm-only.fromasm index 22e2e4826..9dfe199da 100644 --- a/test/unreachable-import_wasm-only.fromasm +++ b/test/unreachable-import_wasm-only.fromasm @@ -15,5 +15,14 @@ ) (return) ) + (i32.store + (unreachable) + (i32.const 1) + ) + (call $___cxa_throw + (unreachable) + (i32.const 1280) + (i32.const 0) + ) ) ) diff --git a/test/unreachable-import_wasm-only.fromasm.imprecise b/test/unreachable-import_wasm-only.fromasm.imprecise index 6c982299a..8c351d3ce 100644 --- a/test/unreachable-import_wasm-only.fromasm.imprecise +++ b/test/unreachable-import_wasm-only.fromasm.imprecise @@ -14,5 +14,14 @@ ) (return) ) + (i32.store + (unreachable) + (i32.const 1) + ) + (call $___cxa_throw + (unreachable) + (i32.const 1280) + (i32.const 0) + ) ) ) diff --git a/test/unreachable-import_wasm-only.fromasm.imprecise.no-opts b/test/unreachable-import_wasm-only.fromasm.imprecise.no-opts index 1af9c172b..ad60bb6fd 100644 --- a/test/unreachable-import_wasm-only.fromasm.imprecise.no-opts +++ b/test/unreachable-import_wasm-only.fromasm.imprecise.no-opts @@ -63,6 +63,7 @@ (i32.const 26) ) (return) + (br $switch) ) ) (block diff --git a/test/unreachable-import_wasm-only.fromasm.no-opts b/test/unreachable-import_wasm-only.fromasm.no-opts index 1af9c172b..ad60bb6fd 100644 --- a/test/unreachable-import_wasm-only.fromasm.no-opts +++ b/test/unreachable-import_wasm-only.fromasm.no-opts @@ -63,6 +63,7 @@ (i32.const 26) ) (return) + (br $switch) ) ) (block diff --git a/test/wasm-only.fromasm b/test/wasm-only.fromasm index dbb67e746..9bc738fd3 100644 --- a/test/wasm-only.fromasm +++ b/test/wasm-only.fromasm @@ -372,6 +372,7 @@ (i32.const -2) ) (return) + (br $__rjto$0) ) ) (i32.store diff --git a/test/wasm-only.fromasm.imprecise b/test/wasm-only.fromasm.imprecise index b7994d689..0edb3e6c1 100644 --- a/test/wasm-only.fromasm.imprecise +++ b/test/wasm-only.fromasm.imprecise @@ -287,6 +287,7 @@ (i32.const -2) ) (return) + (br $__rjto$0) ) ) (i32.store diff --git a/test/wasm-only.fromasm.imprecise.no-opts b/test/wasm-only.fromasm.imprecise.no-opts index 4e05d6bd3..4db467f47 100644 --- a/test/wasm-only.fromasm.imprecise.no-opts +++ b/test/wasm-only.fromasm.imprecise.no-opts @@ -732,7 +732,10 @@ (block (if (get_local $$2) - (br $label$break$L1) + (block + (br $label$break$L1) + (return) + ) ) (i32.store (get_local $$0) diff --git a/test/wasm-only.fromasm.no-opts b/test/wasm-only.fromasm.no-opts index ae1fa211b..725dec352 100644 --- a/test/wasm-only.fromasm.no-opts +++ b/test/wasm-only.fromasm.no-opts @@ -793,7 +793,10 @@ (block (if (get_local $$2) - (br $label$break$L1) + (block + (br $label$break$L1) + (return) + ) ) (i32.store (get_local $$0) |