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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
| ; RUN: opt < %s -inline -inline-threshold=20 -S -mtriple=aarch64-none-linux | FileCheck %s
; RUN: opt < %s -passes='cgscc(inline)' -inline-threshold=20 -S -mtriple=aarch64-none-linux | FileCheck %s
define i32 @callee_range(i32 %a, i32* %P) {
switch i32 %a, label %sw.default [
i32 0, label %sw.bb0
i32 1000, label %sw.bb1
i32 2000, label %sw.bb1
i32 3000, label %sw.bb1
i32 4000, label %sw.bb1
i32 5000, label %sw.bb1
i32 6000, label %sw.bb1
i32 7000, label %sw.bb1
i32 8000, label %sw.bb1
i32 9000, label %sw.bb1
]
sw.default:
store volatile i32 %a, i32* %P
br label %return
sw.bb0:
store volatile i32 %a, i32* %P
br label %return
sw.bb1:
store volatile i32 %a, i32* %P
br label %return
return:
ret i32 42
}
define i32 @caller_range(i32 %a, i32* %P) {
; CHECK-LABEL: @caller_range(
; CHECK: call i32 @callee_range
%r = call i32 @callee_range(i32 %a, i32* %P)
ret i32 %r
}
define i32 @callee_bittest(i32 %a, i32* %P) {
switch i32 %a, label %sw.default [
i32 0, label %sw.bb0
i32 1, label %sw.bb1
i32 2, label %sw.bb2
i32 3, label %sw.bb0
i32 4, label %sw.bb1
i32 5, label %sw.bb2
i32 6, label %sw.bb0
i32 7, label %sw.bb1
i32 8, label %sw.bb2
]
sw.default:
store volatile i32 %a, i32* %P
br label %return
sw.bb0:
store volatile i32 %a, i32* %P
br label %return
sw.bb1:
store volatile i32 %a, i32* %P
br label %return
sw.bb2:
br label %return
return:
ret i32 42
}
define i32 @caller_bittest(i32 %a, i32* %P) {
; CHECK-LABEL: @caller_bittest(
; CHECK-NOT: call i32 @callee_bittest
%r= call i32 @callee_bittest(i32 %a, i32* %P)
ret i32 %r
}
define i32 @callee_jumptable(i32 %a, i32* %P) {
switch i32 %a, label %sw.default [
i32 1001, label %sw.bb101
i32 1002, label %sw.bb102
i32 1003, label %sw.bb103
i32 1004, label %sw.bb104
i32 1005, label %sw.bb101
i32 1006, label %sw.bb102
i32 1007, label %sw.bb103
i32 1008, label %sw.bb104
i32 1009, label %sw.bb101
i32 1010, label %sw.bb102
i32 1011, label %sw.bb103
i32 1012, label %sw.bb104
]
sw.default:
br label %return
sw.bb101:
store volatile i32 %a, i32* %P
br label %return
sw.bb102:
store volatile i32 %a, i32* %P
br label %return
sw.bb103:
store volatile i32 %a, i32* %P
br label %return
sw.bb104:
store volatile i32 %a, i32* %P
br label %return
return:
ret i32 42
}
define i32 @caller_jumptable(i32 %a, i32 %b, i32* %P) {
; CHECK-LABEL: @caller_jumptable(
; CHECK: call i32 @callee_jumptable
%r = call i32 @callee_jumptable(i32 %b, i32* %P)
ret i32 %r
}
define internal i32 @callee_negativeCost(i32 %t) {
entry:
switch i32 %t, label %sw.default [
i32 1, label %sw.bb
i32 0, label %sw.bb1
i32 42, label %sw.bb2
i32 43, label %sw.bb3
]
sw.bb: ; preds = %entry
br label %cleanup
sw.bb1: ; preds = %entry
br label %cleanup
sw.bb2: ; preds = %entry
br label %cleanup
sw.bb3: ; preds = %entry
br label %cleanup
sw.default: ; preds = %entry
br label %cleanup
cleanup: ; preds = %sw.default, %sw.bb3, %sw.bb2, %sw.bb1, %sw.bb
%retval.0 = phi i32 [ 1, %sw.default ], [ 3, %sw.bb3 ], [ 2, %sw.bb2 ], [ 0, %sw.bb1 ], [ 0, %sw.bb ]
ret i32 %retval.0
}
define i32 @caller_negativeCost(i32 %t) {
; CHECK-LABEL: @caller_negativeCost(
; CHECK-NOT: call i32 @callee_negativeCost
entry:
%call = call i32 @callee_negativeCost(i32 %t)
ret i32 %call
}
|