mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Don't split any loop backedges, including backedges of loops other than
the active loop. This is generally desirable, and it avoids trouble in situations such as the testcase in PR9123, though the failure mode depends on use-list order, so it is infeasible to test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125065 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
11513e5d1e
commit
3ef9838f89
@ -3544,21 +3544,23 @@ void LSRInstance::RewriteForPHI(PHINode *PN,
|
||||
// is the canonical backedge for this loop, which complicates post-inc
|
||||
// users.
|
||||
if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 &&
|
||||
!isa<IndirectBrInst>(BB->getTerminator()) &&
|
||||
(PN->getParent() != L->getHeader() || !L->contains(BB))) {
|
||||
// Split the critical edge.
|
||||
BasicBlock *NewBB = SplitCriticalEdge(BB, PN->getParent(), P);
|
||||
!isa<IndirectBrInst>(BB->getTerminator())) {
|
||||
Loop *PNLoop = LI.getLoopFor(PN->getParent());
|
||||
if (!PNLoop || PN->getParent() != PNLoop->getHeader()) {
|
||||
// Split the critical edge.
|
||||
BasicBlock *NewBB = SplitCriticalEdge(BB, PN->getParent(), P);
|
||||
|
||||
// If PN is outside of the loop and BB is in the loop, we want to
|
||||
// move the block to be immediately before the PHI block, not
|
||||
// immediately after BB.
|
||||
if (L->contains(BB) && !L->contains(PN))
|
||||
NewBB->moveBefore(PN->getParent());
|
||||
// If PN is outside of the loop and BB is in the loop, we want to
|
||||
// move the block to be immediately before the PHI block, not
|
||||
// immediately after BB.
|
||||
if (L->contains(BB) && !L->contains(PN))
|
||||
NewBB->moveBefore(PN->getParent());
|
||||
|
||||
// Splitting the edge can reduce the number of PHI entries we have.
|
||||
e = PN->getNumIncomingValues();
|
||||
BB = NewBB;
|
||||
i = PN->getBasicBlockIndex(BB);
|
||||
// Splitting the edge can reduce the number of PHI entries we have.
|
||||
e = PN->getNumIncomingValues();
|
||||
BB = NewBB;
|
||||
i = PN->getBasicBlockIndex(BB);
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<DenseMap<BasicBlock *, Value *>::iterator, bool> Pair =
|
||||
|
Loading…
Reference in New Issue
Block a user