diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-07-17 10:23:06 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2017-07-17 10:23:06 -0700 |
commit | a2e170294c03d5fe0d91e2797d96acdb95b1d37c (patch) | |
tree | c225944366315da75b4864ec7ab1ac218cb8a760 /test | |
parent | 7bc2ed70de137aa6615fcd5d0e1f3e88f008a738 (diff) | |
download | binaryen-a2e170294c03d5fe0d91e2797d96acdb95b1d37c.tar.gz binaryen-a2e170294c03d5fe0d91e2797d96acdb95b1d37c.tar.bz2 binaryen-a2e170294c03d5fe0d91e2797d96acdb95b1d37c.zip |
fix blockifyMerge logic - it needs to not skip code in the block we merge to. since that's a fairly specific functionality needed in removeUnusedBrs, move it to there
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/remove-unused-brs.txt | 40 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.wast | 18 | ||||
-rw-r--r-- | test/passes/remove-unused-names_remove-unused-brs_vacuum.txt | 18 | ||||
-rw-r--r-- | test/passes/remove-unused-names_remove-unused-brs_vacuum.wast | 18 |
4 files changed, 86 insertions, 8 deletions
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index 07b4575ce..417bd3728 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -5,6 +5,7 @@ (type $3 (func (param i32 i32) (result i32))) (type $4 (func (param i32 i32))) (type $5 (func (param f32 i32 f32 i32 i32 f64 f32) (result i32))) + (type $6 (func (param i32) (result i64))) (memory $0 256 256) (func $b0-yes (type $0) (param $i1 i32) (block $topmost @@ -539,11 +540,13 @@ (block $out59 (if (i32.const 0) - (block $block61 - (drop - (i32.const 1) + (block + (block $block61 + (drop + (i32.const 1) + ) + (call $loops) ) - (call $loops) (br $in58) ) (nop) @@ -584,11 +587,13 @@ (block $out69 (if (i32.const 0) - (block $block71 - (drop - (i32.const 1) + (block + (block $block71 + (drop + (i32.const 1) + ) + (call $loops) ) - (call $loops) (drop (i32.const 102) ) @@ -1011,4 +1016,23 @@ (i32.const 1935947830) ) ) + (func $unexitable-loops-result (type $6) (param $0 i32) (result i64) + (loop $label$0 + (loop $label$1 + (br_if $label$0 + (i32.load8_s + (i32.const 201460482) + ) + ) + (block + (block $label$3 + (br_if $label$1 + (get_local $0) + ) + ) + (br $label$1) + ) + ) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index 04ebdac33..d694bd4d0 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -901,5 +901,23 @@ (i32.const 1935947830) ) ) + (func $unexitable-loops-result (param $0 i32) (result i64) + (loop $label$0 + (loop $label$1 + (if + (i32.load8_s + (i32.const 201460482) + ) + (br $label$0) + (block $label$3 + (br_if $label$3 + (get_local $0) + ) + ) + ) + (br $label$1) + ) + ) + ) ) 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 d8ce15491..4eeb1ee97 100644 --- a/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt +++ b/test/passes/remove-unused-names_remove-unused-brs_vacuum.txt @@ -22,6 +22,7 @@ (type $FUNCSIG$vii (func (param i32 i32))) (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$id (func (param f64) (result i32))) + (type $23 (func (param i32) (result i64))) (import "env" "DYNAMICTOP_PTR" (global $import$0 i32)) (import "env" "tempDoublePtr" (global $import$1 i32)) (import "env" "ABORT" (global $import$2 i32)) @@ -113,4 +114,21 @@ (func $23 (type $0) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (unreachable) ) + (func $unexitable-loops-result (type $23) (param $0 i32) (result i64) + (loop $label$0 + (loop $label$1 + (br_if $label$0 + (i32.load8_s + (i32.const 201460482) + ) + ) + (block + (br_if $label$1 + (get_local $0) + ) + (br $label$1) + ) + ) + ) + ) ) 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 5a0ec5114..12f664a36 100644 --- a/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast +++ b/test/passes/remove-unused-names_remove-unused-brs_vacuum.wast @@ -127,5 +127,23 @@ (func $23 (param i32) (param i32) (param i32) (result i32) (unreachable) ) + (func $unexitable-loops-result (param $0 i32) (result i64) + (loop $label$0 + (loop $label$1 + (if + (i32.load8_s + (i32.const 201460482) + ) + (br $label$0) + (block $label$3 + (br_if $label$3 + (get_local $0) + ) + ) + ) + (br $label$1) + ) + ) + ) ) |