1 ; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
2 ; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=2 -S | FileCheck --check-prefix=LIMIT %s
4 ; Function Attrs: nounwind uwtable
5 define i32 @bar(i32 %arg) local_unnamed_addr #0 {
7 %tmp = icmp slt i32 %arg, 0
8 br i1 %tmp, label %bb4, label %bb1
11 %tmp2 = tail call i32 (...) @channels() #1
12 %tmp3 = icmp slt i32 %tmp2, %arg
13 br i1 %tmp3, label %bb4, label %bb5
15 bb4: ; preds = %bb1, %bb
16 tail call void (...) @foo() #1
17 tail call void (...) @foo() #1
18 tail call void (...) @foo() #1
19 tail call void (...) @foo() #1
20 tail call void (...) @foo() #1
21 tail call void (...) @foo() #1
22 tail call void (...) @foo() #1
23 tail call void (...) @foo() #1
24 tail call void (...) @foo() #1
27 bb5: ; preds = %bb4, %bb1
28 %.0 = phi i32 [ 0, %bb4 ], [ 1, %bb1 ]
32 declare i32 @channels(...) local_unnamed_addr
34 declare void @foo(...) local_unnamed_addr
36 ; Function Attrs: nounwind uwtable
37 define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
39 ; CHECK-LABEL: @dummy_caller
42 ; CHECK: call void @bar.2.
43 ; LIMIT-LABEL: @dummy_caller
45 ; LIMIT: call i32 @bar(
46 %tmp = tail call i32 @bar(i32 %arg)
50 define i32 @bar_multi_ret(i32 %arg) local_unnamed_addr #0 {
52 %tmp = icmp slt i32 %arg, 0
53 br i1 %tmp, label %bb4, label %bb1
56 %tmp2 = tail call i32 (...) @channels() #1
57 %tmp3 = icmp slt i32 %tmp2, %arg
58 br i1 %tmp3, label %bb4, label %bb5
60 bb4: ; preds = %bb1, %bb
61 tail call void (...) @foo() #1
62 tail call void (...) @foo() #1
63 tail call void (...) @foo() #1
64 tail call void (...) @foo() #1
65 %tmp4 = icmp slt i32 %arg, 10
66 br i1 %tmp4, label %bb6, label %bb5
68 tail call void (...) @foo() #1
69 %tmp5 = icmp slt i32 %arg, 3
70 br i1 %tmp5, label %bb7, label %bb5
72 tail call void (...) @foo() #1
77 bb5: ; preds = %bb4, %bb1
78 %.0 = phi i32 [ 0, %bb4 ], [ 1, %bb1 ], [0, %bb6]
82 define i32 @dummy_caller2(i32 %arg) local_unnamed_addr #0 {
85 ; CHECK: call {{.*}} @bar_multi_ret.1.
86 %tmp = tail call i32 @bar_multi_ret(i32 %arg)
90 attributes #0 = { nounwind uwtable }
91 attributes #1 = { nounwind }
95 !0 = !{!"clang version 5.0.0 (trunk 300576)"}