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