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