brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 3bf8bea Raw
50 lines · plain
1; Test that any rethrown exceptions in an inlined function are automatically2; turned into branches to the invoke destination.3 4; RUN: opt < %s -passes=inline -S | FileCheck %s5; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s6; RUN: opt < %s -passes='module-inline' -S | FileCheck %s7 8declare void @might_throw()9 10define internal i32 @callee() personality ptr @__gxx_personality_v0 {11entry:12  invoke void @might_throw()13      to label %cont unwind label %exc14 15cont:16  ret i32 017 18exc:19 ; This just rethrows the exception!20  %exn = landingpad {ptr, i32}21         cleanup22  resume { ptr, i32 } %exn23}24 25; caller returns true if might_throw throws an exception... which gets26; propagated by callee.27define i32 @caller() personality ptr @__gxx_personality_v0 {28; CHECK-LABEL: define i32 @caller()29entry:30  %X = invoke i32 @callee()31           to label %cont unwind label %Handler32; CHECK-NOT: @callee33; 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 control36; flow.37; CHECK-NOT: resume38 39cont:40  ret i32 %X41 42Handler:43; This consumes an exception thrown by might_throw44  %exn = landingpad {ptr, i32}45         cleanup46  ret i32 147}48 49declare i32 @__gxx_personality_v0(...)50