diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-05-02 14:02:16 -0700 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-05-02 14:02:16 -0700 |
commit | d0df9588b9adb5c9000d008c8cb739dd3289e68d (patch) | |
tree | b3cac316801008dfb9ca592f29a1c6661381ba95 /test | |
parent | e10a6e22921889970ceb6e1fb76e786bc66d79d7 (diff) | |
download | binaryen-d0df9588b9adb5c9000d008c8cb739dd3289e68d.tar.gz binaryen-d0df9588b9adb5c9000d008c8cb739dd3289e68d.tar.bz2 binaryen-d0df9588b9adb5c9000d008c8cb739dd3289e68d.zip |
when creating blocks during dce, make sure they have the same type as before the transformation, as the outside might care about that
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/dce.txt | 40 | ||||
-rw-r--r-- | test/passes/dce.wast | 29 |
2 files changed, 65 insertions, 4 deletions
diff --git a/test/passes/dce.txt b/test/passes/dce.txt index 22189fb66..6aaad92b5 100644 --- a/test/passes/dce.txt +++ b/test/passes/dce.txt @@ -3,6 +3,7 @@ (type $1 (func)) (type $2 (func (result i32))) (type $3 (func (param i32) (result i32))) + (type $4 (func (param i64 i64) (result i64))) (global $x (mut i32) (i32.const 0)) (table 1 1 anyfunc) (elem (i32.const 0) $call-me) @@ -234,7 +235,7 @@ (if (i32.const 88) (drop - (block + (block i32 (drop (i32.const 0) ) @@ -249,7 +250,7 @@ (if (i32.const 100) (drop - (block + (block i32 (drop (i32.const 123) ) @@ -263,7 +264,7 @@ (if (i32.const 101) (drop - (block + (block i32 (drop (i32.const 123) ) @@ -366,7 +367,7 @@ (br $label$0 (block $label$1 i32 (drop - (block + (block i32 (drop (i32.const 4104) ) @@ -379,4 +380,35 @@ ) ) ) + (func $call-unreach (type $4) (param $var$0 i64) (param $var$1 i64) (result i64) + (local $2 i64) + (if i64 + (i64.eqz + (get_local $var$0) + ) + (block $label$0 i64 + (get_local $var$1) + ) + (block $label$1 i64 + (call $call-unreach + (i64.sub + (get_local $var$0) + (i64.const 1) + ) + (block i64 + (drop + (block $block i64 + (set_local $2 + (get_local $var$0) + ) + (nop) + (get_local $2) + ) + ) + (unreachable) + ) + ) + ) + ) + ) ) diff --git a/test/passes/dce.wast b/test/passes/dce.wast index 865f373cf..87a5757cd 100644 --- a/test/passes/dce.wast +++ b/test/passes/dce.wast @@ -509,4 +509,33 @@ ) ) ) + (func $call-unreach (param $var$0 i64) (param $var$1 i64) (result i64) + (local $2 i64) + (if i64 + (i64.eqz + (get_local $var$0) + ) + (block $label$0 i64 + (get_local $var$1) + ) + (block $label$1 i64 + (call $call-unreach + (i64.sub + (get_local $var$0) + (i64.const 1) + ) + (i64.mul + (block i64 + (set_local $2 + (get_local $var$0) + ) + (nop) + (get_local $2) + ) + (unreachable) + ) + ) + ) + ) + ) ) |