Skip to content

Commit de817ec

Browse files
committed
test
1 parent 40f26ee commit de817ec

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

test/lit/passes/global-effects.wast

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,53 @@
219219
)
220220
)
221221

222+
;; WITHOUT: (func $return-call-throw-and-catch (type $0)
223+
;; WITHOUT-NEXT: (return_call $throw)
224+
;; WITHOUT-NEXT: )
225+
;; INCLUDE: (func $return-call-throw-and-catch (type $0)
226+
;; INCLUDE-NEXT: (return_call $throw)
227+
;; INCLUDE-NEXT: )
228+
(func $return-call-throw-and-catch
229+
(try
230+
(do
231+
;; This call cannot be optimized out, as the target throws. However, the
232+
;; surrounding try-catch can be removed even without global effects
233+
;; because the throw from the return_call is never observed by this
234+
;; try-catch.
235+
(return_call $throw)
236+
)
237+
(catch_all)
238+
)
239+
)
240+
241+
;; WITHOUT: (func $call-return-call-throw-and-catch (type $0)
242+
;; WITHOUT-NEXT: (try $try
243+
;; WITHOUT-NEXT: (do
244+
;; WITHOUT-NEXT: (call $return-call-throw-and-catch)
245+
;; WITHOUT-NEXT: )
246+
;; WITHOUT-NEXT: (catch_all
247+
;; WITHOUT-NEXT: (nop)
248+
;; WITHOUT-NEXT: )
249+
;; WITHOUT-NEXT: )
250+
;; WITHOUT-NEXT: (call $return-call-throw-and-catch)
251+
;; WITHOUT-NEXT: )
252+
;; INCLUDE: (func $call-return-call-throw-and-catch (type $0)
253+
;; INCLUDE-NEXT: (call $return-call-throw-and-catch)
254+
;; INCLUDE-NEXT: )
255+
(func $call-return-call-throw-and-catch
256+
(try
257+
(do
258+
;; Even though the body of the previous function is a try-catch_all, the
259+
;; function still throws because of its return_call, so this cannot be
260+
;; optimized out, but once again the entire try-catch can be.
261+
(call $return-call-throw-and-catch)
262+
)
263+
(catch_all)
264+
)
265+
;; This cannot be optimized out at all.
266+
(call $return-call-throw-and-catch)
267+
)
268+
222269
;; WITHOUT: (func $call-unreachable-and-catch (type $0)
223270
;; WITHOUT-NEXT: (try $try
224271
;; WITHOUT-NEXT: (do

0 commit comments

Comments
 (0)