1 ; Test that any rethrown exceptions in an inlined function are automatically
2 ; turned into branches to the invoke destination.
4 ; RUN: opt < %s -passes=inline -S | FileCheck %s
5 ; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s
6 ; RUN: opt < %s -passes='module-inline' -S | FileCheck %s
8 declare void @might_throw()
10 define internal i32 @callee() personality ptr @__gxx_personality_v0 {
12 invoke void @might_throw()
13 to label %cont unwind label %exc
19 ; This just rethrows the exception!
20 %exn = landingpad {ptr, i32}
22 resume { ptr, i32 } %exn
25 ; caller returns true if might_throw throws an exception... which gets
26 ; propagated by callee.
27 define i32 @caller() personality ptr @__gxx_personality_v0 {
28 ; CHECK-LABEL: define i32 @caller()
30 %X = invoke i32 @callee()
31 to label %cont unwind label %Handler
33 ; CHECK: invoke void @might_throw()
34 ; At this point we just check that the rest of the function does not 'resume'
35 ; at any point and instead the inlined resume is threaded into normal control
43 ; This consumes an exception thrown by might_throw
44 %exn = landingpad {ptr, i32}
49 declare i32 @__gxx_personality_v0(...)