[Frontend] Remove unused includes (NFC) (#116927)
[llvm-project.git] / llvm / test / CodeGen / X86 / code_placement_ext_tsp_large.ll
blob24c52f1e88656ed7496a5310b83d41af4aa26e3d
1 ; REQUIRES: asserts
2 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement -ext-tsp-chain-split-threshold=128 -debug-only=block-placement < %s 2>&1 | FileCheck %s
3 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement -ext-tsp-chain-split-threshold=1 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK2
4 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK3
5 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -verify-machineinstrs -enable-ext-tsp-block-placement -ext-tsp-block-placement-max-blocks=8 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK4
7 @yydebug = dso_local global i32 0, align 4
9 define void @func_large() !prof !0 {
10 ; A large CFG instance where chain splitting helps to
11 ; compute a better basic block ordering. The test verifies that with chain
12 ; splitting, the resulting layout is improved (e.g., the score is increased).
14 ;                                     +----------------+
15 ;                                     | b0 [76 bytes]  | -------------------+
16 ;                                     +----------------+                    |
17 ;                                       |                                   |
18 ;                                       | 3,065,981,778                     |
19 ;                                       v                                   |
20 ; +----------------+  766,495,444     +----------------+                    |
21 ; | b8 [244 bytes] | <--------------- |  b2 [4 bytes]  |                    |
22 ; +----------------+                  +----------------+                    |
23 ;   |        ^                          |                                   |
24 ;   |        |                          | 2,299,486,333                     |
25 ;   |        | 766,495,444              v                                   |
26 ;   |        |                        +----------------+                    |
27 ;   |        +----------------------- | b3 [12 bytes]  |                    |
28 ;   |                                 +----------------+                    |
29 ;   |                                   |                                   |
30 ;   |                                   | 1,532,990,888                     |
31 ;   |                                   v                                   |
32 ;   |                                 +----------------+                    | 574,869,946
33 ;   |                 +-------------- | b4 [12 bytes]  |                    |
34 ;   |                 |               +----------------+                    |
35 ;   |                 |                 |                                   |
36 ;   |                 |                 | 574,871,583                       |
37 ;   |                 |                 v                                   |
38 ;   |                 |               +----------------+                    |
39 ;   |                 |               | b5 [116 bytes] | -+                 |
40 ;   |                 |               +----------------+  |                 |
41 ;   |                 |                 |                 |                 |
42 ;   |                 |                 | 1,636           |                 |
43 ;   |                 |                 v                 |                 |
44 ;   |                 |               +----------------+  |                 |
45 ;   |                 |       +------ | b6 [32 bytes]  |  |                 |
46 ;   |                 |       |       +----------------+  |                 |
47 ;   |                 |       |         |                 |                 |
48 ;   |                 |       |         | 7               | 3,065,981,778   |
49 ;   |                 |       |         v                 |                 |
50 ;   |                 |       |       +----------------+  |                 |
51 ;   |                 |       | 1,628 | b9 [16 bytes]  |  |                 |
52 ;   |                 |       |       +----------------+  |                 |
53 ;   |                 |       |         |                 |                 |
54 ;   |                 |       |         | 7               |                 |
55 ;   |                 |       |         v                 |                 |
56 ;   |                 |       |       +----------------+  |                 |
57 ;   |                 |       +-----> | b7 [12 bytes]  |  |                 |
58 ;   |                 |               +----------------+  |                 |
59 ;   |                 |                 |                 |                 |
60 ;   |                 | 958,119,305     | 1,636           |                 |
61 ;   |                 |                 v                 v                 v
62 ;   |                 |               +------------------------------------------+
63 ;   |                 +-------------> |                                          |
64 ;   |       1,532,990,889             |                  b1 [36 bytes]           |
65 ;   +-------------------------------> |                                          |
66 ;                                     +------------------------------------------+
68 ; An expected output with a large chain-split-threshold -- the layout score is
69 ; increased by ~17%
71 ; CHECK-LABEL: Applying ext-tsp layout
72 ; CHECK:   original  layout score: 23587612604815436.00
73 ; CHECK:   optimized layout score: 27891096739311172.00
74 ; CHECK: b0
75 ; CHECK: b2
76 ; CHECK: b3
77 ; CHECK: b4
78 ; CHECK: b5
79 ; CHECK: b8
80 ; CHECK: b1
81 ; CHECK: b6
82 ; CHECK: b7
83 ; CHECK: b9
85 ; An expected output with chain-split-threshold=1 (disabling split point enumeration)
87 ; CHECK2-LABEL: Applying ext-tsp layout
88 ; CHECK2:   original  layout score: 23587612604815436.00
89 ; CHECK2:   optimized layout score: 27891096739311172.00
90 ; CHECK2: b0
91 ; CHECK2: b2
92 ; CHECK2: b3
93 ; CHECK2: b4
94 ; CHECK2: b5
95 ; CHECK2: b8
96 ; CHECK2: b1
97 ; CHECK2: b6
98 ; CHECK2: b7
99 ; CHECK2: b9
101 ; An expected output with ext-tsp disabled -- the layout is not modified:
103 ; CHECK3-LABEL: func_large:
104 ; CHECK3: b0
105 ; CHECK3: b1
106 ; CHECK3: b2
107 ; CHECK3: b3
108 ; CHECK3: b4
109 ; CHECK3: b5
110 ; CHECK3: b6
111 ; CHECK3: b7
112 ; CHECK3: b8
113 ; CHECK3: b9
115 ; An expected output with function size larger than the threshold -- the layout is not modified:
117 ; CHECK4-LABEL: func_large:
118 ; CHECK4: b0
119 ; CHECK4: b1
120 ; CHECK4: b2
121 ; CHECK4: b3
122 ; CHECK4: b4
123 ; CHECK4: b5
124 ; CHECK4: b6
125 ; CHECK4: b7
126 ; CHECK4: b8
127 ; CHECK4: b9
130   %0 = load i32, ptr @yydebug, align 4
131   %cmp = icmp ne i32 %0, 0
132   call void @a()
133   call void @a()
134   call void @a()
135   call void @a()
136   call void @a()
137   call void @a()
138   call void @a()
139   call void @a()
140   call void @a()
141   call void @a()
142   call void @a()
143   call void @a()
144   call void @a()
145   call void @a()
146   call void @a()
147   call void @a()
148   call void @a()
149   call void @a()
150   br i1 %cmp, label %b1, label %b2, !prof !1
152   call void @b()
153   call void @b()
154   call void @b()
155   call void @b()
156   call void @b()
157   call void @b()
158   call void @b()
159   call void @b()
160   ret void
162   call void @c()
163   call void @c()
164   call void @c()
165   call void @c()
166   call void @c()
167   call void @c()
168   call void @c()
169   call void @c()
170   call void @c()
171   call void @c()
172   br i1 %cmp, label %b3, label %b8, !prof !2
174   call void @d()
175   call void @d()
176   br i1 %cmp, label %b4, label %b8, !prof !3
178   call void @e()
179   call void @e()
180   br i1 %cmp, label %b5, label %b1, !prof !4
182   call void @f()
183   call void @f()
184   call void @f()
185   call void @f()
186   call void @f()
187   call void @f()
188   call void @f()
189   call void @f()
190   call void @f()
191   call void @f()
192   call void @f()
193   call void @f()
194   call void @f()
195   call void @f()
196   call void @f()
197   call void @f()
198   call void @f()
199   call void @f()
200   call void @f()
201   call void @f()
202   call void @f()
203   call void @f()
204   call void @f()
205   call void @f()
206   call void @f()
207   call void @f()
208   call void @f()
209   call void @f()
210   br i1 %cmp, label %b1, label %b6, !prof !5
212   call void @g()
213   call void @g()
214   call void @g()
215   call void @g()
216   call void @g()
217   call void @g()
218   call void @g()
219   br i1 %cmp, label %b7, label %b9, !prof !6
221   call void @h()
222   call void @h()
223   br label %b1
225   call void @i()
226   call void @i()
227   call void @i()
228   call void @i()
229   call void @i()
230   call void @i()
231   call void @i()
232   call void @i()
233   call void @i()
234   call void @i()
235   call void @i()
236   call void @i()
237   call void @i()
238   call void @i()
239   call void @i()
240   call void @i()
241   call void @i()
242   call void @i()
243   call void @i()
244   call void @i()
245   call void @i()
246   call void @i()
247   call void @i()
248   call void @i()
249   call void @i()
250   call void @i()
251   call void @i()
252   call void @i()
253   call void @i()
254   call void @i()
255   call void @i()
256   call void @i()
257   call void @i()
258   call void @i()
259   call void @i()
260   call void @i()
261   call void @i()
262   call void @i()
263   call void @i()
264   call void @i()
265   call void @i()
266   call void @i()
267   call void @i()
268   call void @i()
269   call void @i()
270   call void @i()
271   call void @i()
272   call void @i()
273   call void @i()
274   call void @i()
275   call void @i()
276   call void @i()
277   call void @i()
278   call void @i()
279   call void @i()
280   call void @i()
281   call void @i()
282   call void @i()
283   call void @i()
284   call void @i()
285   br label %b1
287   call void @j()
288   call void @j()
289   call void @j()
290   br label %b7
294 declare void @a()
295 declare void @b()
296 declare void @c()
297 declare void @d()
298 declare void @e()
299 declare void @f()
300 declare void @g()
301 declare void @h()
302 declare void @i()
303 declare void @j()
305 !0 = !{!"function_entry_count", i64 6131963556}
306 !1 = !{!"branch_weights", i32 3065981778, i32 3065981778}
307 !2 = !{!"branch_weights", i32 2299486333, i32 766495444}
308 !3 = !{!"branch_weights", i32 1532990888, i32 766495444}
309 !4 = !{!"branch_weights", i32 574871583, i32 958119305}
310 !5 = !{!"branch_weights", i32 574869946, i32 1636}
311 !6 = !{!"branch_weights", i32 1628, i32 7}