summaryrefslogtreecommitdiff
path: root/test/lit
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit')
-rw-r--r--test/lit/passes/coalesce-locals-eh-old.wast40
-rw-r--r--test/lit/passes/coalesce-locals-gc.wast21
2 files changed, 46 insertions, 15 deletions
diff --git a/test/lit/passes/coalesce-locals-eh-old.wast b/test/lit/passes/coalesce-locals-eh-old.wast
index 379f3dc31..3acbda064 100644
--- a/test/lit/passes/coalesce-locals-eh-old.wast
+++ b/test/lit/passes/coalesce-locals-eh-old.wast
@@ -4,7 +4,9 @@
(module
;; CHECK: (tag $e)
- ;; CHECK: (func $bar (type $1) (result i32)
+ ;; CHECK: (tag $any (param (ref any)))
+
+ ;; CHECK: (func $bar (type $2) (result i32)
;; CHECK-NEXT: (i32.const 1984)
;; CHECK-NEXT: )
(func $bar (result i32)
@@ -12,7 +14,10 @@
)
(tag $e)
- ;; CHECK: (func $bug-cfg-traversal (type $2) (param $0 i32) (result i32)
+
+ (tag $any (param (ref any)))
+
+ ;; CHECK: (func $bug-cfg-traversal (type $3) (param $0 i32) (result i32)
;; CHECK-NEXT: (try $try
;; CHECK-NEXT: (do
;; CHECK-NEXT: (local.set $0
@@ -42,4 +47,35 @@
)
(local.get $x)
)
+
+ ;; CHECK: (func $0 (type $0)
+ ;; CHECK-NEXT: (local $0 anyref)
+ ;; CHECK-NEXT: (try $try
+ ;; CHECK-NEXT: (do
+ ;; CHECK-NEXT: (nop)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (catch $any
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (pop (ref any))
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $0
+ (local $0 (ref null any))
+ (try
+ (do)
+ (catch $any
+ (drop
+ ;; There is a difference between the type of the value here and the
+ ;; type of the local, due to the local being nullable. We should not
+ ;; error on that as we replace the tee with a drop (as it has no
+ ;; gets).
+ (local.tee $0
+ (pop (ref any))
+ )
+ )
+ )
+ )
+ )
)
diff --git a/test/lit/passes/coalesce-locals-gc.wast b/test/lit/passes/coalesce-locals-gc.wast
index b485f90d0..0fc83d74e 100644
--- a/test/lit/passes/coalesce-locals-gc.wast
+++ b/test/lit/passes/coalesce-locals-gc.wast
@@ -181,19 +181,16 @@
)
;; CHECK: (func $remove-tee-refinalize (type $5) (param $0 (ref null $A)) (param $1 (ref null $B)) (result structref)
- ;; CHECK-NEXT: (struct.get $A 0
- ;; CHECK-NEXT: (block (result (ref null $A))
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.get $B 0
+ ;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $remove-tee-refinalize
(param $a (ref null $A))
(param $b (ref null $B))
(result (ref null struct))
- ;; The local.tee receives a $B and flows out an $A. We want to avoid changing
- ;; types here, so we'll wrap it in a block, and leave further improvements
- ;; for other passes.
+ ;; The local.tee receives a $B and flows out an $A. We will ReFinalize here as
+ ;; we remove the tee, making the struct.get operate on $B.
(struct.get $A 0
(local.tee $a
(local.get $b)
@@ -202,10 +199,8 @@
)
;; CHECK: (func $remove-tee-refinalize-2 (type $5) (param $0 (ref null $A)) (param $1 (ref null $B)) (result structref)
- ;; CHECK-NEXT: (struct.get $A 0
- ;; CHECK-NEXT: (block (result (ref null $A))
- ;; CHECK-NEXT: (local.get $1)
- ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (struct.get $B 0
+ ;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $remove-tee-refinalize-2
@@ -311,9 +306,9 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (global.set $nn-tuple-global
- ;; CHECK-NEXT: (block (type $1) (result (ref any) i32)
+ ;; CHECK-NEXT: (block (type $0) (result (ref any) i32)
;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (if (type $1) (result (ref any) i32)
+ ;; CHECK-NEXT: (if (type $0) (result (ref any) i32)
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: (then
;; CHECK-NEXT: (tuple.make 2