1*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
3*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -max-num-inline-blocks=2 -S | FileCheck --check-prefix=LIMIT %s
4*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=2 -S | FileCheck  --check-prefix=LIMIT %s
5*cee313d2SEric Christopher
6*cee313d2SEric Christopher; Function Attrs: nounwind uwtable
7*cee313d2SEric Christopherdefine i32 @bar(i32 %arg) local_unnamed_addr #0 {
8*cee313d2SEric Christopherbb:
9*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0
10*cee313d2SEric Christopher  br i1 %tmp, label %bb4, label %bb1
11*cee313d2SEric Christopher
12*cee313d2SEric Christopherbb1:                                              ; preds = %bb
13*cee313d2SEric Christopher  %tmp2 = tail call i32 (...) @channels() #1
14*cee313d2SEric Christopher  %tmp3 = icmp slt i32 %tmp2, %arg
15*cee313d2SEric Christopher  br i1 %tmp3, label %bb4, label %bb5
16*cee313d2SEric Christopher
17*cee313d2SEric Christopherbb4:                                              ; preds = %bb1, %bb
18*cee313d2SEric Christopher  tail call void (...) @foo() #1
19*cee313d2SEric Christopher  tail call void (...) @foo() #1
20*cee313d2SEric Christopher  tail call void (...) @foo() #1
21*cee313d2SEric Christopher  tail call void (...) @foo() #1
22*cee313d2SEric Christopher  tail call void (...) @foo() #1
23*cee313d2SEric Christopher  tail call void (...) @foo() #1
24*cee313d2SEric Christopher  tail call void (...) @foo() #1
25*cee313d2SEric Christopher  tail call void (...) @foo() #1
26*cee313d2SEric Christopher  tail call void (...) @foo() #1
27*cee313d2SEric Christopher  br label %bb5
28*cee313d2SEric Christopher
29*cee313d2SEric Christopherbb5:                                              ; preds = %bb4, %bb1
30*cee313d2SEric Christopher  %.0 = phi i32 [ 0, %bb4 ], [ 1, %bb1 ]
31*cee313d2SEric Christopher  ret i32 %.0
32*cee313d2SEric Christopher}
33*cee313d2SEric Christopher
34*cee313d2SEric Christopherdeclare i32 @channels(...) local_unnamed_addr
35*cee313d2SEric Christopher
36*cee313d2SEric Christopherdeclare void @foo(...) local_unnamed_addr
37*cee313d2SEric Christopher
38*cee313d2SEric Christopher; Function Attrs: nounwind uwtable
39*cee313d2SEric Christopherdefine i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
40*cee313d2SEric Christopherbb:
41*cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller
42*cee313d2SEric Christopher; CHECK: br i1
43*cee313d2SEric Christopher; CHECK: br i1
44*cee313d2SEric Christopher; CHECK: call void @bar.2.
45*cee313d2SEric Christopher; LIMIT-LABEL: @dummy_caller
46*cee313d2SEric Christopher; LIMIT-NOT: br
47*cee313d2SEric Christopher; LIMIT: call i32 @bar(
48*cee313d2SEric Christopher  %tmp = tail call i32 @bar(i32 %arg)
49*cee313d2SEric Christopher  ret i32 %tmp
50*cee313d2SEric Christopher}
51*cee313d2SEric Christopher
52*cee313d2SEric Christopherdefine i32 @bar_multi_ret(i32 %arg) local_unnamed_addr #0 {
53*cee313d2SEric Christopherbb:
54*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0
55*cee313d2SEric Christopher  br i1 %tmp, label %bb4, label %bb1
56*cee313d2SEric Christopher
57*cee313d2SEric Christopherbb1:                                              ; preds = %bb
58*cee313d2SEric Christopher  %tmp2 = tail call i32 (...) @channels() #1
59*cee313d2SEric Christopher  %tmp3 = icmp slt i32 %tmp2, %arg
60*cee313d2SEric Christopher  br i1 %tmp3, label %bb4, label %bb5
61*cee313d2SEric Christopher
62*cee313d2SEric Christopherbb4:                                              ; preds = %bb1, %bb
63*cee313d2SEric Christopher  tail call void (...) @foo() #1
64*cee313d2SEric Christopher  tail call void (...) @foo() #1
65*cee313d2SEric Christopher  tail call void (...) @foo() #1
66*cee313d2SEric Christopher  tail call void (...) @foo() #1
67*cee313d2SEric Christopher  %tmp4 = icmp slt i32 %arg, 10
68*cee313d2SEric Christopher  br i1 %tmp4, label %bb6, label %bb5
69*cee313d2SEric Christopherbb6:
70*cee313d2SEric Christopher  tail call void (...) @foo() #1
71*cee313d2SEric Christopher  %tmp5 = icmp slt i32 %arg, 3
72*cee313d2SEric Christopher  br i1 %tmp5, label %bb7, label %bb5
73*cee313d2SEric Christopherbb7:
74*cee313d2SEric Christopher  tail call void (...) @foo() #1
75*cee313d2SEric Christopher  br label %bb8
76*cee313d2SEric Christopherbb8:
77*cee313d2SEric Christopher  ret i32 0
78*cee313d2SEric Christopher
79*cee313d2SEric Christopherbb5:                                              ; preds = %bb4, %bb1
80*cee313d2SEric Christopher  %.0 = phi i32 [ 0, %bb4 ], [ 1, %bb1 ], [0, %bb6]
81*cee313d2SEric Christopher  ret i32 %.0
82*cee313d2SEric Christopher}
83*cee313d2SEric Christopher
84*cee313d2SEric Christopherdefine i32 @dummy_caller2(i32 %arg) local_unnamed_addr #0 {
85*cee313d2SEric Christopher; CHECK: br i1
86*cee313d2SEric Christopher; CHECK: br i1
87*cee313d2SEric Christopher; CHECK: call {{.*}} @bar_multi_ret.1.
88*cee313d2SEric Christopher  %tmp = tail call i32 @bar_multi_ret(i32 %arg)
89*cee313d2SEric Christopher  ret i32 %tmp
90*cee313d2SEric Christopher}
91*cee313d2SEric Christopher
92*cee313d2SEric Christopherattributes #0 = { nounwind uwtable }
93*cee313d2SEric Christopherattributes #1 = { nounwind }
94*cee313d2SEric Christopher
95*cee313d2SEric Christopher!llvm.ident = !{!0}
96*cee313d2SEric Christopher
97*cee313d2SEric Christopher!0 = !{!"clang version 5.0.0 (trunk 300576)"}
98