1 ; RUN: llc -O3 -o - %s | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 declare void @effect(i32);
7 ; After the loop gets laid out, loop.end is the only successor, but can't be
8 ; laid out because of the CFG dependency from top.fakephi. The calculations show
9 ; that it isn't profitable to tail-duplicate in this case, because of the
10 ; effects on fallthrough from %loop.end
11 ; CHECK-LABEL: {{^}}no_successor_still_no_taildup:
19 define void @no_successor_still_no_taildup (i32 %count, i32 %key) {
24 %i.loop.top = phi i32 [ %count, %entry ], [ %i.latch, %loop.latch ]
25 %cmp.top = icmp eq i32 %i.loop.top, %key
26 call void @effect(i32 0)
27 br i1 %cmp.top, label %top.fakephi, label %loop.latch, !prof !1
30 %i.latch = sub i32 %i.loop.top, 1
31 %cmp.latch = icmp eq i32 %i.latch, 0
32 call void @effect(i32 1)
33 br i1 %cmp.top, label %loop.top, label %loop.end, !prof !2
36 call void @effect(i32 2)
40 %cmp.end = icmp eq i32 %count, 0
41 br i1 %cmp.end, label %ret, label %false, !prof !3
44 call void @effect(i32 4)
51 !1 = !{!"branch_weights", i32 1, i32 1}
52 !2 = !{!"branch_weights", i32 5, i32 1}
53 !3 = !{!"branch_weights", i32 1, i32 2}