xref: /llvm-project/llvm/test/Transforms/Inline/invoke_test-1.ll (revision 151602c7a9935558ca671b35359989b261045db0)
1; Test that we can inline a simple function, turning the calls in it into invoke
2; instructions
3
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
7
8declare void @might_throw()
9
10define internal void @callee() {
11entry:
12  call void @might_throw()
13  ret void
14}
15
16; caller returns true if might_throw throws an exception...
17define i32 @caller() personality ptr @__gxx_personality_v0 {
18; CHECK-LABEL: define i32 @caller() personality ptr @__gxx_personality_v0
19entry:
20  invoke void @callee()
21      to label %cont unwind label %exc
22; CHECK-NOT: @callee
23; CHECK: invoke void @might_throw()
24
25cont:
26  ret i32 0
27
28exc:
29  %exn = landingpad {ptr, i32}
30         cleanup
31  ret i32 1
32}
33
34declare i32 @__gxx_personality_v0(...)
35