diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-09-05 11:33:22 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2017-09-06 09:36:24 -0700 |
commit | 68b57f6c015af1eaf95b039b0bc2bc3b9efbab4e (patch) | |
tree | eedfada9fbc282d91bc46a5f9dd6ffc7ee1ac4c5 /test/passes/optimize-instructions.wast | |
parent | 3d1c3a3a342d4d22dcda4e45e4f4aae93b464ec8 (diff) | |
download | binaryen-68b57f6c015af1eaf95b039b0bc2bc3b9efbab4e.tar.gz binaryen-68b57f6c015af1eaf95b039b0bc2bc3b9efbab4e.tar.bz2 binaryen-68b57f6c015af1eaf95b039b0bc2bc3b9efbab4e.zip |
when if arms are identical, merging them may change the type of the if, if it has a forced type
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index c26aad196..f84be8330 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2321,6 +2321,27 @@ (i32.add (get_local $1) (i32.const 1)) ) ) + (drop + (if (result i32) + (get_local $0) + (i32.add (get_local $1) (unreachable)) ;; folding them would change the type of the if + (i32.add (get_local $1) (unreachable)) + ) + ) + (drop + (if (result i32) + (tee_local $0 (get_local $1)) ;; side effects! + (i32.add (get_local $1) (unreachable)) ;; folding them would change the type of the if + (i32.add (get_local $1) (unreachable)) + ) + ) + (drop + (if (result i32) + (unreachable) ;; !!! + (i32.add (get_local $1) (unreachable)) ;; folding them would change the type of the if + (i32.add (get_local $1) (unreachable)) + ) + ) ) (func $select-parallel (param $0 i32) (param $1 i32) (drop |