blob: b471afe2fb5eb9e02e636d8d7be64e24ead66e38 [file] [log] [blame]
Chris Lattner0f12ef62003-08-24 06:55:07 +00001; Test that any rethrown exceptions in an inlined function are automatically
2; turned into branches to the invoke destination.
3
Reid Spencerd0e30dc2006-12-02 04:23:10 +00004; RUN: llvm-upgrade < %s | llvm-as | opt -inline | llvm-dis | not grep unwind$
Chris Lattner0f12ef62003-08-24 06:55:07 +00005
6declare void %might_throw()
Chris Lattner0f12ef62003-08-24 06:55:07 +00007
8implementation
9
10internal int %callee() {
11 invoke void %might_throw() to label %cont except label %exc
12cont:
13 ret int 0
14exc: ; This just rethrows the exception!
Chris Lattnerbf33da22005-05-13 15:48:41 +000015 unwind
Chris Lattner0f12ef62003-08-24 06:55:07 +000016}
17
Chris Lattner1853f282003-08-24 12:16:58 +000018; caller returns true if might_throw throws an exception... which gets
19; propagated by callee.
Chris Lattner0f12ef62003-08-24 06:55:07 +000020int %caller() {
21 %X = invoke int %callee() to label %cont
22 except label %Handler
23cont:
24 ret int %X
25Handler:
26 ; This consumes an exception thrown by might_throw
Chris Lattner1853f282003-08-24 12:16:58 +000027 ret int 1
Chris Lattner0f12ef62003-08-24 06:55:07 +000028}