Renamed `as' => `llvm-as', `dis' => `llvm-dis', `link' => `llvm-link'.
[oota-llvm.git] / test / Transforms / Inline / invoke_test-3.ll
1 ; Test that any rethrown exceptions in an inlined function are automatically
2 ; turned into branches to the invoke destination.
3
4 ; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep 'call void %llvm.unwind'
5
6 declare void %might_throw()
7 declare void %llvm.unwind()
8
9 implementation
10
11 internal int %callee() {
12         invoke void %might_throw() to label %cont except label %exc
13 cont:
14         ret int 0
15 exc:    ; This just rethrows the exception!
16         call void %llvm.unwind()
17         ret int 123  ; DEAD!
18 }
19
20 ; caller returns true if might_throw throws an exception... which gets 
21 ; propagated by callee.
22 int %caller() {
23         %X = invoke int %callee() to label %cont 
24                 except label %Handler
25 cont:
26         ret int %X
27 Handler:
28         ; This consumes an exception thrown by might_throw
29         ret int 1
30 }