1 ; RUN: opt -S -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 -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 12 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
9 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 5 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
10 ; CHECK-NEXT: remark: <unknown>:0:0: outlined 2 regions with decrease of 2 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 11 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
13 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 12 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
14 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 13 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
15 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 14 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
16 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
17 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 11 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
18 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 17 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
19 ; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 13 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>
22 ; YAML-NEXT: Pass: iroutliner
23 ; YAML-NEXT: Name: WouldNotDecreaseSize
24 ; YAML-NEXT: Function: function3
26 ; YAML-NEXT: - String: 'did not outline '
27 ; YAML-NEXT: - String: '2'
28 ; YAML-NEXT: - String: ' regions due to estimated increase of '
29 ; YAML-NEXT: - InstructionIncrease: '12'
30 ; YAML-NEXT: - String: ' instructions at locations '
31 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
32 ; YAML-NEXT: - String: ' '
33 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
35 ; YAML-NEXT: --- !Missed
36 ; YAML-NEXT: Pass: iroutliner
37 ; YAML-NEXT: Name: WouldNotDecreaseSize
38 ; YAML-NEXT: Function: function3
40 ; YAML-NEXT: - String: 'did not outline '
41 ; YAML-NEXT: - String: '2'
42 ; YAML-NEXT: - String: ' regions due to estimated increase of '
43 ; YAML-NEXT: - InstructionIncrease: '5'
44 ; YAML-NEXT: - String: ' instructions at locations '
45 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
46 ; YAML-NEXT: - String: ' '
47 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
49 ; YAML-NEXT: --- !Passed
50 ; YAML-NEXT: Pass: iroutliner
51 ; YAML-NEXT: Name: Outlined
52 ; YAML-NEXT: Function: function3.outlined
54 ; YAML-NEXT: - String: 'outlined '
55 ; YAML-NEXT: - String: '2'
56 ; YAML-NEXT: - String: ' regions with decrease of '
57 ; YAML-NEXT: - Benefit: '2'
58 ; YAML-NEXT: - String: ' instructions at locations '
59 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
60 ; YAML-NEXT: - String: ' '
61 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
63 ; YAML-NEXT: --- !Missed
64 ; YAML-NEXT: Pass: iroutliner
65 ; YAML-NEXT: Name: WouldNotDecreaseSize
66 ; YAML-NEXT: Function: function1
68 ; YAML-NEXT: - String: 'did not outline '
69 ; YAML-NEXT: - String: '2'
70 ; YAML-NEXT: - String: ' regions due to estimated increase of '
71 ; YAML-NEXT: - InstructionIncrease: '10'
72 ; YAML-NEXT: - String: ' instructions at locations '
73 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
74 ; YAML-NEXT: - String: ' '
75 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
77 ; YAML-NEXT: --- !Missed
78 ; YAML-NEXT: Pass: iroutliner
79 ; YAML-NEXT: Name: WouldNotDecreaseSize
80 ; YAML-NEXT: Function: function1
82 ; YAML-NEXT: - String: 'did not outline '
83 ; YAML-NEXT: - String: '2'
84 ; YAML-NEXT: - String: ' regions due to estimated increase of '
85 ; YAML-NEXT: - InstructionIncrease: '11'
86 ; YAML-NEXT: - String: ' instructions at locations '
87 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
88 ; YAML-NEXT: - String: ' '
89 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
91 ; YAML-NEXT: --- !Missed
92 ; YAML-NEXT: Pass: iroutliner
93 ; YAML-NEXT: Name: WouldNotDecreaseSize
94 ; YAML-NEXT: Function: function1
96 ; YAML-NEXT: - String: 'did not outline '
97 ; YAML-NEXT: - String: '2'
98 ; YAML-NEXT: - String: ' regions due to estimated increase of '
99 ; YAML-NEXT: - InstructionIncrease: '12'
100 ; YAML-NEXT: - String: ' instructions at locations '
101 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
102 ; YAML-NEXT: - String: ' '
103 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
105 ; YAML-NEXT: --- !Missed
106 ; YAML-NEXT: Pass: iroutliner
107 ; YAML-NEXT: Name: WouldNotDecreaseSize
108 ; YAML-NEXT: Function: function1
110 ; YAML-NEXT: - String: 'did not outline '
111 ; YAML-NEXT: - String: '2'
112 ; YAML-NEXT: - String: ' regions due to estimated increase of '
113 ; YAML-NEXT: - InstructionIncrease: '13'
114 ; YAML-NEXT: - String: ' instructions at locations '
115 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
116 ; YAML-NEXT: - String: ' '
117 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
119 ; YAML-NEXT: --- !Missed
120 ; YAML-NEXT: Pass: iroutliner
121 ; YAML-NEXT: Name: WouldNotDecreaseSize
122 ; YAML-NEXT: Function: function1
124 ; YAML-NEXT: - String: 'did not outline '
125 ; YAML-NEXT: - String: '2'
126 ; YAML-NEXT: - String: ' regions due to estimated increase of '
127 ; YAML-NEXT: - InstructionIncrease: '14'
128 ; YAML-NEXT: - String: ' instructions at locations '
129 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
130 ; YAML-NEXT: - String: ' '
131 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
133 ; YAML-NEXT: --- !Missed
134 ; YAML-NEXT: Pass: iroutliner
135 ; YAML-NEXT: Name: WouldNotDecreaseSize
136 ; YAML-NEXT: Function: function1
138 ; YAML-NEXT: - String: 'did not outline '
139 ; YAML-NEXT: - String: '2'
140 ; YAML-NEXT: - String: ' regions due to estimated increase of '
141 ; YAML-NEXT: - InstructionIncrease: '10'
142 ; YAML-NEXT: - String: ' instructions at locations '
143 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
144 ; YAML-NEXT: - String: ' '
145 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
147 ; YAML-NEXT: --- !Missed
148 ; YAML-NEXT: Pass: iroutliner
149 ; YAML-NEXT: Name: WouldNotDecreaseSize
150 ; YAML-NEXT: Function: function1
152 ; YAML-NEXT: - String: 'did not outline '
153 ; YAML-NEXT: - String: '2'
154 ; YAML-NEXT: - String: ' regions due to estimated increase of '
155 ; YAML-NEXT: - InstructionIncrease: '11'
156 ; YAML-NEXT: - String: ' instructions at locations '
157 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
158 ; YAML-NEXT: - String: ' '
159 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
161 ; YAML-NEXT: --- !Missed
162 ; YAML-NEXT: Pass: iroutliner
163 ; YAML-NEXT: Name: WouldNotDecreaseSize
164 ; YAML-NEXT: Function: function1
166 ; YAML-NEXT: - String: 'did not outline '
167 ; YAML-NEXT: - String: '2'
168 ; YAML-NEXT: - String: ' regions due to estimated increase of '
169 ; YAML-NEXT: - InstructionIncrease: '17'
170 ; YAML-NEXT: - String: ' instructions at locations '
171 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
172 ; YAML-NEXT: - String: ' '
173 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
175 ; YAML-NEXT: --- !Missed
176 ; YAML-NEXT: Pass: iroutliner
177 ; YAML-NEXT: Name: WouldNotDecreaseSize
178 ; YAML-NEXT: Function: function1
180 ; YAML-NEXT: - String: 'did not outline '
181 ; YAML-NEXT: - String: '2'
182 ; YAML-NEXT: - String: ' regions due to estimated increase of '
183 ; YAML-NEXT: - InstructionIncrease: '13'
184 ; YAML-NEXT: - String: ' instructions at locations '
185 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
186 ; YAML-NEXT: - String: ' '
187 ; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'
190 define void @function1() #0 {
192 %a = alloca i32, align 4
193 %b = alloca i32, align 4
194 %output = alloca i32, align 4
195 %result = alloca i32, align 4
196 store i32 2, i32* %a, align 4
197 store i32 3, i32* %b, align 4
198 %0 = load i32, i32* %a, align 4
199 %1 = load i32, i32* %b, align 4
200 %add = add i32 %0, %1
201 store i32 %add, i32* %output, align 4
202 %2 = load i32, i32* %output, align 4
203 %3 = load i32, i32* %output, align 4
204 %mul = mul i32 %2, %add
205 store i32 %mul, i32* %result, align 4
209 define void @function2() #0 {
211 %a = alloca i32, align 4
212 %b = alloca i32, align 4
213 %output = alloca i32, align 4
214 %result = alloca i32, align 4
215 store i32 2, i32* %a, align 4
216 store i32 3, i32* %b, align 4
217 %0 = load i32, i32* %a, align 4
218 %1 = load i32, i32* %b, align 4
219 %add = add i32 %0, %1
220 store i32 %add, i32* %output, align 4
221 %2 = load i32, i32* %output, align 4
222 %3 = load i32, i32* %output, align 4
223 %mul = mul i32 %2, %add
224 store i32 %mul, i32* %result, align 4
228 define void @function3() #0 {
230 %a = alloca i32, align 4
231 %b = alloca i32, align 4
232 %0 = load i32, i32* %a, align 4
233 %1 = load i32, i32* %b, align 4
234 %add = add i32 %0, %1
235 %mul = mul i32 %0, %1
236 %sub = sub i32 %0, %1
237 %div = sdiv i32 %0, %1
238 %add1 = add i32 %0, %1
239 %mul1 = mul i32 %0, %1
240 %sub1 = sub i32 %0, %1
241 %div1 = sdiv i32 %0, %1
242 %add2 = add i32 %0, %1
243 %mul2 = mul i32 %0, %1
244 %sub2 = sub i32 %0, %1
245 %div2 = sdiv i32 %0, %1
246 %mul3 = mul i32 %0, %1
250 define void @function4() #0 {
252 %a = alloca i32, align 4
253 %b = alloca i32, align 4
254 %0 = load i32, i32* %a, align 4
255 %1 = load i32, i32* %b, align 4
256 %add = add i32 %0, %1
257 %mul = mul i32 %0, %1
258 %sub = sub i32 %0, %1
259 %div = sdiv i32 %0, %1
260 %add1 = add i32 %0, %1
261 %mul1 = mul i32 %0, %1
262 %sub1 = sub i32 %0, %1
263 %div1 = sdiv i32 %0, %1
264 %add2 = add i32 %0, %1
265 %mul2 = mul i32 %0, %1
266 %sub2 = sub i32 %0, %1
267 %div2 = sdiv i32 %0, %1
268 %div3 = sdiv i32 %0, %1