diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/remove-unused-brs.txt | 43 | ||||
-rw-r--r-- | test/passes/remove-unused-brs.wast | 28 |
2 files changed, 63 insertions, 8 deletions
diff --git a/test/passes/remove-unused-brs.txt b/test/passes/remove-unused-brs.txt index 48cfad529..889e358c7 100644 --- a/test/passes/remove-unused-brs.txt +++ b/test/passes/remove-unused-brs.txt @@ -2212,21 +2212,20 @@ (func $refinalize-need-br-value (; 101 ;) (type $2) (result i32) (loop $label$3 (result i32) (block $label$6 (result i32) - (block $label$10 (result i32) + (block $label$10 (unreachable) - (block $label$503 (result i32) + (block $label$503 (br_if $label$3 (block $label$530 (result i32) - (block - (unreachable) - (drop - (i32.const 0) - ) + (br_if $label$503 + (i32.const 0) ) (i32.const 0) ) ) - (i32.const 127) + (return + (i32.const 127) + ) ) ) ) @@ -2404,4 +2403,32 @@ (i32.const 1) ) ) + (func $do-not-flow-values-through-unreachable-code (; 113 ;) (type $2) (result i32) + (block $block + (unreachable) + (if + (i32.const 0) + (block $A + (return + (i32.const 0) + ) + ) + (nop) + ) + ) + ) + (func $do-not-flow-values-through-unreachable-code-b (; 114 ;) (type $2) (result i32) + (loop $loop-in + (unreachable) + (if + (i32.const 0) + (block $A + (return + (i32.const 0) + ) + ) + (nop) + ) + ) + ) ) diff --git a/test/passes/remove-unused-brs.wast b/test/passes/remove-unused-brs.wast index 9d53f4fda..71f39e331 100644 --- a/test/passes/remove-unused-brs.wast +++ b/test/passes/remove-unused-brs.wast @@ -2011,5 +2011,33 @@ ) ) ) + (func $do-not-flow-values-through-unreachable-code (result i32) + (block + (unreachable) + (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 + ) + (br $A) ;; can be a nop + ) + ) + ) + ) + (func $do-not-flow-values-through-unreachable-code-b (result i32) + (loop + (unreachable) + (block $A + (if + (i32.const 0) + (return + (i32.const 0) + ) + (br $A) + ) + ) + ) + ) ) |