1; Test that any rethrown exceptions in an inlined function are automatically
2; turned into branches to the invoke destination.
3
4; RUN: opt < %s -inline -S | not grep unwind$
5
6declare void @might_throw()
7
8define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 {
9        invoke void @might_throw( )
10                        to label %cont unwind label %exc
11
12cont:           ; preds = %0
13        ret i32 0
14
15exc:            ; preds = %0a
16       ; This just rethrows the exception!
17        %exn = landingpad {i8*, i32}
18                 cleanup
19        resume { i8*, i32 } %exn
20}
21
22; caller returns true if might_throw throws an exception... which gets
23; propagated by callee.
24define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
25        %X = invoke i32 @callee( )
26                        to label %cont unwind label %Handler            ; <i32> [#uses=1]
27
28cont:           ; preds = %0
29        ret i32 %X
30
31Handler:                ; preds = %0
32; This consumes an exception thrown by might_throw
33        %exn = landingpad {i8*, i32}
34                 cleanup
35        ret i32 1
36}
37
38declare i32 @__gxx_personality_v0(...)
39