1*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -S | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -S | FileCheck %s
3*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -max-num-inline-blocks=3 -skip-partial-inlining-cost-analysis  -S | FileCheck --check-prefix=LIMIT3 %s
4*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=3 -skip-partial-inlining-cost-analysis -S | FileCheck  --check-prefix=LIMIT3 %s
5*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -max-num-inline-blocks=2 -S | FileCheck --check-prefix=LIMIT2 %s
6*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=2 -S | FileCheck  --check-prefix=LIMIT2 %s
7*cee313d2SEric Christopher
8*cee313d2SEric Christopher
9*cee313d2SEric Christopher; Function Attrs: nounwind uwtable
10*cee313d2SEric Christopherdefine i32 @bar(i32 %arg) local_unnamed_addr #0 {
11*cee313d2SEric Christopherbb:
12*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0
13*cee313d2SEric Christopher  br i1 %tmp, label %bb4, label %bb1
14*cee313d2SEric Christopher
15*cee313d2SEric Christopherbb1:                                              ; preds = %bb
16*cee313d2SEric Christopher  %tmp2 = tail call i32 (...) @n() #2
17*cee313d2SEric Christopher  %tmp3 = icmp slt i32 %tmp2, %arg
18*cee313d2SEric Christopher  br i1 %tmp3, label %bb4, label %bb8
19*cee313d2SEric Christopher
20*cee313d2SEric Christopherbb4:                                              ; preds = %bb1, %bb
21*cee313d2SEric Christopher  %tmp5 = tail call i32 (...) @m() #2
22*cee313d2SEric Christopher  %tmp6 = icmp sgt i32 %tmp5, %arg
23*cee313d2SEric Christopher  br i1 %tmp6, label %bb7, label %bb8
24*cee313d2SEric Christopher
25*cee313d2SEric Christopherbb7:                                              ; preds = %bb4
26*cee313d2SEric Christopher  tail call void (...) @foo() #2
27*cee313d2SEric Christopher  tail call void (...) @foo() #2
28*cee313d2SEric Christopher  tail call void (...) @foo() #2
29*cee313d2SEric Christopher  tail call void (...) @foo() #2
30*cee313d2SEric Christopher  tail call void (...) @foo() #2
31*cee313d2SEric Christopher  tail call void (...) @foo() #2
32*cee313d2SEric Christopher  tail call void (...) @foo() #2
33*cee313d2SEric Christopher  tail call void (...) @foo() #2
34*cee313d2SEric Christopher  tail call void (...) @foo() #2
35*cee313d2SEric Christopher  br label %bb8
36*cee313d2SEric Christopher
37*cee313d2SEric Christopherbb8:                                              ; preds = %bb7, %bb4, %bb1
38*cee313d2SEric Christopher  %tmp9 = phi i32 [ 0, %bb7 ], [ 1, %bb4 ], [ 1, %bb1 ]
39*cee313d2SEric Christopher  ret i32 %tmp9
40*cee313d2SEric Christopher}
41*cee313d2SEric Christopher
42*cee313d2SEric Christopherdeclare i32 @n(...) local_unnamed_addr #1
43*cee313d2SEric Christopher
44*cee313d2SEric Christopherdeclare i32 @m(...) local_unnamed_addr #1
45*cee313d2SEric Christopher
46*cee313d2SEric Christopherdeclare void @foo(...) local_unnamed_addr #1
47*cee313d2SEric Christopher
48*cee313d2SEric Christopher; Function Attrs: nounwind uwtable
49*cee313d2SEric Christopherdefine i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
50*cee313d2SEric Christopherbb:
51*cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller
52*cee313d2SEric Christopher; CHECK: br i1
53*cee313d2SEric Christopher; CHECK: br i1
54*cee313d2SEric Christopher; CHECK: br i1
55*cee313d2SEric Christopher; CHECK: call void @bar.1.
56*cee313d2SEric Christopher; LIMIT3-LABEL: @dummy_caller
57*cee313d2SEric Christopher; LIMIT3: br i1
58*cee313d2SEric Christopher; LIMIT3: br i1
59*cee313d2SEric Christopher; LIMIT3-NOT: br i1
60*cee313d2SEric Christopher; LIMIT3: call void @bar.1.
61*cee313d2SEric Christopher; LIMIT2-LABEL: @dummy_caller
62*cee313d2SEric Christopher; LIMIT2-NOT: br i1
63*cee313d2SEric Christopher; LIMIT2: call i32 @bar(
64*cee313d2SEric Christopher  %tmp = tail call i32 @bar(i32 %arg)
65*cee313d2SEric Christopher  ret i32 %tmp
66*cee313d2SEric Christopher}
67*cee313d2SEric Christopher
68*cee313d2SEric Christopherattributes #0 = { nounwind }
69*cee313d2SEric Christopherattributes #1 = { nounwind }
70*cee313d2SEric Christopherattributes #2 = { nounwind }
71*cee313d2SEric Christopher
72