1 ; RUN: opt -S -passes=verify,iroutliner -o /dev/null \
2 ; RUN: -pass-remarks=iroutliner -pass-remarks-missed=iroutliner < %s \
3 ; RUN: 2>&1 | FileCheck -check-prefix=CHECK %s
4 ; RUN: opt -S -passes=verify,iroutliner -o /dev/null \
5 ; RUN: -pass-remarks-output=%t < %s
6 ; RUN: cat %t | FileCheck -check-prefix=YAML %s
8 ; CHECK: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
9 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 4 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
10 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 0 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
11 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
12 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 1 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
13 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 11 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
14 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 12 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
15 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 2 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
16 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 3 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
17 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 13 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
18 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 4 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
19 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 14 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
20 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 5 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
21 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
22 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 11 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
23 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 6 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
24 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 7 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
25 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 17 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
26 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 13 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
27 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 8 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
28 ; CHECK-NEXT: remark: <unknown>:0:0: outlined 2 regions with decrease of 2 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
31 ; YAML-NEXT: Pass: iroutliner
32 ; YAML-NEXT: Name: WouldNotDecreaseSize
33 ; YAML-NEXT: Function: function3
35 ; YAML-NEXT: - String: 'did not outline '
36 ; YAML-NEXT: - String: '2'
37 ; YAML-NEXT: - String: ' regions due to estimated increase of '
38 ; YAML-NEXT: - InstructionIncrease: '10'
39 ; YAML-NEXT: - String: ' instructions at locations '
40 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
41 ; YAML-NEXT: - String: ' '
42 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
44 ; YAML-NEXT: --- !Missed
45 ; YAML-NEXT: Pass: iroutliner
46 ; YAML-NEXT: Name: WouldNotDecreaseSize
47 ; YAML-NEXT: Function: function3
49 ; YAML-NEXT: - String: 'did not outline '
50 ; YAML-NEXT: - String: '2'
51 ; YAML-NEXT: - String: ' regions due to estimated increase of '
52 ; YAML-NEXT: - InstructionIncrease: '4'
53 ; YAML-NEXT: - String: ' instructions at locations '
54 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
55 ; YAML-NEXT: - String: ' '
56 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
58 ; YAML-NEXT: --- !Missed
59 ; YAML-NEXT: Pass: iroutliner
60 ; YAML-NEXT: Name: WouldNotDecreaseSize
61 ; YAML-NEXT: Function: function3
63 ; YAML-NEXT: - String: 'did not outline '
64 ; YAML-NEXT: - String: '2'
65 ; YAML-NEXT: - String: ' regions due to estimated increase of '
66 ; YAML-NEXT: - InstructionIncrease: '0'
67 ; YAML-NEXT: - String: ' instructions at locations '
68 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
69 ; YAML-NEXT: - String: ' '
70 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
72 ; YAML-NEXT: --- !Missed
73 ; YAML-NEXT: Pass: iroutliner
74 ; YAML-NEXT: Name: WouldNotDecreaseSize
75 ; YAML-NEXT: Function: function1
77 ; YAML-NEXT: - String: 'did not outline '
78 ; YAML-NEXT: - String: '2'
79 ; YAML-NEXT: - String: ' regions due to estimated increase of '
80 ; YAML-NEXT: - InstructionIncrease: '10'
81 ; YAML-NEXT: - String: ' instructions at locations '
82 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
83 ; YAML-NEXT: - String: ' '
84 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
86 ; YAML-NEXT: --- !Missed
87 ; YAML-NEXT: Pass: iroutliner
88 ; YAML-NEXT: Name: WouldNotDecreaseSize
89 ; YAML-NEXT: Function: function3
91 ; YAML-NEXT: - String: 'did not outline '
92 ; YAML-NEXT: - String: '2'
93 ; YAML-NEXT: - String: ' regions due to estimated increase of '
94 ; YAML-NEXT: - InstructionIncrease: '1'
95 ; YAML-NEXT: - String: ' instructions at locations '
96 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
97 ; YAML-NEXT: - String: ' '
98 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
100 ; YAML-NEXT: --- !Missed
101 ; YAML-NEXT: Pass: iroutliner
102 ; YAML-NEXT: Name: WouldNotDecreaseSize
103 ; YAML-NEXT: Function: function1
105 ; YAML-NEXT: - String: 'did not outline '
106 ; YAML-NEXT: - String: '2'
107 ; YAML-NEXT: - String: ' regions due to estimated increase of '
108 ; YAML-NEXT: - InstructionIncrease: '11'
109 ; YAML-NEXT: - String: ' instructions at locations '
110 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
111 ; YAML-NEXT: - String: ' '
112 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
114 ; YAML-NEXT: --- !Missed
115 ; YAML-NEXT: Pass: iroutliner
116 ; YAML-NEXT: Name: WouldNotDecreaseSize
117 ; YAML-NEXT: Function: function1
119 ; YAML-NEXT: - String: 'did not outline '
120 ; YAML-NEXT: - String: '2'
121 ; YAML-NEXT: - String: ' regions due to estimated increase of '
122 ; YAML-NEXT: - InstructionIncrease: '12'
123 ; YAML-NEXT: - String: ' instructions at locations '
124 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
125 ; YAML-NEXT: - String: ' '
126 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
128 ; YAML-NEXT: --- !Missed
129 ; YAML-NEXT: Pass: iroutliner
130 ; YAML-NEXT: Name: WouldNotDecreaseSize
131 ; YAML-NEXT: Function: function3
133 ; YAML-NEXT: - String: 'did not outline '
134 ; YAML-NEXT: - String: '2'
135 ; YAML-NEXT: - String: ' regions due to estimated increase of '
136 ; YAML-NEXT: - InstructionIncrease: '2'
137 ; YAML-NEXT: - String: ' instructions at locations '
138 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
139 ; YAML-NEXT: - String: ' '
140 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
142 ; YAML-NEXT: --- !Missed
143 ; YAML-NEXT: Pass: iroutliner
144 ; YAML-NEXT: Name: WouldNotDecreaseSize
145 ; YAML-NEXT: Function: function3
147 ; YAML-NEXT: - String: 'did not outline '
148 ; YAML-NEXT: - String: '2'
149 ; YAML-NEXT: - String: ' regions due to estimated increase of '
150 ; YAML-NEXT: - InstructionIncrease: '3'
151 ; YAML-NEXT: - String: ' instructions at locations '
152 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
153 ; YAML-NEXT: - String: ' '
154 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
156 ; YAML-NEXT: --- !Missed
157 ; YAML-NEXT: Pass: iroutliner
158 ; YAML-NEXT: Name: WouldNotDecreaseSize
159 ; YAML-NEXT: Function: function1
161 ; YAML-NEXT: - String: 'did not outline '
162 ; YAML-NEXT: - String: '2'
163 ; YAML-NEXT: - String: ' regions due to estimated increase of '
164 ; YAML-NEXT: - InstructionIncrease: '13'
165 ; YAML-NEXT: - String: ' instructions at locations '
166 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
167 ; YAML-NEXT: - String: ' '
168 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
170 ; YAML-NEXT: --- !Missed
171 ; YAML-NEXT: Pass: iroutliner
172 ; YAML-NEXT: Name: WouldNotDecreaseSize
173 ; YAML-NEXT: Function: function3
175 ; YAML-NEXT: - String: 'did not outline '
176 ; YAML-NEXT: - String: '2'
177 ; YAML-NEXT: - String: ' regions due to estimated increase of '
178 ; YAML-NEXT: - InstructionIncrease: '4'
179 ; YAML-NEXT: - String: ' instructions at locations '
180 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
181 ; YAML-NEXT: - String: ' '
182 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
184 ; YAML-NEXT: --- !Missed
185 ; YAML-NEXT: Pass: iroutliner
186 ; YAML-NEXT: Name: WouldNotDecreaseSize
187 ; YAML-NEXT: Function: function1
189 ; YAML-NEXT: - String: 'did not outline '
190 ; YAML-NEXT: - String: '2'
191 ; YAML-NEXT: - String: ' regions due to estimated increase of '
192 ; YAML-NEXT: - InstructionIncrease: '14'
193 ; YAML-NEXT: - String: ' instructions at locations '
194 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
195 ; YAML-NEXT: - String: ' '
196 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
198 ; YAML-NEXT: --- !Missed
199 ; YAML-NEXT: Pass: iroutliner
200 ; YAML-NEXT: Name: WouldNotDecreaseSize
201 ; YAML-NEXT: Function: function3
203 ; YAML-NEXT: - String: 'did not outline '
204 ; YAML-NEXT: - String: '2'
205 ; YAML-NEXT: - String: ' regions due to estimated increase of '
206 ; YAML-NEXT: - InstructionIncrease: '5'
207 ; YAML-NEXT: - String: ' instructions at locations '
208 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
209 ; YAML-NEXT: - String: ' '
210 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
212 ; YAML-NEXT: --- !Missed
213 ; YAML-NEXT: Pass: iroutliner
214 ; YAML-NEXT: Name: WouldNotDecreaseSize
215 ; YAML-NEXT: Function: function1
217 ; YAML-NEXT: - String: 'did not outline '
218 ; YAML-NEXT: - String: '2'
219 ; YAML-NEXT: - String: ' regions due to estimated increase of '
220 ; YAML-NEXT: - InstructionIncrease: '10'
221 ; YAML-NEXT: - String: ' instructions at locations '
222 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
223 ; YAML-NEXT: - String: ' '
224 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
226 ; YAML-NEXT: --- !Missed
227 ; YAML-NEXT: Pass: iroutliner
228 ; YAML-NEXT: Name: WouldNotDecreaseSize
229 ; YAML-NEXT: Function: function1
231 ; YAML-NEXT: - String: 'did not outline '
232 ; YAML-NEXT: - String: '2'
233 ; YAML-NEXT: - String: ' regions due to estimated increase of '
234 ; YAML-NEXT: - InstructionIncrease: '11'
235 ; YAML-NEXT: - String: ' instructions at locations '
236 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
237 ; YAML-NEXT: - String: ' '
238 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
240 ; YAML-NEXT: --- !Missed
241 ; YAML-NEXT: Pass: iroutliner
242 ; YAML-NEXT: Name: WouldNotDecreaseSize
243 ; YAML-NEXT: Function: function3
245 ; YAML-NEXT: - String: 'did not outline '
246 ; YAML-NEXT: - String: '2'
247 ; YAML-NEXT: - String: ' regions due to estimated increase of '
248 ; YAML-NEXT: - InstructionIncrease: '6'
249 ; YAML-NEXT: - String: ' instructions at locations '
250 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
251 ; YAML-NEXT: - String: ' '
252 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
254 ; YAML-NEXT: --- !Missed
255 ; YAML-NEXT: Pass: iroutliner
256 ; YAML-NEXT: Name: WouldNotDecreaseSize
257 ; YAML-NEXT: Function: function3
259 ; YAML-NEXT: - String: 'did not outline '
260 ; YAML-NEXT: - String: '2'
261 ; YAML-NEXT: - String: ' regions due to estimated increase of '
262 ; YAML-NEXT: - InstructionIncrease: '7'
263 ; YAML-NEXT: - String: ' instructions at locations '
264 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
265 ; YAML-NEXT: - String: ' '
266 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
268 ; YAML-NEXT: --- !Missed
269 ; YAML-NEXT: Pass: iroutliner
270 ; YAML-NEXT: Name: WouldNotDecreaseSize
271 ; YAML-NEXT: Function: function1
273 ; YAML-NEXT: - String: 'did not outline '
274 ; YAML-NEXT: - String: '2'
275 ; YAML-NEXT: - String: ' regions due to estimated increase of '
276 ; YAML-NEXT: - InstructionIncrease: '17'
277 ; YAML-NEXT: - String: ' instructions at locations '
278 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
279 ; YAML-NEXT: - String: ' '
280 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
282 ; YAML-NEXT: --- !Missed
283 ; YAML-NEXT: Pass: iroutliner
284 ; YAML-NEXT: Name: WouldNotDecreaseSize
285 ; YAML-NEXT: Function: function1
287 ; YAML-NEXT: - String: 'did not outline '
288 ; YAML-NEXT: - String: '2'
289 ; YAML-NEXT: - String: ' regions due to estimated increase of '
290 ; YAML-NEXT: - InstructionIncrease: '13'
291 ; YAML-NEXT: - String: ' instructions at locations '
292 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
293 ; YAML-NEXT: - String: ' '
294 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
296 ; YAML-NEXT: --- !Missed
297 ; YAML-NEXT: Pass: iroutliner
298 ; YAML-NEXT: Name: WouldNotDecreaseSize
299 ; YAML-NEXT: Function: function3
301 ; YAML-NEXT: - String: 'did not outline '
302 ; YAML-NEXT: - String: '2'
303 ; YAML-NEXT: - String: ' regions due to estimated increase of '
304 ; YAML-NEXT: - InstructionIncrease: '8'
305 ; YAML-NEXT: - String: ' instructions at locations '
306 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
307 ; YAML-NEXT: - String: ' '
308 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
310 ; YAML-NEXT: --- !Passed
311 ; YAML-NEXT: Pass: iroutliner
312 ; YAML-NEXT: Name: Outlined
313 ; YAML-NEXT: Function: function3.outlined
315 ; YAML-NEXT: - String: 'outlined '
316 ; YAML-NEXT: - String: '2'
317 ; YAML-NEXT: - String: ' regions with decrease of '
318 ; YAML-NEXT: - Benefit: '2'
319 ; YAML-NEXT: - String: ' instructions at locations '
320 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
321 ; YAML-NEXT: - String: ' '
322 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
325 define void @function1() #0 {
327 %a = alloca i32, align 4
328 %b = alloca i32, align 4
329 %output = alloca i32, align 4
330 %result = alloca i32, align 4
331 store i32 2, ptr %a, align 4
332 store i32 3, ptr %b, align 4
333 %0 = load i32, ptr %a, align 4
334 %1 = load i32, ptr %b, align 4
335 %add = add i32 %0, %1
336 store i32 %add, ptr %output, align 4
337 %2 = load i32, ptr %output, align 4
338 %3 = load i32, ptr %output, align 4
339 %mul = mul i32 %2, %add
340 store i32 %mul, ptr %result, align 4
344 define void @function2() #0 {
346 %a = alloca i32, align 4
347 %b = alloca i32, align 4
348 %output = alloca i32, align 4
349 %result = alloca i32, align 4
350 store i32 2, ptr %a, align 4
351 store i32 3, ptr %b, align 4
352 %0 = load i32, ptr %a, align 4
353 %1 = load i32, ptr %b, align 4
354 %add = add i32 %0, %1
355 store i32 %add, ptr %output, align 4
356 %2 = load i32, ptr %output, align 4
357 %3 = load i32, ptr %output, align 4
358 %mul = mul i32 %2, %add
359 store i32 %mul, ptr %result, align 4
363 define void @function3() #0 {
365 %a = alloca i32, align 4
366 %b = alloca i32, align 4
367 %0 = load i32, ptr %a, align 4
368 %1 = load i32, ptr %b, align 4
369 %add = add i32 %0, %1
370 %mul = mul i32 %0, %1
371 %sub = sub i32 %0, %1
372 %div = sdiv i32 %0, %1
373 %add1 = add i32 %0, %1
374 %mul1 = mul i32 %0, %1
375 %sub1 = sub i32 %0, %1
376 %div1 = sdiv i32 %0, %1
377 %add2 = add i32 %0, %1
378 %mul2 = mul i32 %0, %1
379 %sub2 = sub i32 %0, %1
380 %div2 = sdiv i32 %0, %1
381 %mul3 = mul i32 %0, %1
385 define void @function4() #0 {
387 %a = alloca i32, align 4
388 %b = alloca i32, align 4
389 %0 = load i32, ptr %a, align 4
390 %1 = load i32, ptr %b, align 4
391 %add = add i32 %0, %1
392 %mul = mul i32 %0, %1
393 %sub = sub i32 %0, %1
394 %div = sdiv i32 %0, %1
395 %add1 = add i32 %0, %1
396 %mul1 = mul i32 %0, %1
397 %sub1 = sub i32 %0, %1
398 %div1 = sdiv i32 %0, %1
399 %add2 = add i32 %0, %1
400 %mul2 = mul i32 %0, %1
401 %sub2 = sub i32 %0, %1
402 %div2 = sdiv i32 %0, %1
403 %div3 = sdiv i32 %0, %1