Skip to content

Commit 514ede8

Browse files
committed
test
1 parent 055aa28 commit 514ede8

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

test/lit/passes/gufa-eh-null-type.wast

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,60 @@
33
;; RUN: foreach %s %t wasm-opt -all --gufa -S -o - | filecheck %s
44

55
;; The function here will use a NullLocation for (ref exn) as well as a
6-
;; TypeLocation for that very same type. We should not get confused and end up
7-
;; optimizing anything here.
6+
;; TypeLocation for that very same type. We should not get confused by that (see
7+
;; below).
88

99
(module
10+
;; CHECK: (type $func (func))
1011
(type $func (func))
1112

13+
;; CHECK: (tag $tag (type $func))
1214
(tag $tag (type $func))
1315

16+
;; CHECK: (export "func" (func $func))
17+
18+
;; CHECK: (func $func (type $func)
19+
;; CHECK-NEXT: (local $1 (ref exn))
20+
;; CHECK-NEXT: (drop
21+
;; CHECK-NEXT: (block $block (result (ref exn))
22+
;; CHECK-NEXT: (try_table (catch_all_ref $block)
23+
;; CHECK-NEXT: (throw $tag)
24+
;; CHECK-NEXT: )
25+
;; CHECK-NEXT: (return)
26+
;; CHECK-NEXT: )
27+
;; CHECK-NEXT: )
28+
;; CHECK-NEXT: (try
29+
;; CHECK-NEXT: (do
30+
;; CHECK-NEXT: (nop)
31+
;; CHECK-NEXT: )
32+
;; CHECK-NEXT: (catch $tag
33+
;; CHECK-NEXT: (drop
34+
;; CHECK-NEXT: (block
35+
;; CHECK-NEXT: (drop
36+
;; CHECK-NEXT: (block $block0 (result (ref noexn))
37+
;; CHECK-NEXT: (local.tee $1
38+
;; CHECK-NEXT: (unreachable)
39+
;; CHECK-NEXT: )
40+
;; CHECK-NEXT: (br_on_non_null $block0
41+
;; CHECK-NEXT: (ref.null noexn)
42+
;; CHECK-NEXT: )
43+
;; CHECK-NEXT: (drop
44+
;; CHECK-NEXT: (unreachable)
45+
;; CHECK-NEXT: )
46+
;; CHECK-NEXT: (unreachable)
47+
;; CHECK-NEXT: )
48+
;; CHECK-NEXT: )
49+
;; CHECK-NEXT: (unreachable)
50+
;; CHECK-NEXT: )
51+
;; CHECK-NEXT: )
52+
;; CHECK-NEXT: )
53+
;; CHECK-NEXT: )
54+
;; CHECK-NEXT: )
1455
(func $func (export "func")
1556
(local $1 (ref exn))
1657
;; This part ends up generating a TypeLocation for (ref exn).
58+
;;
59+
;; This code should not be mis-optimized. In particular, it should not trap.
1760
(drop
1861
(block $block (result (ref exn))
1962
(try_table (catch_all_ref $block)
@@ -30,6 +73,9 @@
3073
(drop
3174
(block $block (result (ref exn))
3275
;; This part ends up generating a NullLocation for (ref exn).
76+
;;
77+
;; Due to the unreachable here, we will end up modifying this code to add
78+
;; more unreachables.
3379
(br_on_non_null $block
3480
(local.tee $1
3581
(unreachable)

0 commit comments

Comments
 (0)