1 // Test instrumentation of general constructs in C.
2
3 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instr-generate | FileCheck -check-prefix=PGOGEN %s
4
5 // RUN: llvm-profdata merge %S/Inputs/c-general.proftext -o %t.profdata
6 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name c-general.c %s -o - -emit-llvm -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE %s
7
8 // PGOGEN: @[[SLC:__llvm_profile_counters_simple_loops]] = hidden global [4 x i64] zeroinitializer
9 // PGOGEN: @[[IFC:__llvm_profile_counters_conditionals]] = hidden global [11 x i64] zeroinitializer
10 // PGOGEN: @[[EEC:__llvm_profile_counters_early_exits]] = hidden global [9 x i64] zeroinitializer
11 // PGOGEN: @[[JMC:__llvm_profile_counters_jumps]] = hidden global [22 x i64] zeroinitializer
12 // PGOGEN: @[[SWC:__llvm_profile_counters_switches]] = hidden global [19 x i64] zeroinitializer
13 // PGOGEN: @[[BSC:__llvm_profile_counters_big_switch]] = hidden global [17 x i64] zeroinitializer
14 // PGOGEN: @[[BOC:__llvm_profile_counters_boolean_operators]] = hidden global [8 x i64] zeroinitializer
15 // PGOGEN: @[[BLC:__llvm_profile_counters_boolop_loops]] = hidden global [9 x i64] zeroinitializer
16 // PGOGEN: @[[COC:__llvm_profile_counters_conditional_operator]] = hidden global [3 x i64] zeroinitializer
17 // PGOGEN: @[[MAC:__llvm_profile_counters_main]] = hidden global [1 x i64] zeroinitializer
18 // PGOGEN: @[[STC:__llvm_profile_counters_static_func]] = internal global [2 x i64] zeroinitializer
19
20 // PGOGEN-LABEL: @simple_loops()
21 // PGOUSE-LABEL: @simple_loops()
22 // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 0
simple_loops()23 void simple_loops() {
24 int i;
25 // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 1
26 // PGOUSE: br {{.*}} !prof ![[SL1:[0-9]+]]
27 for (i = 0; i < 100; ++i) {
28 }
29 // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 2
30 // PGOUSE: br {{.*}} !prof ![[SL2:[0-9]+]]
31 while (i > 0)
32 i--;
33 // PGOGEN: store {{.*}} @[[SLC]], i64 0, i64 3
34 // PGOUSE: br {{.*}} !prof ![[SL3:[0-9]+]]
35 do {} while (i++ < 75);
36
37 // PGOGEN-NOT: store {{.*}} @[[SLC]],
38 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
39 }
40
41 // PGOGEN-LABEL: @conditionals()
42 // PGOUSE-LABEL: @conditionals()
43 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 0
conditionals()44 void conditionals() {
45 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 1
46 // PGOUSE: br {{.*}} !prof ![[IF1:[0-9]+]]
47 for (int i = 0; i < 100; ++i) {
48 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 2
49 // PGOUSE: br {{.*}} !prof ![[IF2:[0-9]+]]
50 if (i % 2) {
51 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 3
52 // PGOUSE: br {{.*}} !prof ![[IF3:[0-9]+]]
53 if (i) {}
54 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 4
55 // PGOUSE: br {{.*}} !prof ![[IF4:[0-9]+]]
56 } else if (i % 3) {
57 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 5
58 // PGOUSE: br {{.*}} !prof ![[IF5:[0-9]+]]
59 if (i) {}
60 } else {
61 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 6
62 // PGOUSE: br {{.*}} !prof ![[IF6:[0-9]+]]
63 if (i) {}
64 }
65
66 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 8
67 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 7
68 // PGOUSE: br {{.*}} !prof ![[IF7:[0-9]+]]
69 if (1 && i) {}
70 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 10
71 // PGOGEN: store {{.*}} @[[IFC]], i64 0, i64 9
72 // PGOUSE: br {{.*}} !prof ![[IF8:[0-9]+]]
73 if (0 || i) {}
74 }
75
76 // PGOGEN-NOT: store {{.*}} @[[IFC]],
77 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
78 }
79
80 // PGOGEN-LABEL: @early_exits()
81 // PGOUSE-LABEL: @early_exits()
82 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 0
early_exits()83 void early_exits() {
84 int i = 0;
85
86 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 1
87 // PGOUSE: br {{.*}} !prof ![[EE1:[0-9]+]]
88 if (i) {}
89
90 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 2
91 // PGOUSE: br {{.*}} !prof ![[EE2:[0-9]+]]
92 while (i < 100) {
93 i++;
94 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 3
95 // PGOUSE: br {{.*}} !prof ![[EE3:[0-9]+]]
96 if (i > 50)
97 break;
98 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 4
99 // PGOUSE: br {{.*}} !prof ![[EE4:[0-9]+]]
100 if (i % 2)
101 continue;
102 }
103
104 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 5
105 // PGOUSE: br {{.*}} !prof ![[EE5:[0-9]+]]
106 if (i) {}
107
108 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 6
109 do {
110 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 7
111 // PGOUSE: br {{.*}} !prof ![[EE6:[0-9]+]]
112 if (i > 75)
113 return;
114 else
115 i++;
116 // PGOUSE: br {{.*}} !prof ![[EE7:[0-9]+]]
117 } while (i < 100);
118
119 // PGOGEN: store {{.*}} @[[EEC]], i64 0, i64 8
120 // Never reached -> no weights
121 if (i) {}
122
123 // PGOGEN-NOT: store {{.*}} @[[EEC]],
124 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
125 }
126
127 // PGOGEN-LABEL: @jumps()
128 // PGOUSE-LABEL: @jumps()
129 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 0
jumps()130 void jumps() {
131 int i;
132
133 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 1
134 // PGOUSE: br {{.*}} !prof ![[JM1:[0-9]+]]
135 for (i = 0; i < 2; ++i) {
136 goto outofloop;
137 // Never reached -> no weights
138 if (i) {}
139 }
140 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 3
141 outofloop:
142 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 4
143 // PGOUSE: br {{.*}} !prof ![[JM2:[0-9]+]]
144 if (i) {}
145
146 goto loop1;
147
148 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 5
149 // PGOUSE: br {{.*}} !prof ![[JM3:[0-9]+]]
150 while (i) {
151 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 6
152 loop1:
153 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 7
154 // PGOUSE: br {{.*}} !prof ![[JM4:[0-9]+]]
155 if (i) {}
156 }
157
158 goto loop2;
159 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 8
160 first:
161 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 9
162 second:
163 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 10
164 third:
165 i++;
166 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 11
167 // PGOUSE: br {{.*}} !prof ![[JM5:[0-9]+]]
168 if (i < 3)
169 goto loop2;
170
171 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 12
172 // PGOUSE: br {{.*}} !prof ![[JM6:[0-9]+]]
173 while (i < 3) {
174 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 13
175 loop2:
176 // PGOUSE: switch {{.*}} [
177 // PGOUSE: ], !prof ![[JM7:[0-9]+]]
178 switch (i) {
179 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 15
180 case 0:
181 goto first;
182 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 16
183 case 1:
184 goto second;
185 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 17
186 case 2:
187 goto third;
188 }
189 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 14
190 }
191
192 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 18
193 // PGOUSE: br {{.*}} !prof ![[JM8:[0-9]+]]
194 for (i = 0; i < 10; ++i) {
195 goto withinloop;
196 // never reached -> no weights
197 if (i) {}
198 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 20
199 withinloop:
200 // PGOGEN: store {{.*}} @[[JMC]], i64 0, i64 21
201 // PGOUSE: br {{.*}} !prof ![[JM9:[0-9]+]]
202 if (i) {}
203 }
204
205 // PGOGEN-NOT: store {{.*}} @[[JMC]],
206 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
207 }
208
209 // PGOGEN-LABEL: @switches()
210 // PGOUSE-LABEL: @switches()
211 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 0
switches()212 void switches() {
213 static int weights[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
214
215 // No cases -> no weights
216 switch (weights[0]) {
217 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 2
218 default:
219 break;
220 }
221 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 1
222
223 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 3
224 // PGOUSE: br {{.*}} !prof ![[SW1:[0-9]+]]
225 for (int i = 0, len = sizeof(weights) / sizeof(weights[0]); i < len; ++i) {
226 // PGOUSE: switch {{.*}} [
227 // PGOUSE: ], !prof ![[SW2:[0-9]+]]
228 switch (i[weights]) {
229 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 5
230 case 1:
231 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 6
232 // PGOUSE: br {{.*}} !prof ![[SW3:[0-9]+]]
233 if (i) {}
234 // fallthrough
235 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 7
236 case 2:
237 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 8
238 // PGOUSE: br {{.*}} !prof ![[SW4:[0-9]+]]
239 if (i) {}
240 break;
241 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 9
242 case 3:
243 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 10
244 // PGOUSE: br {{.*}} !prof ![[SW5:[0-9]+]]
245 if (i) {}
246 continue;
247 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 11
248 case 4:
249 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 12
250 // PGOUSE: br {{.*}} !prof ![[SW6:[0-9]+]]
251 if (i) {}
252 // PGOUSE: switch {{.*}} [
253 // PGOUSE: ], !prof ![[SW7:[0-9]+]]
254 switch (i) {
255 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 14
256 case 6 ... 9:
257 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 15
258 // PGOUSE: br {{.*}} !prof ![[SW8:[0-9]+]]
259 if (i) {}
260 continue;
261 }
262 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 13
263
264 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 16
265 default:
266 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 17
267 // PGOUSE: br {{.*}} !prof ![[SW9:[0-9]+]]
268 if (i == len - 1)
269 return;
270 }
271 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 4
272 }
273
274 // PGOGEN: store {{.*}} @[[SWC]], i64 0, i64 18
275 // Never reached -> no weights
276 if (weights[0]) {}
277
278 // PGOGEN-NOT: store {{.*}} @[[SWC]],
279 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
280 }
281
282 // PGOGEN-LABEL: @big_switch()
283 // PGOUSE-LABEL: @big_switch()
284 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 0
big_switch()285 void big_switch() {
286 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 1
287 // PGOUSE: br {{.*}} !prof ![[BS1:[0-9]+]]
288 for (int i = 0; i < 32; ++i) {
289 // PGOUSE: switch {{.*}} [
290 // PGOUSE: ], !prof ![[BS2:[0-9]+]]
291 switch (1 << i) {
292 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 3
293 case (1 << 0):
294 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 4
295 // PGOUSE: br {{.*}} !prof ![[BS3:[0-9]+]]
296 if (i) {}
297 // fallthrough
298 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 5
299 case (1 << 1):
300 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 6
301 // PGOUSE: br {{.*}} !prof ![[BS4:[0-9]+]]
302 if (i) {}
303 break;
304 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 7
305 case (1 << 2) ... (1 << 12):
306 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 8
307 // PGOUSE: br {{.*}} !prof ![[BS5:[0-9]+]]
308 if (i) {}
309 break;
310 // The branch for the large case range above appears after the case body
311 // PGOUSE: br {{.*}} !prof ![[BS6:[0-9]+]]
312
313 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 9
314 case (1 << 13):
315 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 10
316 // PGOUSE: br {{.*}} !prof ![[BS7:[0-9]+]]
317 if (i) {}
318 break;
319 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 11
320 case (1 << 14) ... (1 << 28):
321 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 12
322 // PGOUSE: br {{.*}} !prof ![[BS8:[0-9]+]]
323 if (i) {}
324 break;
325 // The branch for the large case range above appears after the case body
326 // PGOUSE: br {{.*}} !prof ![[BS9:[0-9]+]]
327
328 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 13
329 case (1 << 29) ... ((1 << 29) + 1):
330 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 14
331 // PGOUSE: br {{.*}} !prof ![[BS10:[0-9]+]]
332 if (i) {}
333 break;
334 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 15
335 default:
336 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 16
337 // PGOUSE: br {{.*}} !prof ![[BS11:[0-9]+]]
338 if (i) {}
339 break;
340 }
341 // PGOGEN: store {{.*}} @[[BSC]], i64 0, i64 2
342 }
343
344 // PGOGEN-NOT: store {{.*}} @[[BSC]],
345 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
346 // PGOUSE: ret void
347 }
348
349 // PGOGEN-LABEL: @boolean_operators()
350 // PGOUSE-LABEL: @boolean_operators()
351 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 0
boolean_operators()352 void boolean_operators() {
353 int v;
354 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 1
355 // PGOUSE: br {{.*}} !prof ![[BO1:[0-9]+]]
356 for (int i = 0; i < 100; ++i) {
357 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 2
358 // PGOUSE: br {{.*}} !prof ![[BO2:[0-9]+]]
359 v = i % 3 || i;
360
361 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 3
362 // PGOUSE: br {{.*}} !prof ![[BO3:[0-9]+]]
363 v = i % 3 && i;
364
365 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 5
366 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 4
367 // PGOUSE: br {{.*}} !prof ![[BO4:[0-9]+]]
368 // PGOUSE: br {{.*}} !prof ![[BO5:[0-9]+]]
369 v = i % 3 || i % 2 || i;
370
371 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 7
372 // PGOGEN: store {{.*}} @[[BOC]], i64 0, i64 6
373 // PGOUSE: br {{.*}} !prof ![[BO6:[0-9]+]]
374 // PGOUSE: br {{.*}} !prof ![[BO7:[0-9]+]]
375 v = i % 2 && i % 3 && i;
376 }
377
378 // PGOGEN-NOT: store {{.*}} @[[BOC]],
379 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
380 }
381
382 // PGOGEN-LABEL: @boolop_loops()
383 // PGOUSE-LABEL: @boolop_loops()
384 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 0
boolop_loops()385 void boolop_loops() {
386 int i = 100;
387
388 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 2
389 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 1
390 // PGOUSE: br {{.*}} !prof ![[BL1:[0-9]+]]
391 // PGOUSE: br {{.*}} !prof ![[BL2:[0-9]+]]
392 while (i && i > 50)
393 i--;
394
395 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 4
396 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 3
397 // PGOUSE: br {{.*}} !prof ![[BL3:[0-9]+]]
398 // PGOUSE: br {{.*}} !prof ![[BL4:[0-9]+]]
399 while ((i % 2) || (i > 0))
400 i--;
401
402 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 6
403 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 5
404 // PGOUSE: br {{.*}} !prof ![[BL5:[0-9]+]]
405 // PGOUSE: br {{.*}} !prof ![[BL6:[0-9]+]]
406 for (i = 100; i && i > 50; --i);
407
408 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 8
409 // PGOGEN: store {{.*}} @[[BLC]], i64 0, i64 7
410 // PGOUSE: br {{.*}} !prof ![[BL7:[0-9]+]]
411 // PGOUSE: br {{.*}} !prof ![[BL8:[0-9]+]]
412 for (; (i % 2) || (i > 0); --i);
413
414 // PGOGEN-NOT: store {{.*}} @[[BLC]],
415 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
416 }
417
418 // PGOGEN-LABEL: @conditional_operator()
419 // PGOUSE-LABEL: @conditional_operator()
420 // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 0
conditional_operator()421 void conditional_operator() {
422 int i = 100;
423
424 // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 1
425 // PGOUSE: br {{.*}} !prof ![[CO1:[0-9]+]]
426 int j = i < 50 ? i : 1;
427
428 // PGOGEN: store {{.*}} @[[COC]], i64 0, i64 2
429 // PGOUSE: br {{.*}} !prof ![[CO2:[0-9]+]]
430 int k = i ?: 0;
431
432 // PGOGEN-NOT: store {{.*}} @[[COC]],
433 // PGOUSE-NOT: br {{.*}} !prof ![0-9]+
434 }
435
do_fallthrough()436 void do_fallthrough() {
437 for (int i = 0; i < 10; ++i) {
438 int j = 0;
439 do {
440 // The number of exits out of this do-loop via the break statement
441 // exceeds the counter value for the loop (which does not include the
442 // fallthrough count). Make sure that does not violate any assertions.
443 if (i < 8) break;
444 j++;
445 } while (j < 2);
446 }
447 }
448
449 // PGOGEN-LABEL: @static_func()
450 // PGOUSE-LABEL: @static_func()
451 // PGOGEN: store {{.*}} @[[STC]], i64 0, i64 0
static_func()452 static void static_func() {
453 // PGOGEN: store {{.*}} @[[STC]], i64 0, i64 1
454 // PGOUSE: br {{.*}} !prof ![[ST1:[0-9]+]]
455 for (int i = 0; i < 10; ++i) {
456 }
457 }
458
459 // PGOUSE-DAG: ![[SL1]] = metadata !{metadata !"branch_weights", i32 101, i32 2}
460 // PGOUSE-DAG: ![[SL2]] = metadata !{metadata !"branch_weights", i32 101, i32 2}
461 // PGOUSE-DAG: ![[SL3]] = metadata !{metadata !"branch_weights", i32 76, i32 2}
462
463 // PGOUSE-DAG: ![[EE1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
464 // PGOUSE-DAG: ![[EE2]] = metadata !{metadata !"branch_weights", i32 52, i32 1}
465 // PGOUSE-DAG: ![[EE3]] = metadata !{metadata !"branch_weights", i32 2, i32 51}
466 // PGOUSE-DAG: ![[EE4]] = metadata !{metadata !"branch_weights", i32 26, i32 26}
467 // PGOUSE-DAG: ![[EE5]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
468 // PGOUSE-DAG: ![[EE6]] = metadata !{metadata !"branch_weights", i32 2, i32 26}
469 // PGOUSE-DAG: ![[EE7]] = metadata !{metadata !"branch_weights", i32 26, i32 1}
470
471 // PGOUSE-DAG: ![[IF1]] = metadata !{metadata !"branch_weights", i32 101, i32 2}
472 // PGOUSE-DAG: ![[IF2]] = metadata !{metadata !"branch_weights", i32 51, i32 51}
473 // PGOUSE-DAG: ![[IF3]] = metadata !{metadata !"branch_weights", i32 51, i32 1}
474 // PGOUSE-DAG: ![[IF4]] = metadata !{metadata !"branch_weights", i32 34, i32 18}
475 // PGOUSE-DAG: ![[IF5]] = metadata !{metadata !"branch_weights", i32 34, i32 1}
476 // PGOUSE-DAG: ![[IF6]] = metadata !{metadata !"branch_weights", i32 17, i32 2}
477 // PGOUSE-DAG: ![[IF7]] = metadata !{metadata !"branch_weights", i32 100, i32 2}
478 // PGOUSE-DAG: ![[IF8]] = metadata !{metadata !"branch_weights", i32 100, i32 2}
479
480 // PGOUSE-DAG: ![[JM1]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
481 // PGOUSE-DAG: ![[JM2]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
482 // PGOUSE-DAG: ![[JM3]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
483 // PGOUSE-DAG: ![[JM4]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
484 // PGOUSE-DAG: ![[JM5]] = metadata !{metadata !"branch_weights", i32 3, i32 2}
485 // PGOUSE-DAG: ![[JM6]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
486 // PGOUSE-DAG: ![[JM7]] = metadata !{metadata !"branch_weights", i32 1, i32 2, i32 2, i32 2}
487 // PGOUSE-DAG: ![[JM8]] = metadata !{metadata !"branch_weights", i32 11, i32 2}
488 // PGOUSE-DAG: ![[JM9]] = metadata !{metadata !"branch_weights", i32 10, i32 2}
489
490 // PGOUSE-DAG: ![[SW1]] = metadata !{metadata !"branch_weights", i32 16, i32 1}
491 // PGOUSE-DAG: ![[SW2]] = metadata !{metadata !"branch_weights", i32 6, i32 2, i32 3, i32 4, i32 5}
492 // PGOUSE-DAG: ![[SW3]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
493 // PGOUSE-DAG: ![[SW4]] = metadata !{metadata !"branch_weights", i32 3, i32 2}
494 // PGOUSE-DAG: ![[SW5]] = metadata !{metadata !"branch_weights", i32 4, i32 1}
495 // PGOUSE-DAG: ![[SW6]] = metadata !{metadata !"branch_weights", i32 5, i32 1}
496 // PGOUSE-DAG: ![[SW7]] = metadata !{metadata !"branch_weights", i32 1, i32 2, i32 2, i32 2, i32 2}
497 // PGOUSE-DAG: ![[SW8]] = metadata !{metadata !"branch_weights", i32 5, i32 1}
498 // PGOUSE-DAG: ![[SW9]] = metadata !{metadata !"branch_weights", i32 2, i32 5}
499
500 // PGOUSE-DAG: ![[BS1]] = metadata !{metadata !"branch_weights", i32 33, i32 2}
501 // PGOUSE-DAG: ![[BS2]] = metadata !{metadata !"branch_weights", i32 29, i32 2, i32 2, i32 2, i32 2, i32 1}
502 // PGOUSE-DAG: ![[BS3]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
503 // PGOUSE-DAG: ![[BS4]] = metadata !{metadata !"branch_weights", i32 2, i32 2}
504 // PGOUSE-DAG: ![[BS5]] = metadata !{metadata !"branch_weights", i32 12, i32 1}
505 // PGOUSE-DAG: ![[BS6]] = metadata !{metadata !"branch_weights", i32 12, i32 3}
506 // PGOUSE-DAG: ![[BS7]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
507 // PGOUSE-DAG: ![[BS8]] = metadata !{metadata !"branch_weights", i32 16, i32 1}
508 // PGOUSE-DAG: ![[BS9]] = metadata !{metadata !"branch_weights", i32 16, i32 14}
509 // PGOUSE-DAG: ![[BS10]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
510 // PGOUSE-DAG: ![[BS11]] = metadata !{metadata !"branch_weights", i32 3, i32 1}
511
512 // PGOUSE-DAG: ![[BO1]] = metadata !{metadata !"branch_weights", i32 101, i32 2}
513 // PGOUSE-DAG: ![[BO2]] = metadata !{metadata !"branch_weights", i32 67, i32 35}
514 // PGOUSE-DAG: ![[BO3]] = metadata !{metadata !"branch_weights", i32 67, i32 35}
515 // PGOUSE-DAG: ![[BO4]] = metadata !{metadata !"branch_weights", i32 67, i32 35}
516 // PGOUSE-DAG: ![[BO5]] = metadata !{metadata !"branch_weights", i32 18, i32 18}
517 // PGOUSE-DAG: ![[BO6]] = metadata !{metadata !"branch_weights", i32 51, i32 51}
518 // PGOUSE-DAG: ![[BO7]] = metadata !{metadata !"branch_weights", i32 34, i32 18}
519 // PGOUSE-DAG: ![[BL1]] = metadata !{metadata !"branch_weights", i32 52, i32 1}
520 // PGOUSE-DAG: ![[BL2]] = metadata !{metadata !"branch_weights", i32 51, i32 2}
521 // PGOUSE-DAG: ![[BL3]] = metadata !{metadata !"branch_weights", i32 26, i32 27}
522 // PGOUSE-DAG: ![[BL4]] = metadata !{metadata !"branch_weights", i32 51, i32 2}
523 // PGOUSE-DAG: ![[BL5]] = metadata !{metadata !"branch_weights", i32 52, i32 1}
524 // PGOUSE-DAG: ![[BL6]] = metadata !{metadata !"branch_weights", i32 51, i32 2}
525 // PGOUSE-DAG: ![[BL7]] = metadata !{metadata !"branch_weights", i32 26, i32 27}
526 // PGOUSE-DAG: ![[BL8]] = metadata !{metadata !"branch_weights", i32 51, i32 2}
527 // PGOUSE-DAG: ![[CO1]] = metadata !{metadata !"branch_weights", i32 1, i32 2}
528 // PGOUSE-DAG: ![[CO2]] = metadata !{metadata !"branch_weights", i32 2, i32 1}
529 // PGOUSE-DAG: ![[ST1]] = metadata !{metadata !"branch_weights", i32 11, i32 2}
530
main(int argc,const char * argv[])531 int main(int argc, const char *argv[]) {
532 simple_loops();
533 conditionals();
534 early_exits();
535 jumps();
536 switches();
537 big_switch();
538 boolean_operators();
539 boolop_loops();
540 conditional_operator();
541 do_fallthrough();
542 static_func();
543 return 0;
544 }
545