1; Test that if an invoked function is inlined, and if that function cannot
2; throw, that the dead handler is now unreachable.
3
4; RUN: opt < %s -inline -simplifycfg -S | \
5; RUN:   not grep UnreachableExceptionHandler
6
7declare void @might_throw()
8
9define internal i32 @callee() {
10        invoke void @might_throw( )
11                        to label %cont unwind label %exc
12
13cont:           ; preds = %0
14        ret i32 0
15
16exc:            ; preds = %0
17        %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
18                 cleanup
19        ret i32 1
20}
21
22; caller returns true if might_throw throws an exception... callee cannot throw.
23define i32 @caller() {
24        %X = invoke i32 @callee( )
25                        to label %cont unwind label %UnreachableExceptionHandler                ; <i32> [#uses=1]
26
27cont:           ; preds = %0
28        ret i32 %X
29
30UnreachableExceptionHandler:            ; preds = %0
31        %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
32                 cleanup
33        ret i32 -1
34}
35
36declare i32 @__gxx_personality_v0(...)
37