Skip to content

Commit a173e67

Browse files
committed
test
1 parent 83d0503 commit a173e67

File tree

1 file changed

+64
-11
lines changed

1 file changed

+64
-11
lines changed

test/lit/passes/global-effects.wast

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@
33
;; Run without global effects, and run with, and also run with but discard them
44
;; first (to check that discard works; that should be the same as without).
55

6-
;; RUN: foreach %s %t wasm-opt --vacuum -S -o - | filecheck %s --check-prefix WITHOUT
7-
;; RUN: foreach %s %t wasm-opt --generate-global-effects --vacuum -S -o - | filecheck %s --check-prefix INCLUDE
8-
;; RUN: foreach %s %t wasm-opt --generate-global-effects --discard-global-effects --vacuum -S -o - | filecheck %s --check-prefix DISCARD
6+
;; RUN: foreach %s %t wasm-opt -all --vacuum -S -o - | filecheck %s --check-prefix WITHOUT
7+
;; RUN: foreach %s %t wasm-opt -all --generate-global-effects --vacuum -S -o - | filecheck %s --check-prefix INCLUDE
8+
;; RUN: foreach %s %t wasm-opt -all --generate-global-effects --discard-global-effects --vacuum -S -o - | filecheck %s --check-prefix DISCARD
99

1010
(module
1111
;; WITHOUT: (type $none_=>_none (func))
1212

1313
;; WITHOUT: (type $none_=>_i32 (func (result i32)))
1414

15+
;; WITHOUT: (tag $tag (param))
16+
;; INCLUDE: (type $none_=>_none (func))
17+
18+
;; INCLUDE: (type $none_=>_i32 (func (result i32)))
19+
20+
;; INCLUDE: (tag $tag (param))
21+
;; DISCARD: (type $none_=>_none (func))
22+
23+
;; DISCARD: (type $none_=>_i32 (func (result i32)))
24+
25+
;; DISCARD: (tag $tag (param))
26+
(tag $tag)
27+
1528
;; WITHOUT: (func $foo
1629
;; WITHOUT-NEXT: (call $nop)
1730
;; WITHOUT-NEXT: (call $unreachable)
@@ -21,19 +34,11 @@
2134
;; WITHOUT-NEXT: (call $unimportant-effects)
2235
;; WITHOUT-NEXT: )
2336
;; WITHOUT-NEXT: )
24-
;; INCLUDE: (type $none_=>_none (func))
25-
26-
;; INCLUDE: (type $none_=>_i32 (func (result i32)))
27-
2837
;; INCLUDE: (func $foo
2938
;; INCLUDE-NEXT: (call $unreachable)
3039
;; INCLUDE-NEXT: (call $call-nop)
3140
;; INCLUDE-NEXT: (call $call-unreachable)
3241
;; INCLUDE-NEXT: )
33-
;; DISCARD: (type $none_=>_none (func))
34-
35-
;; DISCARD: (type $none_=>_i32 (func (result i32)))
36-
3742
;; DISCARD: (func $foo
3843
;; DISCARD-NEXT: (call $nop)
3944
;; DISCARD-NEXT: (call $unreachable)
@@ -169,4 +174,52 @@
169174
(local.get $x)
170175
)
171176
)
177+
178+
;; WITHOUT: (func $call-throws-and-catch
179+
;; WITHOUT-NEXT: (try $try
180+
;; WITHOUT-NEXT: (do
181+
;; WITHOUT-NEXT: (call $throw)
182+
;; WITHOUT-NEXT: )
183+
;; WITHOUT-NEXT: (catch_all
184+
;; WITHOUT-NEXT: (nop)
185+
;; WITHOUT-NEXT: )
186+
;; WITHOUT-NEXT: )
187+
;; WITHOUT-NEXT: )
188+
;; INCLUDE: (func $call-throws-and-catch
189+
;; INCLUDE-NEXT: (nop)
190+
;; INCLUDE-NEXT: )
191+
;; DISCARD: (func $call-throws-and-catch
192+
;; DISCARD-NEXT: (try $try
193+
;; DISCARD-NEXT: (do
194+
;; DISCARD-NEXT: (call $throw)
195+
;; DISCARD-NEXT: )
196+
;; DISCARD-NEXT: (catch_all
197+
;; DISCARD-NEXT: (nop)
198+
;; DISCARD-NEXT: )
199+
;; DISCARD-NEXT: )
200+
;; DISCARD-NEXT: )
201+
(func $call-throws-and-catch
202+
(try
203+
(do
204+
;; This call cannot be optimized out, as the target throws. However, the
205+
;; entire try-catch can be, since the call's only effect is to throw,
206+
;; and the catch_all catches that.
207+
(call $throw)
208+
)
209+
(catch_all)
210+
)
211+
)
212+
213+
;; WITHOUT: (func $throw
214+
;; WITHOUT-NEXT: (throw $tag)
215+
;; WITHOUT-NEXT: )
216+
;; INCLUDE: (func $throw
217+
;; INCLUDE-NEXT: (throw $tag)
218+
;; INCLUDE-NEXT: )
219+
;; DISCARD: (func $throw
220+
;; DISCARD-NEXT: (throw $tag)
221+
;; DISCARD-NEXT: )
222+
(func $throw
223+
(throw $tag)
224+
)
172225
)

0 commit comments

Comments
 (0)