mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-16 00:38:58 +00:00
[LoopUnroll] Ensure we create prolog loops in simplified form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277502 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0fa8922515
commit
bc280d0f4f
@ -112,6 +112,18 @@ static void ConnectProlog(Loop *L, Value *BECount, unsigned Count,
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure that created prolog loop is in simplified form
|
||||
SmallVector<BasicBlock *, 4> PrologExitPreds;
|
||||
Loop *PrologLoop = LI->getLoopFor(PrologLatch);
|
||||
if (PrologLoop) {
|
||||
for (BasicBlock *PredBB : predecessors(PrologExit))
|
||||
if (PrologLoop->contains(PredBB))
|
||||
PrologExitPreds.push_back(PredBB);
|
||||
|
||||
SplitBlockPredecessors(PrologExit, PrologExitPreds, ".unr-lcssa", DT, LI,
|
||||
PreserveLCSSA);
|
||||
}
|
||||
|
||||
// Create a branch around the original loop, which is taken if there are no
|
||||
// iterations remaining to be executed after running the prologue.
|
||||
Instruction *InsertPt = PrologExit->getTerminator();
|
||||
|
@ -23,7 +23,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
|
||||
; PROLOG: %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %for.body.prol ], [ 0, %for.body.prol.preheader ]
|
||||
; PROLOG: %prol.iter.sub = sub i32 %prol.iter, 1
|
||||
; PROLOG: %prol.iter.cmp = icmp ne i32 %prol.iter.sub, 0
|
||||
; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit, !llvm.loop !0
|
||||
; PROLOG: br i1 %prol.iter.cmp, label %for.body.prol, label %for.body.prol.loopexit.unr-lcssa, !llvm.loop !0
|
||||
|
||||
|
||||
define i32 @test(i32* nocapture %a, i32 %n) nounwind uwtable readonly {
|
||||
|
Loading…
x
Reference in New Issue
Block a user