1 ; Test that if an invoked function is inlined, and if that function cannot
2 ; throw, that the dead handler is now unreachable.
4 ; RUN: opt < %s -inline -simplifycfg -S | FileCheck %s
6 declare void @might_throw()
8 define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 {
10 invoke void @might_throw()
11 to label %cont unwind label %exc
17 %exn = landingpad {i8*, i32}
22 ; caller returns true if might_throw throws an exception... callee cannot throw.
23 define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
24 ; CHECK-LABEL: define i32 @caller() personality i32 (...)* @__gxx_personality_v0
26 %X = invoke i32 @callee()
27 to label %cont unwind label %UnreachableExceptionHandler
29 ; CHECK: invoke void @might_throw()
30 ; CHECK: to label %[[C:.*]] unwind label %[[E:.*]]
35 ; CHECK: br label %[[C]]
40 ; CHECK: %[[PHI:.*]] = phi i32
41 ; CHECK: ret i32 %[[PHI]]
43 UnreachableExceptionHandler:
44 ; CHECK-NOT: UnreachableExceptionHandler:
45 %exn = landingpad {i8*, i32}
48 ; CHECK-NOT: ret i32 -1
52 declare i32 @__gxx_personality_v0(...)