xref: /llvm-project/llvm/test/Transforms/Inline/invoke-cost.ll (revision 151602c7a9935558ca671b35359989b261045db0)
1; RUN: opt -passes=inline < %s -S -o - -inline-threshold=100 | FileCheck %s
2; RUN: opt -passes='cgscc(inline)' < %s -S -o - -inline-threshold=100 | FileCheck %s
3
4target datalayout = "p:32:32"
5
6@glbl = external global i32
7
8declare void @f()
9declare i32 @__gxx_personality_v0(...)
10declare ptr @__cxa_begin_catch(ptr)
11declare void @__cxa_end_catch()
12declare void @_ZSt9terminatev()
13
14define void @inner1() personality ptr @__gxx_personality_v0 {
15entry:
16  invoke void @f() to label %cont1 unwind label %terminate.lpad
17
18cont1:
19  invoke void @f() to label %cont2 unwind label %terminate.lpad
20
21cont2:
22  invoke void @f() to label %cont3 unwind label %terminate.lpad
23
24cont3:
25  invoke void @f() to label %cont4 unwind label %terminate.lpad
26
27cont4:
28  ret void
29
30terminate.lpad:
31  landingpad {ptr, i32}
32            catch ptr null
33  call void @_ZSt9terminatev() noreturn nounwind
34  unreachable
35}
36
37define void @outer1() {
38; CHECK-LABEL: @outer1(
39;
40; This call should not get inlined because inner1 actually calls a function
41; many times, but it only does so through invoke as opposed to call.
42;
43; CHECK: call void @inner1
44  call void @inner1()
45  ret void
46}
47