summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r--test/passes/optimize-instructions.wast58
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)
+ )
+ )
+ )
)