1 ; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK0 < %t
2 ; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=4 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK4 < %t
3 ; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=8 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK8 < %t
4 ; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -max-jump-table-size=16 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECK16 < %t
5 ; RUN: llc %s -O2 -print-after-isel -mtriple=aarch64-linux-gnu -jump-table-density=40 -mcpu=exynos-m3 -o /dev/null 2> %t; FileCheck %s --check-prefixes=CHECK,CHECKM3 < %t
7 declare void @ext(i32, i32)
9 define i32 @jt1(i32 %a, i32 %b) {
11 switch i32 %a, label %return [
30 ; CHECK-LABEL: function jt1:
31 ; CHECK-NEXT: Jump Tables:
32 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
33 ; CHECK0-NOT: %jump-table.1:
34 ; CHECK4-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5
35 ; CHECK4-NEXT: %jump-table.1: %bb.6 %bb.7 %bb.8 %bb.9
36 ; CHECK4-NEXT: %jump-table.2: %bb.10 %bb.11 %bb.12 %bb.13
37 ; CHECK4-NEXT: %jump-table.3: %bb.14 %bb.15 %bb.16 %bb.17
38 ; CHECK4-NOT: %jump-table.4:
39 ; CHECK8-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9
40 ; CHECK8-NEXT: %jump-table.1: %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
41 ; CHECK8-NOT: %jump-table.2:
42 ; CHECK16-NEXT: %jump-table.0: %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
43 ; CHECK16-NOT: %jump-table.1:
44 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
45 ; CHECKM3-NOT: %jump-table.1:
47 bb1: tail call void @ext(i32 1, i32 0) br label %return
48 bb2: tail call void @ext(i32 2, i32 2) br label %return
49 bb3: tail call void @ext(i32 3, i32 4) br label %return
50 bb4: tail call void @ext(i32 4, i32 6) br label %return
51 bb5: tail call void @ext(i32 5, i32 8) br label %return
52 bb6: tail call void @ext(i32 6, i32 10) br label %return
53 bb7: tail call void @ext(i32 7, i32 12) br label %return
54 bb8: tail call void @ext(i32 8, i32 14) br label %return
55 bb9: tail call void @ext(i32 9, i32 16) br label %return
56 bb10: tail call void @ext(i32 1, i32 18) br label %return
57 bb11: tail call void @ext(i32 2, i32 20) br label %return
58 bb12: tail call void @ext(i32 3, i32 22) br label %return
59 bb13: tail call void @ext(i32 4, i32 24) br label %return
60 bb14: tail call void @ext(i32 5, i32 26) br label %return
61 bb15: tail call void @ext(i32 6, i32 28) br label %return
62 bb16: tail call void @ext(i32 7, i32 30) br label %return
63 bb17: tail call void @ext(i32 8, i32 32) br label %return
68 define void @jt2(i32 %x) {
70 switch i32 %x, label %return [
79 ; CHECK-LABEL: function jt2:
80 ; CHECK-NEXT: Jump Tables:
81 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.5 %bb.6{{$}}
82 ; CHECK0-NOT: %jump-table.1:
83 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}}
84 ; CHECK4-NOT: %jump-table.1:
85 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4{{$}}
86 ; CHECK8-NOT: %jump-table.1:
87 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.5 %bb.6{{$}}
88 ; CHECK16-NOT: %jump-table.1:
89 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.7 %bb.5 %bb.6{{$}}
90 ; CHECKM3-NOT: %jump-table.1:
91 ; CHECK-DAG: End machine code for function jt2.
93 bb1: tail call void @ext(i32 6, i32 1) br label %return
94 bb2: tail call void @ext(i32 5, i32 2) br label %return
95 bb3: tail call void @ext(i32 4, i32 3) br label %return
96 bb4: tail call void @ext(i32 3, i32 4) br label %return
97 bb5: tail call void @ext(i32 2, i32 5) br label %return
98 bb6: tail call void @ext(i32 1, i32 6) br label %return
102 define void @jt3(i32 %x) {
104 switch i32 %x, label %return [
121 ; CHECK-LABEL: function jt3:
122 ; CHECK-NEXT: Jump Tables:
123 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
124 ; CHECK0-NOT: %jump-table.1:
125 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
126 ; CHECK4-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8
127 ; CHECK4-NOT: %jump-table.2:
128 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
129 ; CHECK8-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
130 ; CHECK8-NOT: %jump-table.2:
131 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7
132 ; CHECK16-NEXT: %jump-table.1: %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
133 ; CHECK16-NOT: %jump-table.2:
134 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
135 ; CHECKM3-NOT: %jump-table.1:
136 ; CHECK-DAG: End machine code for function jt3.
138 bb1: tail call void @ext(i32 1, i32 12) br label %return
139 bb2: tail call void @ext(i32 2, i32 11) br label %return
140 bb3: tail call void @ext(i32 3, i32 10) br label %return
141 bb4: tail call void @ext(i32 4, i32 9) br label %return
142 bb5: tail call void @ext(i32 5, i32 8) br label %return
143 bb6: tail call void @ext(i32 6, i32 7) br label %return
144 bb7: tail call void @ext(i32 7, i32 6) br label %return
145 bb8: tail call void @ext(i32 8, i32 5) br label %return
146 bb9: tail call void @ext(i32 9, i32 4) br label %return
147 bb10: tail call void @ext(i32 10, i32 3) br label %return
148 bb11: tail call void @ext(i32 11, i32 2) br label %return
149 bb12: tail call void @ext(i32 12, i32 1) br label %return
154 define void @jt4(i32 %x) {
156 switch i32 %x, label %default [
173 ; CHECK-LABEL: function jt4:
174 ; CHECK-NEXT: Jump Tables:
175 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
176 ; CHECK0-NOT: %jump-table.1:
177 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
178 ; CHECK4-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8
179 ; CHECK4-NOT: %jump-table.2:
180 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4
181 ; CHECK8-NEXT: %jump-table.1: %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
182 ; CHECK8-NOT: %jump-table.2:
183 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7
184 ; CHECK16-NEXT: %jump-table.1: %bb.8 %bb.13 %bb.9 %bb.10 %bb.13 %bb.11 %bb.12
185 ; CHECK16-NOT: %jump-table.2:
186 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.13 %bb.5 %bb.6 %bb.7 %bb.8 %bb.13 %bb.9 %bb.10
187 ; CHECKM3-NOT: %jump-table.1:
188 ; CHECK-DAG: End machine code for function jt4.
190 bb1: tail call void @ext(i32 1, i32 12) br label %return
191 bb2: tail call void @ext(i32 2, i32 11) br label %return
192 bb3: tail call void @ext(i32 3, i32 10) br label %return
193 bb4: tail call void @ext(i32 4, i32 9) br label %return
194 bb5: tail call void @ext(i32 5, i32 8) br label %return
195 bb6: tail call void @ext(i32 6, i32 7) br label %return
196 bb7: tail call void @ext(i32 7, i32 6) br label %return
197 bb8: tail call void @ext(i32 8, i32 5) br label %return
198 bb9: tail call void @ext(i32 9, i32 4) br label %return
199 bb10: tail call void @ext(i32 10, i32 3) br label %return
200 bb11: tail call void @ext(i32 11, i32 2) br label %return
201 bb12: tail call void @ext(i32 12, i32 1) br label %return
207 define i32 @jt1_optsize(i32 %a, i32 %b) optsize {
209 switch i32 %a, label %return [
228 ; CHECK-LABEL: function jt1_optsize:
229 ; CHECK-NEXT: Jump Tables:
230 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
231 ; CHECK0-NOT: %jump-table.1:
232 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
233 ; CHECK4-NOT: %jump-table.1:
234 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
235 ; CHECK8-NOT: %jump-table.1:
236 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
237 ; CHECK16-NOT: %jump-table.1:
238 ; CHECKM1-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
239 ; CHECKM1-NOT: %jump-table.1:
240 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
241 ; CHECKM3-NOT: %jump-table.1:
242 ; CHECK-DAG: End machine code for function jt1_optsize.
244 bb1: tail call void @ext(i32 1, i32 0) br label %return
245 bb2: tail call void @ext(i32 2, i32 2) br label %return
246 bb3: tail call void @ext(i32 3, i32 4) br label %return
247 bb4: tail call void @ext(i32 4, i32 6) br label %return
248 bb5: tail call void @ext(i32 5, i32 8) br label %return
249 bb6: tail call void @ext(i32 6, i32 10) br label %return
250 bb7: tail call void @ext(i32 7, i32 12) br label %return
251 bb8: tail call void @ext(i32 8, i32 14) br label %return
252 bb9: tail call void @ext(i32 9, i32 16) br label %return
253 bb10: tail call void @ext(i32 1, i32 18) br label %return
254 bb11: tail call void @ext(i32 2, i32 20) br label %return
255 bb12: tail call void @ext(i32 3, i32 22) br label %return
256 bb13: tail call void @ext(i32 4, i32 24) br label %return
257 bb14: tail call void @ext(i32 5, i32 26) br label %return
258 bb15: tail call void @ext(i32 6, i32 28) br label %return
259 bb16: tail call void @ext(i32 7, i32 30) br label %return
260 bb17: tail call void @ext(i32 8, i32 32) br label %return
265 define i32 @jt1_pgso(i32 %a, i32 %b) !prof !14 {
267 switch i32 %a, label %return [
286 ; CHECK-LABEL: function jt1_pgso:
287 ; CHECK-NEXT: Jump Tables:
288 ; CHECK0-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
289 ; CHECK0-NOT: %jump-table.1:
290 ; CHECK4-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
291 ; CHECK4-NOT: %jump-table.1:
292 ; CHECK8-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
293 ; CHECK8-NOT: %jump-table.1:
294 ; CHECK16-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
295 ; CHECK16-NOT: %jump-table.1:
296 ; CHECKM1-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
297 ; CHECKM1-NOT: %jump-table.1:
298 ; CHECKM3-NEXT: %jump-table.0: %bb.1 %bb.2 %bb.3 %bb.4 %bb.5 %bb.6 %bb.7 %bb.8 %bb.9 %bb.10 %bb.11 %bb.12 %bb.13 %bb.14 %bb.15 %bb.16 %bb.17
299 ; CHECKM3-NOT: %jump-table.1:
300 ; CHECK-DAG: End machine code for function jt1_pgso.
302 bb1: tail call void @ext(i32 1, i32 0) br label %return
303 bb2: tail call void @ext(i32 2, i32 2) br label %return
304 bb3: tail call void @ext(i32 3, i32 4) br label %return
305 bb4: tail call void @ext(i32 4, i32 6) br label %return
306 bb5: tail call void @ext(i32 5, i32 8) br label %return
307 bb6: tail call void @ext(i32 6, i32 10) br label %return
308 bb7: tail call void @ext(i32 7, i32 12) br label %return
309 bb8: tail call void @ext(i32 8, i32 14) br label %return
310 bb9: tail call void @ext(i32 9, i32 16) br label %return
311 bb10: tail call void @ext(i32 1, i32 18) br label %return
312 bb11: tail call void @ext(i32 2, i32 20) br label %return
313 bb12: tail call void @ext(i32 3, i32 22) br label %return
314 bb13: tail call void @ext(i32 4, i32 24) br label %return
315 bb14: tail call void @ext(i32 5, i32 26) br label %return
316 bb15: tail call void @ext(i32 6, i32 28) br label %return
317 bb16: tail call void @ext(i32 7, i32 30) br label %return
318 bb17: tail call void @ext(i32 8, i32 32) br label %return
323 !llvm.module.flags = !{!0}
324 !0 = !{i32 1, !"ProfileSummary", !1}
325 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
326 !2 = !{!"ProfileFormat", !"InstrProf"}
327 !3 = !{!"TotalCount", i64 10000}
328 !4 = !{!"MaxCount", i64 10}
329 !5 = !{!"MaxInternalCount", i64 1}
330 !6 = !{!"MaxFunctionCount", i64 1000}
331 !7 = !{!"NumCounts", i64 3}
332 !8 = !{!"NumFunctions", i64 3}
333 !9 = !{!"DetailedSummary", !10}
334 !10 = !{!11, !12, !13}
335 !11 = !{i32 10000, i64 100, i32 1}
336 !12 = !{i32 999000, i64 100, i32 1}
337 !13 = !{i32 999999, i64 1, i32 2}
338 !14 = !{!"function_entry_count", i64 0}