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 | FileCheck %s 5; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s 6 7declare void @might_throw() 8 9define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 { 10entry: 11 invoke void @might_throw() 12 to label %cont unwind label %exc 13 14cont: 15 ret i32 0 16 17exc: 18 ; This just rethrows the exception! 19 %exn = landingpad {i8*, i32} 20 cleanup 21 resume { i8*, i32 } %exn 22} 23 24; caller returns true if might_throw throws an exception... which gets 25; propagated by callee. 26define i32 @caller() personality i32 (...)* @__gxx_personality_v0 { 27; CHECK-LABEL: define i32 @caller() 28entry: 29 %X = invoke i32 @callee() 30 to label %cont unwind label %Handler 31; CHECK-NOT: @callee 32; CHECK: invoke void @might_throw() 33; At this point we just check that the rest of the function does not 'resume' 34; at any point and instead the inlined resume is threaded into normal control 35; flow. 36; CHECK-NOT: resume 37 38cont: 39 ret i32 %X 40 41Handler: 42; This consumes an exception thrown by might_throw 43 %exn = landingpad {i8*, i32} 44 cleanup 45 ret i32 1 46} 47 48declare i32 @__gxx_personality_v0(...) 49