[NFC][RemoveDIs] Prefer iterators over inst-pointers in InstCombine
[llvm-project.git] / llvm / test / CodeGen / X86 / code_placement_ext_tsp_large.ll
blob314df786b3e80b911d3471ef40b5eeadad23c4e2
1 ; REQUIRES: asserts
2 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=1 -ext-tsp-chain-split-threshold=128 -debug-only=block-placement < %s 2>&1 | FileCheck %s
3 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -enable-ext-tsp-block-placement=1 -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 -enable-ext-tsp-block-placement=0 -debug-only=block-placement < %s 2>&1 | FileCheck %s -check-prefix=CHECK3
6 @yydebug = dso_local global i32 0, align 4
8 define void @func_large() !prof !0 {
9 ; A largee CFG instance where chain splitting helps to
10 ; compute a better basic block ordering. The test verifies that with chain
11 ; splitting, the resulting layout is improved (e.g., the score is increased).
13 ;                                     +----------------+
14 ;                                     | b0 [76 bytes]  | -------------------+
15 ;                                     +----------------+                    |
16 ;                                       |                                   |
17 ;                                       | 3,065,981,778                     |
18 ;                                       v                                   |
19 ; +----------------+  766,495,444     +----------------+                    |
20 ; | b8 [244 bytes] | <--------------- |  b2 [4 bytes]  |                    |
21 ; +----------------+                  +----------------+                    |
22 ;   |        ^                          |                                   |
23 ;   |        |                          | 2,299,486,333                     |
24 ;   |        | 766,495,444              v                                   |
25 ;   |        |                        +----------------+                    |
26 ;   |        +----------------------- | b3 [12 bytes]  |                    |
27 ;   |                                 +----------------+                    |
28 ;   |                                   |                                   |
29 ;   |                                   | 1,532,990,888                     |
30 ;   |                                   v                                   |
31 ;   |                                 +----------------+                    | 574,869,946
32 ;   |                 +-------------- | b4 [12 bytes]  |                    |
33 ;   |                 |               +----------------+                    |
34 ;   |                 |                 |                                   |
35 ;   |                 |                 | 574,871,583                       |
36 ;   |                 |                 v                                   |
37 ;   |                 |               +----------------+                    |
38 ;   |                 |               | b5 [116 bytes] | -+                 |
39 ;   |                 |               +----------------+  |                 |
40 ;   |                 |                 |                 |                 |
41 ;   |                 |                 | 1,636           |                 |
42 ;   |                 |                 v                 |                 |
43 ;   |                 |               +----------------+  |                 |
44 ;   |                 |       +------ | b6 [32 bytes]  |  |                 |
45 ;   |                 |       |       +----------------+  |                 |
46 ;   |                 |       |         |                 |                 |
47 ;   |                 |       |         | 7               | 3,065,981,778   |
48 ;   |                 |       |         v                 |                 |
49 ;   |                 |       |       +----------------+  |                 |
50 ;   |                 |       | 1,628 | b9 [16 bytes]  |  |                 |
51 ;   |                 |       |       +----------------+  |                 |
52 ;   |                 |       |         |                 |                 |
53 ;   |                 |       |         | 7               |                 |
54 ;   |                 |       |         v                 |                 |
55 ;   |                 |       |       +----------------+  |                 |
56 ;   |                 |       +-----> | b7 [12 bytes]  |  |                 |
57 ;   |                 |               +----------------+  |                 |
58 ;   |                 |                 |                 |                 |
59 ;   |                 | 958,119,305     | 1,636           |                 |
60 ;   |                 |                 v                 v                 v
61 ;   |                 |               +------------------------------------------+
62 ;   |                 +-------------> |                                          |
63 ;   |       1,532,990,889             |                  b1 [36 bytes]           |
64 ;   +-------------------------------> |                                          |
65 ;                                     +------------------------------------------+
67 ; An expected output with a large chain-split-threshold -- the layout score is
68 ; increased by ~17%
70 ; CHECK-LABEL: Applying ext-tsp layout
71 ; CHECK:   original  layout score: 9171074274.27
72 ; CHECK:   optimized layout score: 10844307310.87
73 ; CHECK: b0
74 ; CHECK: b2
75 ; CHECK: b3
76 ; CHECK: b4
77 ; CHECK: b5
78 ; CHECK: b8
79 ; CHECK: b1
80 ; CHECK: b6
81 ; CHECK: b7
82 ; CHECK: b9
84 ; An expected output with chain-split-threshold=1 (disabling splitting) -- the
85 ; increase of the layout score is smaller, ~7%:
87 ; CHECK2-LABEL: Applying ext-tsp layout
88 ; CHECK2:   original  layout score: 9171074274.27
89 ; CHECK2:   optimized layout score: 9810644873.57
90 ; CHECK2: b0
91 ; CHECK2: b2
92 ; CHECK2: b3
93 ; CHECK2: b4
94 ; CHECK2: b5
95 ; CHECK2: b1
96 ; CHECK2: b8
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
116   %0 = load i32, ptr @yydebug, align 4
117   %cmp = icmp ne i32 %0, 0
118   call void @a()
119   call void @a()
120   call void @a()
121   call void @a()
122   call void @a()
123   call void @a()
124   call void @a()
125   call void @a()
126   call void @a()
127   call void @a()
128   call void @a()
129   call void @a()
130   call void @a()
131   call void @a()
132   call void @a()
133   call void @a()
134   call void @a()
135   call void @a()
136   br i1 %cmp, label %b1, label %b2, !prof !1
138   call void @b()
139   call void @b()
140   call void @b()
141   call void @b()
142   call void @b()
143   call void @b()
144   call void @b()
145   call void @b()
146   ret void
148   call void @c()
149   call void @c()
150   call void @c()
151   call void @c()
152   call void @c()
153   call void @c()
154   call void @c()
155   call void @c()
156   call void @c()
157   call void @c()
158   br i1 %cmp, label %b3, label %b8, !prof !2
160   call void @d()
161   call void @d()
162   br i1 %cmp, label %b4, label %b8, !prof !3
164   call void @e()
165   call void @e()
166   br i1 %cmp, label %b5, label %b1, !prof !4
168   call void @f()
169   call void @f()
170   call void @f()
171   call void @f()
172   call void @f()
173   call void @f()
174   call void @f()
175   call void @f()
176   call void @f()
177   call void @f()
178   call void @f()
179   call void @f()
180   call void @f()
181   call void @f()
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   br i1 %cmp, label %b1, label %b6, !prof !5
198   call void @g()
199   call void @g()
200   call void @g()
201   call void @g()
202   call void @g()
203   call void @g()
204   call void @g()
205   br i1 %cmp, label %b7, label %b9, !prof !6
207   call void @h()
208   call void @h()
209   br label %b1
211   call void @i()
212   call void @i()
213   call void @i()
214   call void @i()
215   call void @i()
216   call void @i()
217   call void @i()
218   call void @i()
219   call void @i()
220   call void @i()
221   call void @i()
222   call void @i()
223   call void @i()
224   call void @i()
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   br label %b1
273   call void @j()
274   call void @j()
275   call void @j()
276   br label %b7
280 declare void @a()
281 declare void @b()
282 declare void @c()
283 declare void @d()
284 declare void @e()
285 declare void @f()
286 declare void @g()
287 declare void @h()
288 declare void @i()
289 declare void @j()
291 !0 = !{!"function_entry_count", i64 6131963556}
292 !1 = !{!"branch_weights", i32 3065981778, i32 3065981778}
293 !2 = !{!"branch_weights", i32 2299486333, i32 766495444}
294 !3 = !{!"branch_weights", i32 1532990888, i32 766495444}
295 !4 = !{!"branch_weights", i32 574871583, i32 958119305}
296 !5 = !{!"branch_weights", i32 574869946, i32 1636}
297 !6 = !{!"branch_weights", i32 1628, i32 7}