llvm.org GIT mirror llvm / cb358c5
[PowerPC] Make sure that we remove dead PHI nodes after the PPCCTRLoops pass. Commiting on behalf of Stefan Pintilie. Differential Revision: https://reviews.llvm.org/D34829 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307180 91177308-0d34-0410-b5e6-96231b3b80d8 Sean Fertile 2 years ago
2 changed file(s) with 42 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
606606 // The old condition may be dead now, and may have even created a dead PHI
607607 // (the original induction variable).
608608 RecursivelyDeleteTriviallyDeadInstructions(OldCond);
609 DeleteDeadPHIs(CountedExitBlock);
609 // Run through the basic blocks of the loop and see if any of them have dead
610 // PHIs that can be removed.
611 for (auto I : L->blocks())
612 DeleteDeadPHIs(I);
610613
611614 ++NumCTRLoops;
612615 return MadeChange;
0 ; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s
1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr9 -verify-machineinstrs | FileCheck %s
2 ; RUN: llc < %s -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s
3 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr8 -verify-machineinstrs | FileCheck %s
4
5 ; Function Attrs: norecurse nounwind readonly
6 define signext i32 @limit_loop(i32 signext %iters, i32* nocapture readonly %vec, i32 signext %limit) local_unnamed_addr {
7 entry:
8 %cmp5 = icmp sgt i32 %iters, 0
9 br i1 %cmp5, label %for.body.preheader, label %cleanup
10
11 for.body.preheader: ; preds = %entry
12 %0 = sext i32 %iters to i64
13 br label %for.body
14
15 for.cond: ; preds = %for.body
16 %cmp = icmp slt i64 %indvars.iv.next, %0
17 br i1 %cmp, label %for.body, label %cleanup
18
19 for.body: ; preds = %for.body.preheader, %for.cond
20 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.cond ]
21 %arrayidx = getelementptr inbounds i32, i32* %vec, i64 %indvars.iv
22 %1 = load i32, i32* %arrayidx, align 4
23 %cmp1 = icmp slt i32 %1, %limit
24 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
25 br i1 %cmp1, label %for.cond, label %cleanup
26
27 cleanup: ; preds = %for.body, %for.cond, %entry
28 %2 = phi i32 [ 0, %entry ], [ 0, %for.cond ], [ 1, %for.body ]
29 ret i32 %2
30 ; CHECK-LABEL: limit_loop
31 ; CHECK: mtctr
32 ; CHECK-NOT: addi {{[0-9]+}}, {{[0-9]+}}, 1
33 ; CHECK: bdnz
34 ; CHECK: blr
35 }
36
37