mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
LSR critical edge splitting fix for PR13756.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -4464,17 +4464,21 @@ void LSRInstance::RewriteForPHI(PHINode *PN,
|
||||
SplitLandingPadPredecessors(Parent, BB, "", "", P, NewBBs);
|
||||
NewBB = NewBBs[0];
|
||||
}
|
||||
// If NewBB==NULL, then SplitCriticalEdge refused to split because all
|
||||
// phi predecessors are identical. The simple thing to do is skip
|
||||
// splitting in this case rather than complicate the API.
|
||||
if (NewBB) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user