diff options
Diffstat (limited to 'test/passes')
-rw-r--r-- | test/passes/remove-unused-brs.txt | 83 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.wast | 60 |
2 files changed, 143 insertions, 0 deletions
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index 9eb413294..94b214588 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -3,6 +3,7 @@ (type $0 (func (param i32))) (type $1 (func)) (type $2 (func (result i32))) + (type $3 (func (param i32 i32) (result i32))) (func $b0-yes (type $0) (param $i1 i32) (block $topmost ) @@ -760,4 +761,86 @@ ) ) ) + (func $if-to-br_if-conflict (type $3) (param $x i32) (param $y i32) (result i32) + (block $leave + (set_local $y + (block $out + (if + (get_local $x) + (br $out + (block $block1 + (set_local $x + (i32.const 0) + ) + (i32.const 1) + ) + ) + (br_if $leave + (i32.const 1) + ) + ) + (unreachable) + ) + ) + ) + (i32.add + (get_local $x) + (get_local $y) + ) + ) + (func $if-to-br_if-conflict2 (type $3) (param $x i32) (param $y i32) (result i32) + (block $leave + (set_local $y + (block $out + (if + (get_local $x) + (br_if $leave + (i32.const 1) + ) + (br $out + (block $block2 + (set_local $x + (i32.const 0) + ) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + ) + ) + (i32.add + (get_local $x) + (get_local $y) + ) + ) + (func $if-to-br_if-value-sideeffect (type $3) (param $x i32) (param $y i32) (result i32) + (block $leave + (set_local $y + (block $out + (if + (get_local $x) + (br $out + (block $block1 + (drop + (call $if-to-br_if-value-sideeffect + (i32.const 0) + (i32.const 1) + ) + ) + (nop) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + ) + ) + (i32.add + (get_local $x) + (get_local $y) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index e777efa5b..ecbcb6caa 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -700,4 +700,64 @@ (br $stack1) ) ) + (func $if-to-br_if-conflict (param $x i32) (param $y i32) (result i32) + (block $leave + (set_local $y + (block $out + (if + (get_local $x) + (br $out + (block + (set_local $x (i32.const 0)) + (i32.const 1) + ) + ) + (br_if $leave (i32.const 1)) + ) + (unreachable) + ) + ) + ) + (i32.add (get_local $x) (get_local $y)) + ) + (func $if-to-br_if-conflict2 (param $x i32) (param $y i32) (result i32) + (block $leave + (set_local $y + (block $out + (if + (get_local $x) + (br_if $leave (i32.const 1)) + (br $out + (block + (set_local $x (i32.const 0)) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + ) + ) + (i32.add (get_local $x) (get_local $y)) + ) + (func $if-to-br_if-value-sideeffect (param $x i32) (param $y i32) (result i32) + (block $leave + (set_local $y + (block $out + (if + (get_local $x) + (br $out + (block + (drop (call $if-to-br_if-value-sideeffect (i32.const 0) (i32.const 1))) + (nop) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + ) + ) + (i32.add (get_local $x) (get_local $y)) + ) ) |