mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
LCSSA should be performed on the outermost affected loop while unrolling loop.
During loop-unroll, loop exits from the current loop may end up in in different outer loop. This requires to re-form LCSSA recursively for one level down from the outer most loop where loop exits are landed during unroll. This fixes PR18861. Differential Revision: http://reviews.llvm.org/D2976 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209796 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -487,6 +487,15 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
|
||||
if (OuterL) {
|
||||
ScalarEvolution *SE = PP->getAnalysisIfAvailable<ScalarEvolution>();
|
||||
simplifyLoop(OuterL, DT, LI, PP, /*AliasAnalysis*/ nullptr, SE);
|
||||
|
||||
// LCSSA must be performed on the outermost affected loop. The unrolled
|
||||
// loop's last loop latch is guaranteed to be in the outermost loop after
|
||||
// deleteLoopFromQueue updates LoopInfo.
|
||||
Loop *LatchLoop = LI->getLoopFor(Latches.back());
|
||||
if (!OuterL->contains(LatchLoop))
|
||||
while (OuterL->getParentLoop() != LatchLoop)
|
||||
OuterL = OuterL->getParentLoop();
|
||||
|
||||
formLCSSARecursively(*OuterL, *DT, SE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user