blob: c9b5bf8c9eeb3709cfdebea75b31fbab043b2c91 [file] [log] [blame]
Kyle Butt7fbec9b2017-02-15 19:49:14 +00001; RUN: llc -O2 < %s | FileCheck %s
Kyle Butt0846e562016-10-11 20:36:43 +00002target datalayout = "e-m:e-i64:64-n32:64"
3target triple = "powerpc64le-grtev4-linux-gnu"
4
5; Intended layout:
Kyle Butt7fbec9b2017-02-15 19:49:14 +00006; The chain-based outlining produces the layout
Kyle Butt0846e562016-10-11 20:36:43 +00007; test1
8; test2
9; test3
10; test4
Kyle Butt0846e562016-10-11 20:36:43 +000011; optional1
12; optional2
13; optional3
14; optional4
Kyle Butt7fbec9b2017-02-15 19:49:14 +000015; exit
Kyle Butt0846e562016-10-11 20:36:43 +000016; Tail duplication puts test n+1 at the end of optional n
17; so optional1 includes a copy of test2 at the end, and branches
18; to test3 (at the top) or falls through to optional 2.
Kyle Butt7fbec9b2017-02-15 19:49:14 +000019; The CHECK statements check for the whole string of tests
Kyle Butt0846e562016-10-11 20:36:43 +000020; and then check that the correct test has been duplicated into the end of
21; the optional blocks and that the optional blocks are in the correct order.
Kyle Butt7fbec9b2017-02-15 19:49:14 +000022;CHECK-LABEL: straight_test:
Kyle Butt0846e562016-10-11 20:36:43 +000023; test1 may have been merged with entry
24;CHECK: mr [[TAGREG:[0-9]+]], 3
25;CHECK: andi. {{[0-9]+}}, [[TAGREG]], 1
Kyle Butt7fbec9b2017-02-15 19:49:14 +000026;CHECK-NEXT: bc 12, 1, .[[OPT1LABEL:[_0-9A-Za-z]+]]
27;CHECK-NEXT: # %test2
Kyle Butt0846e562016-10-11 20:36:43 +000028;CHECK-NEXT: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 30, 30
Kyle Butt7fbec9b2017-02-15 19:49:14 +000029;CHECK-NEXT: bne 0, .[[OPT2LABEL:[_0-9A-Za-z]+]]
30;CHECK-NEXT: .[[TEST3LABEL:[_0-9A-Za-z]+]]: # %test3
Kyle Butt0846e562016-10-11 20:36:43 +000031;CHECK-NEXT: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 29, 29
Kyle Butt7fbec9b2017-02-15 19:49:14 +000032;CHECK-NEXT: bne 0, .[[OPT3LABEL:[_0-9A-Za-z]+]]
33;CHECK-NEXT: .[[TEST4LABEL:[_0-9A-Za-z]+]]: # %test4
Kyle Butt0846e562016-10-11 20:36:43 +000034;CHECK-NEXT: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 28, 28
Kyle Butt7fbec9b2017-02-15 19:49:14 +000035;CHECK-NEXT: bne 0, .[[OPT4LABEL:[_0-9A-Za-z]+]]
36;CHECK-NEXT: .[[EXITLABEL:[_0-9A-Za-z]+]]: # %exit
Kyle Butt0846e562016-10-11 20:36:43 +000037;CHECK: blr
Kyle Butt7fbec9b2017-02-15 19:49:14 +000038;CHECK-NEXT: .[[OPT1LABEL]]:
Kyle Butt0846e562016-10-11 20:36:43 +000039;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 30, 30
Kyle Butt7fbec9b2017-02-15 19:49:14 +000040;CHECK-NEXT: beq 0, .[[TEST3LABEL]]
41;CHECK-NEXT: .[[OPT2LABEL]]:
Kyle Butt0846e562016-10-11 20:36:43 +000042;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 29, 29
Kyle Butt7fbec9b2017-02-15 19:49:14 +000043;CHECK-NEXT: beq 0, .[[TEST4LABEL]]
44;CHECK-NEXT: .[[OPT3LABEL]]:
Kyle Butt0846e562016-10-11 20:36:43 +000045;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 28, 28
Kyle Butt7fbec9b2017-02-15 19:49:14 +000046;CHECK-NEXT: beq 0, .[[EXITLABEL]]
47;CHECK-NEXT: .[[OPT4LABEL]]:
48;CHECK: b .[[EXITLABEL]]
Kyle Butt0846e562016-10-11 20:36:43 +000049
Kyle Butt7fbec9b2017-02-15 19:49:14 +000050define void @straight_test(i32 %tag) {
Kyle Butt0846e562016-10-11 20:36:43 +000051entry:
52 br label %test1
53test1:
54 %tagbit1 = and i32 %tag, 1
55 %tagbit1eq0 = icmp eq i32 %tagbit1, 0
Kyle Butt7fbec9b2017-02-15 19:49:14 +000056 br i1 %tagbit1eq0, label %test2, label %optional1, !prof !1
Kyle Butt0846e562016-10-11 20:36:43 +000057optional1:
58 call void @a()
59 call void @a()
60 call void @a()
61 call void @a()
62 br label %test2
63test2:
64 %tagbit2 = and i32 %tag, 2
65 %tagbit2eq0 = icmp eq i32 %tagbit2, 0
Kyle Butt7fbec9b2017-02-15 19:49:14 +000066 br i1 %tagbit2eq0, label %test3, label %optional2, !prof !1
Kyle Butt0846e562016-10-11 20:36:43 +000067optional2:
68 call void @b()
69 call void @b()
70 call void @b()
71 call void @b()
72 br label %test3
73test3:
74 %tagbit3 = and i32 %tag, 4
75 %tagbit3eq0 = icmp eq i32 %tagbit3, 0
Kyle Butt7fbec9b2017-02-15 19:49:14 +000076 br i1 %tagbit3eq0, label %test4, label %optional3, !prof !1
Kyle Butt0846e562016-10-11 20:36:43 +000077optional3:
78 call void @c()
79 call void @c()
80 call void @c()
81 call void @c()
82 br label %test4
83test4:
84 %tagbit4 = and i32 %tag, 8
85 %tagbit4eq0 = icmp eq i32 %tagbit4, 0
Kyle Butt7fbec9b2017-02-15 19:49:14 +000086 br i1 %tagbit4eq0, label %exit, label %optional4, !prof !1
Kyle Butt0846e562016-10-11 20:36:43 +000087optional4:
88 call void @d()
89 call void @d()
90 call void @d()
91 call void @d()
92 br label %exit
93exit:
94 ret void
95}
96
Kyle Butt7fbec9b2017-02-15 19:49:14 +000097; Intended layout:
Kyle Butt1fa60302017-03-03 01:00:22 +000098; The chain-of-triangles based duplicating produces the layout
99; test1
100; test2
101; test3
102; test4
103; optional1
104; optional2
105; optional3
106; optional4
107; exit
108; even for 50/50 branches.
109; Tail duplication puts test n+1 at the end of optional n
110; so optional1 includes a copy of test2 at the end, and branches
111; to test3 (at the top) or falls through to optional 2.
112; The CHECK statements check for the whole string of tests
113; and then check that the correct test has been duplicated into the end of
114; the optional blocks and that the optional blocks are in the correct order.
115;CHECK-LABEL: straight_test_50:
116; test1 may have been merged with entry
117;CHECK: mr [[TAGREG:[0-9]+]], 3
118;CHECK: andi. {{[0-9]+}}, [[TAGREG]], 1
119;CHECK-NEXT: bc 12, 1, .[[OPT1LABEL:[_0-9A-Za-z]+]]
120;CHECK-NEXT: # %test2
121;CHECK-NEXT: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 30, 30
122;CHECK-NEXT: bne 0, .[[OPT2LABEL:[_0-9A-Za-z]+]]
123;CHECK-NEXT: .[[TEST3LABEL:[_0-9A-Za-z]+]]: # %test3
124;CHECK-NEXT: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 29, 29
125;CHECK-NEXT: bne 0, .[[OPT3LABEL:[_0-9A-Za-z]+]]
Kyle Butt1fa60302017-03-03 01:00:22 +0000126;CHECK-NEXT: .[[EXITLABEL:[_0-9A-Za-z]+]]: # %exit
127;CHECK: blr
128;CHECK-NEXT: .[[OPT1LABEL]]:
129;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 30, 30
130;CHECK-NEXT: beq 0, .[[TEST3LABEL]]
131;CHECK-NEXT: .[[OPT2LABEL]]:
132;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 29, 29
Kyle Butt1fa60302017-03-03 01:00:22 +0000133;CHECK-NEXT: beq 0, .[[EXITLABEL]]
Kyle Buttd609d6e2017-03-16 21:33:29 +0000134;CHECK-NEXT: .[[OPT3LABEL]]:
Kyle Butt1fa60302017-03-03 01:00:22 +0000135;CHECK: b .[[EXITLABEL]]
136
137define void @straight_test_50(i32 %tag) {
138entry:
139 br label %test1
140test1:
141 %tagbit1 = and i32 %tag, 1
142 %tagbit1eq0 = icmp eq i32 %tagbit1, 0
143 br i1 %tagbit1eq0, label %test2, label %optional1, !prof !2
144optional1:
145 call void @a()
146 br label %test2
147test2:
148 %tagbit2 = and i32 %tag, 2
149 %tagbit2eq0 = icmp eq i32 %tagbit2, 0
150 br i1 %tagbit2eq0, label %test3, label %optional2, !prof !2
151optional2:
152 call void @b()
153 br label %test3
154test3:
155 %tagbit3 = and i32 %tag, 4
156 %tagbit3eq0 = icmp eq i32 %tagbit3, 0
Kyle Buttd609d6e2017-03-16 21:33:29 +0000157 br i1 %tagbit3eq0, label %exit, label %optional3, !prof !1
Kyle Butt1fa60302017-03-03 01:00:22 +0000158optional3:
159 call void @c()
Kyle Butt1fa60302017-03-03 01:00:22 +0000160 br label %exit
161exit:
162 ret void
163}
164
165; Intended layout:
Kyle Butt7fbec9b2017-02-15 19:49:14 +0000166; The chain-based outlining produces the layout
167; entry
168; --- Begin loop ---
169; for.latch
170; for.check
171; test1
172; test2
173; test3
174; test4
175; optional1
176; optional2
177; optional3
178; optional4
179; --- End loop ---
180; exit
181; The CHECK statements check for the whole string of tests and exit block,
182; and then check that the correct test has been duplicated into the end of
183; the optional blocks and that the optional blocks are in the correct order.
184;CHECK-LABEL: loop_test:
185;CHECK: add [[TAGPTRREG:[0-9]+]], 3, 4
186;CHECK: .[[LATCHLABEL:[._0-9A-Za-z]+]]: # %for.latch
187;CHECK: addi
188;CHECK: .[[CHECKLABEL:[._0-9A-Za-z]+]]: # %for.check
189;CHECK: lwz [[TAGREG:[0-9]+]], 0([[TAGPTRREG]])
190;CHECK: # %test1
191;CHECK: andi. {{[0-9]+}}, [[TAGREG]], 1
192;CHECK-NEXT: bc 12, 1, .[[OPT1LABEL:[._0-9A-Za-z]+]]
193;CHECK-NEXT: # %test2
194;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 30, 30
195;CHECK-NEXT: bne 0, .[[OPT2LABEL:[._0-9A-Za-z]+]]
196;CHECK-NEXT: .[[TEST3LABEL:[._0-9A-Za-z]+]]: # %test3
197;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 29, 29
198;CHECK-NEXT: bne 0, .[[OPT3LABEL:[._0-9A-Za-z]+]]
199;CHECK-NEXT: .[[TEST4LABEL:[._0-9A-Za-z]+]]: # %{{(test4|optional3)}}
200;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 28, 28
201;CHECK-NEXT: beq 0, .[[LATCHLABEL]]
202;CHECK-NEXT: b .[[OPT4LABEL:[._0-9A-Za-z]+]]
203;CHECK: [[OPT1LABEL]]
204;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 30, 30
205;CHECK-NEXT: beq 0, .[[TEST3LABEL]]
206;CHECK-NEXT: .[[OPT2LABEL]]
207;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 29, 29
208;CHECK-NEXT: beq 0, .[[TEST4LABEL]]
209;CHECK-NEXT: .[[OPT3LABEL]]
210;CHECK: rlwinm. {{[0-9]+}}, [[TAGREG]], 0, 28, 28
211;CHECK-NEXT: beq 0, .[[LATCHLABEL]]
212;CHECK: [[OPT4LABEL]]:
213;CHECK: b .[[LATCHLABEL]]
214define void @loop_test(i32* %tags, i32 %count) {
215entry:
216 br label %for.check
217for.check:
218 %count.loop = phi i32 [%count, %entry], [%count.sub, %for.latch]
219 %done.count = icmp ugt i32 %count.loop, 0
220 %tag_ptr = getelementptr inbounds i32, i32* %tags, i32 %count
221 %tag = load i32, i32* %tag_ptr
222 %done.tag = icmp eq i32 %tag, 0
223 %done = and i1 %done.count, %done.tag
224 br i1 %done, label %test1, label %exit, !prof !1
225test1:
226 %tagbit1 = and i32 %tag, 1
227 %tagbit1eq0 = icmp eq i32 %tagbit1, 0
228 br i1 %tagbit1eq0, label %test2, label %optional1, !prof !1
229optional1:
230 call void @a()
231 call void @a()
232 call void @a()
233 call void @a()
234 br label %test2
235test2:
236 %tagbit2 = and i32 %tag, 2
237 %tagbit2eq0 = icmp eq i32 %tagbit2, 0
238 br i1 %tagbit2eq0, label %test3, label %optional2, !prof !1
239optional2:
240 call void @b()
241 call void @b()
242 call void @b()
243 call void @b()
244 br label %test3
245test3:
246 %tagbit3 = and i32 %tag, 4
247 %tagbit3eq0 = icmp eq i32 %tagbit3, 0
248 br i1 %tagbit3eq0, label %test4, label %optional3, !prof !1
249optional3:
250 call void @c()
251 call void @c()
252 call void @c()
253 call void @c()
254 br label %test4
255test4:
256 %tagbit4 = and i32 %tag, 8
257 %tagbit4eq0 = icmp eq i32 %tagbit4, 0
258 br i1 %tagbit4eq0, label %for.latch, label %optional4, !prof !1
259optional4:
260 call void @d()
261 call void @d()
262 call void @d()
263 call void @d()
264 br label %for.latch
265for.latch:
266 %count.sub = sub i32 %count.loop, 1
267 br label %for.check
268exit:
269 ret void
270}
271
272; The block then2 is not unavoidable, meaning it does not dominate the exit.
273; But since it can be tail-duplicated, it should be placed as a fallthrough from
274; test2 and copied. The purpose here is to make sure that the tail-duplication
275; code is independent of the outlining code, which works by choosing the
276; "unavoidable" blocks.
277; CHECK-LABEL: avoidable_test:
278; CHECK: # %entry
279; CHECK: andi.
280; CHECK: # %test2
281; Make sure then2 falls through from test2
282; CHECK-NOT: # %{{[-_a-zA-Z0-9]+}}
283; CHECK: # %then2
284; CHECK: rlwinm. {{[0-9]+}}, {{[0-9]+}}, 0, 29, 29
285; CHECK: # %else1
286; CHECK: bl a
287; CHECK: bl a
288; Make sure then2 was copied into else1
289; CHECK: rlwinm. {{[0-9]+}}, {{[0-9]+}}, 0, 29, 29
290; CHECK: # %end1
291; CHECK: bl d
292; CHECK: # %else2
293; CHECK: bl c
294; CHECK: # %end2
295define void @avoidable_test(i32 %tag) {
296entry:
297 br label %test1
298test1:
299 %tagbit1 = and i32 %tag, 1
300 %tagbit1eq0 = icmp eq i32 %tagbit1, 0
301 br i1 %tagbit1eq0, label %test2, label %else1, !prof !1 ; %test2 more likely
302else1:
303 call void @a()
304 call void @a()
305 br label %then2
306test2:
307 %tagbit2 = and i32 %tag, 2
308 %tagbit2eq0 = icmp eq i32 %tagbit2, 0
309 br i1 %tagbit2eq0, label %then2, label %else2, !prof !1 ; %then2 more likely
310then2:
311 %tagbit3 = and i32 %tag, 4
312 %tagbit3eq0 = icmp eq i32 %tagbit3, 0
313 br i1 %tagbit3eq0, label %end2, label %end1, !prof !1 ; %end2 more likely
314else2:
315 call void @c()
316 br label %end2
317end2:
318 ret void
319end1:
320 call void @d()
321 ret void
322}
323
324; CHECK-LABEL: trellis_test
325; The number in the block labels is the expected block frequency given the
326; probabilities annotated. There is a conflict in the b;c->d;e trellis that
327; should be resolved as c->e;b->d.
328; The d;e->f;g trellis should be resolved as e->g;d->f.
329; The f;g->h;i trellis should be resolved as f->i;g->h.
330; The h;i->j;ret trellis contains a triangle edge, and should be resolved as
331; h->j->ret
332; CHECK: # %entry
333; CHECK: # %c10
334; CHECK: # %e9
335; CHECK: # %g10
336; CHECK: # %h10
337; CHECK: # %j8
338; CHECK: # %ret
339; CHECK: # %b6
340; CHECK: # %d7
341; CHECK: # %f6
342; CHECK: # %i6
343define void @trellis_test(i32 %tag) {
344entry:
345 br label %a16
346a16:
347 call void @a()
348 call void @a()
349 %tagbits.a = and i32 %tag, 3
350 %tagbits.a.eq0 = icmp eq i32 %tagbits.a, 0
351 br i1 %tagbits.a.eq0, label %c10, label %b6, !prof !1 ; 10 to 6
352c10:
353 call void @c()
354 call void @c()
355 %tagbits.c = and i32 %tag, 12
356 %tagbits.c.eq0 = icmp eq i32 %tagbits.c, 0
357 ; Both of these edges should be hotter than the other incoming edge
358 ; for e9 or d7
359 br i1 %tagbits.c.eq0, label %e9, label %d7, !prof !3 ; 6 to 4
360e9:
361 call void @e()
362 call void @e()
363 %tagbits.e = and i32 %tag, 48
364 %tagbits.e.eq0 = icmp eq i32 %tagbits.e, 0
365 br i1 %tagbits.e.eq0, label %g10, label %f6, !prof !4 ; 7 to 2
366g10:
367 call void @g()
368 call void @g()
369 %tagbits.g = and i32 %tag, 192
370 %tagbits.g.eq0 = icmp eq i32 %tagbits.g, 0
371 br i1 %tagbits.g.eq0, label %i6, label %h10, !prof !5 ; 2 to 8
372i6:
373 call void @i()
374 call void @i()
375 %tagbits.i = and i32 %tag, 768
376 %tagbits.i.eq0 = icmp eq i32 %tagbits.i, 0
377 br i1 %tagbits.i.eq0, label %ret, label %j8, !prof !2 ; balanced (3 to 3)
378b6:
379 call void @b()
380 call void @b()
381 %tagbits.b = and i32 %tag, 12
382 %tagbits.b.eq1 = icmp eq i32 %tagbits.b, 8
383 br i1 %tagbits.b.eq1, label %e9, label %d7, !prof !2 ; balanced (3 to 3)
384d7:
385 call void @d()
386 call void @d()
387 %tagbits.d = and i32 %tag, 48
388 %tagbits.d.eq1 = icmp eq i32 %tagbits.d, 32
389 br i1 %tagbits.d.eq1, label %g10, label %f6, !prof !6 ; 3 to 4
390f6:
391 call void @f()
392 call void @f()
393 %tagbits.f = and i32 %tag, 192
394 %tagbits.f.eq1 = icmp eq i32 %tagbits.f, 128
395 br i1 %tagbits.f.eq1, label %i6, label %h10, !prof !7 ; 4 to 2
396h10:
397 call void @h()
398 call void @h()
399 %tagbits.h = and i32 %tag, 768
400 %tagbits.h.eq1 = icmp eq i32 %tagbits.h, 512
401 br i1 %tagbits.h.eq1, label %ret, label %j8, !prof !2 ; balanced (5 to 5)
402j8:
403 call void @j()
404 call void @j()
405 br label %ret
406ret:
407 ret void
408}
409
410; Verify that we still consider tail-duplication opportunities if we find a
411; triangle trellis. Here D->F->G is the triangle, and D;E are both predecessors
412; of both F and G. The basic trellis algorithm picks the F->G edge, but after
413; checking, it's profitable to duplicate G into F. The weights here are not
414; really important. They are there to help make the test stable.
415; CHECK-LABEL: trellis_then_dup_test
416; CHECK: # %entry
417; CHECK: # %b
418; CHECK: # %d
419; CHECK: # %g
420; CHECK: # %ret1
421; CHECK: # %c
422; CHECK: # %e
423; CHECK: # %f
424; CHECK: # %ret2
425; CHECK: # %ret
426define void @trellis_then_dup_test(i32 %tag) {
427entry:
428 br label %a
429a:
430 call void @a()
431 call void @a()
432 %tagbits.a = and i32 %tag, 3
433 %tagbits.a.eq0 = icmp eq i32 %tagbits.a, 0
434 br i1 %tagbits.a.eq0, label %b, label %c, !prof !1 ; 5 to 3
435b:
436 call void @b()
437 call void @b()
438 %tagbits.b = and i32 %tag, 12
439 %tagbits.b.eq1 = icmp eq i32 %tagbits.b, 8
440 br i1 %tagbits.b.eq1, label %d, label %e, !prof !1 ; 5 to 3
441d:
442 call void @d()
443 call void @d()
444 %tagbits.d = and i32 %tag, 48
445 %tagbits.d.eq1 = icmp eq i32 %tagbits.d, 32
446 br i1 %tagbits.d.eq1, label %g, label %f, !prof !1 ; 5 to 3
447f:
448 call void @f()
449 call void @f()
450 br label %g
451g:
452 %tagbits.g = and i32 %tag, 192
453 %tagbits.g.eq0 = icmp eq i32 %tagbits.g, 0
454 br i1 %tagbits.g.eq0, label %ret1, label %ret2, !prof !2 ; balanced
455c:
456 call void @c()
457 call void @c()
458 %tagbits.c = and i32 %tag, 12
459 %tagbits.c.eq0 = icmp eq i32 %tagbits.c, 0
460 br i1 %tagbits.c.eq0, label %d, label %e, !prof !1 ; 5 to 3
461e:
462 call void @e()
463 call void @e()
464 %tagbits.e = and i32 %tag, 48
465 %tagbits.e.eq0 = icmp eq i32 %tagbits.e, 0
466 br i1 %tagbits.e.eq0, label %g, label %f, !prof !1 ; 5 to 3
467ret1:
468 call void @a()
469 br label %ret
470ret2:
471 call void @b()
472 br label %ret
473ret:
474 ret void
475}
476
Dehao Chenb197d5b2017-03-23 23:28:09 +0000477; Verify that we did not mis-identify triangle trellises if it is not
478; really a triangle.
479; CHECK-LABEL: trellis_no_triangle
480; CHECK: # %entry
481; CHECK: # %b
482; CHECK: # %d
483; CHECK: # %ret
484; CHECK: # %c
485; CHECK: # %e
486define void @trellis_no_triangle(i32 %tag) {
487entry:
488 br label %a
489a:
490 call void @a()
491 call void @a()
492 %tagbits.a = and i32 %tag, 3
493 %tagbits.a.eq0 = icmp eq i32 %tagbits.a, 0
494 br i1 %tagbits.a.eq0, label %b, label %c, !prof !8 ; 98 to 2
495b:
496 call void @b()
497 call void @b()
498 %tagbits.b = and i32 %tag, 12
499 %tagbits.b.eq1 = icmp eq i32 %tagbits.b, 8
500 br i1 %tagbits.b.eq1, label %d, label %e, !prof !9 ; 97 to 1
501d:
502 call void @d()
503 call void @d()
504 %tagbits.d = and i32 %tag, 48
505 %tagbits.d.eq1 = icmp eq i32 %tagbits.d, 32
506 br i1 %tagbits.d.eq1, label %ret, label %e, !prof !10 ; 96 to 2
507c:
508 call void @c()
509 call void @c()
510 %tagbits.c = and i32 %tag, 12
511 %tagbits.c.eq0 = icmp eq i32 %tagbits.c, 0
512 br i1 %tagbits.c.eq0, label %d, label %e, !prof !2 ; 1 to 1
513e:
514 call void @e()
515 call void @e()
516 br label %ret
517ret:
518 call void @f()
519 ret void
520}
521
Kyle Butt0846e562016-10-11 20:36:43 +0000522declare void @a()
523declare void @b()
524declare void @c()
525declare void @d()
Kyle Butt7fbec9b2017-02-15 19:49:14 +0000526declare void @e()
527declare void @f()
528declare void @g()
529declare void @h()
530declare void @i()
531declare void @j()
532
533!1 = !{!"branch_weights", i32 5, i32 3}
534!2 = !{!"branch_weights", i32 50, i32 50}
535!3 = !{!"branch_weights", i32 6, i32 4}
536!4 = !{!"branch_weights", i32 7, i32 2}
537!5 = !{!"branch_weights", i32 2, i32 8}
538!6 = !{!"branch_weights", i32 3, i32 4}
539!7 = !{!"branch_weights", i32 4, i32 2}
Dehao Chenb197d5b2017-03-23 23:28:09 +0000540!8 = !{!"branch_weights", i32 98, i32 2}
541!9 = !{!"branch_weights", i32 97, i32 1}
542!10 = !{!"branch_weights", i32 96, i32 2}