54 lines · plain
1; RUN: llc -O3 -o - %s | FileCheck %s2target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"3target triple = "x86_64-unknown-linux-gnu"4 5declare void @effect(i32);6 7; After the loop gets laid out, loop.end is the only successor, but can't be8; laid out because of the CFG dependency from top.fakephi. The calculations show9; that it isn't profitable to tail-duplicate in this case, because of the10; effects on fallthrough from %loop.end11; CHECK-LABEL: {{^}}no_successor_still_no_taildup:12; CHECK: %entry13; CHECK: %loop.top14; CHECK: %loop.latch15; CHECK: %loop.end16; CHECK: %false17; CHECK: %ret18; CHECK: %top.fakephi19define void @no_successor_still_no_taildup (i32 %count, i32 %key) {20entry:21 br label %loop.top22 23loop.top:24 %i.loop.top = phi i32 [ %count, %entry ], [ %i.latch, %loop.latch ]25 %cmp.top = icmp eq i32 %i.loop.top, %key26 call void @effect(i32 0)27 br i1 %cmp.top, label %top.fakephi, label %loop.latch, !prof !128 29loop.latch:30 %i.latch = sub i32 %i.loop.top, 131 %cmp.latch = icmp eq i32 %i.latch, 032 call void @effect(i32 1)33 br i1 %cmp.top, label %loop.top, label %loop.end, !prof !234 35top.fakephi:36 call void @effect(i32 2)37 br label %loop.end38 39loop.end:40 %cmp.end = icmp eq i32 %count, 041 br i1 %cmp.end, label %ret, label %false, !prof !342 43false:44 call void @effect(i32 4)45 br label %ret46 47ret:48 ret void49}50 51!1 = !{!"branch_weights", i32 1, i32 1}52!2 = !{!"branch_weights", i32 5, i32 1}53!3 = !{!"branch_weights", i32 1, i32 2}54