diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-05-17 11:29:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 11:29:11 -0700 |
commit | bb1c44a3f975bf8fb72216b9c04bcd34e31bd815 (patch) | |
tree | 90c6dc049931981ef28bc4728113528b1627595b /test/passes/optimize-instructions.wast | |
parent | 443cfe929d094e34d8d84270965c738743d06585 (diff) | |
download | binaryen-bb1c44a3f975bf8fb72216b9c04bcd34e31bd815.tar.gz binaryen-bb1c44a3f975bf8fb72216b9c04bcd34e31bd815.tar.bz2 binaryen-bb1c44a3f975bf8fb72216b9c04bcd34e31bd815.zip |
optimize if and select in the case their values are identical (#1013)
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index eccbf1268..56defd648 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -319,7 +319,7 @@ (if i32 (i32.const 1) (i32.ne (call $ne0) (i32.const 0)) - (i32.ne (call $ne0) (i32.const 0)) + (i32.ne (call $ne1) (i32.const 0)) ) (nop) ) @@ -331,6 +331,9 @@ (nop) ) ) + (func $ne1 (result i32) + (unreachable) + ) (func $load-off-2 "load-off-2" (param $0 i32) (result i32) (i32.store offset=2 (i32.add @@ -2303,4 +2306,57 @@ ) ) ) + (func $if-parallel (param $0 i32) (param $1 i32) + (drop + (if i32 + (get_local $0) + (i32.add (get_local $1) (i32.const 1)) + (i32.add (get_local $1) (i32.const 1)) + ) + ) + (drop + (if i32 + (tee_local $0 (get_local $1)) ;; side effects! + (i32.add (get_local $1) (i32.const 1)) + (i32.add (get_local $1) (i32.const 1)) + ) + ) + ) + (func $select-parallel (param $0 i32) (param $1 i32) + (drop + (select + (i32.add (get_local $1) (i32.const 1)) + (i32.add (get_local $1) (i32.const 1)) + (get_local $0) + ) + ) + (drop + (select + (tee_local $0 (get_local $1)) ;; side effects! + (tee_local $0 (get_local $1)) ;; side effects! + (get_local $0) + ) + ) + (drop + (select + (i32.add (get_local $1) (i32.const 1)) + (i32.add (get_local $1) (i32.const 1)) + (tee_local $0 (get_local $1)) ;; side effects! (but no interference with values) + ) + ) + (drop + (select + (tee_local $0 (get_local $1)) ;; side effects! interference! + (tee_local $0 (get_local $1)) ;; side effects! interference! + (tee_local $0 (get_local $1)) ;; side effects! interference! + ) + ) + (drop + (select + (tee_local $0 (get_local $1)) ;; side effects! + (tee_local $0 (get_local $1)) ;; side effects! + (unreachable) ;; side effects! (but no interference with values) + ) + ) + ) ) |