summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index 64213d930..2c6498ec3 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -979,6 +979,16 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (i32.const 1)
;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (block (result i32)
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (local.tee $x
+ ;; CHECK-NEXT: (local.get $x)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $ref-eq-corner-cases (type $eqref_=>_none) (param $x eqref)
;; NOMNL-NEXT: (drop
@@ -1006,6 +1016,16 @@
;; NOMNL-NEXT: (drop
;; NOMNL-NEXT: (i32.const 1)
;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (drop
+ ;; NOMNL-NEXT: (block (result i32)
+ ;; NOMNL-NEXT: (drop
+ ;; NOMNL-NEXT: (local.tee $x
+ ;; NOMNL-NEXT: (local.get $x)
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: (i32.const 1)
+ ;; NOMNL-NEXT: )
+ ;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
(func $ref-eq-corner-cases (param $x eqref)
;; side effects prevent optimization
@@ -1058,6 +1078,15 @@
)
)
)
+ ;; a tee does not prevent optimization, as we can fold the tee and the get.
+ (drop
+ (ref.eq
+ (local.tee $x
+ (local.get $x)
+ )
+ (local.get $x)
+ )
+ )
)
;; CHECK: (func $ref-eq-ref-cast (param $x eqref)