summaryrefslogtreecommitdiff
path: root/test/lit/passes/optimize-instructions-gc.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/optimize-instructions-gc.wast')
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast30
1 files changed, 28 insertions, 2 deletions
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index 3ae0e1d91..c0474a823 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -849,7 +849,7 @@
)
)
)
- ;; CHECK: (func $ternary-identical-arms-but-side-effect (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32)
+ ;; CHECK: (func $select-identical-arms-but-side-effect (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (select
;; CHECK-NEXT: (struct.get_u $struct $i8
@@ -862,7 +862,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- (func $ternary-identical-arms-but-side-effect (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32)
+ (func $select-identical-arms-but-side-effect (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32)
(drop
(select
;; the arms are equal but have side effects
@@ -901,4 +901,30 @@
)
)
)
+ ;; CHECK: (func $if-identical-arms-with-side-effect (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (struct.get_u $struct $i8
+ ;; CHECK-NEXT: (if (result (ref null $struct))
+ ;; CHECK-NEXT: (local.get $z)
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: (local.get $y)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $if-identical-arms-with-side-effect (param $x (ref null $struct)) (param $y (ref null $struct)) (param $z i32)
+ (drop
+ (if (result i32)
+ (local.get $z)
+ ;; the arms are equal and have side effects, but that is ok with an if
+ ;; which only executes one side anyhow
+ (struct.get_u $struct 0
+ (local.get $x)
+ )
+ (struct.get_u $struct 0
+ (local.get $y)
+ )
+ )
+ )
+ )
)