When inserting new instructions, use getFirstInsertionPt instead of

getFirstNonPHI so that it will skip over the landingpad instructions as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138537 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2011-08-25 01:08:34 +00:00
parent b8cfe4ff41
commit 89d4411cef
6 changed files with 18 additions and 17 deletions

View File

@ -3621,10 +3621,11 @@ void LSRInstance::RewriteForPHI(PHINode *PN,
// users.
if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 &&
!isa<IndirectBrInst>(BB->getTerminator())) {
Loop *PNLoop = LI.getLoopFor(PN->getParent());
if (!PNLoop || PN->getParent() != PNLoop->getHeader()) {
BasicBlock *Parent = PN->getParent();
Loop *PNLoop = LI.getLoopFor(Parent);
if (!PNLoop || Parent != PNLoop->getHeader()) {
// Split the critical edge.
BasicBlock *NewBB = SplitCriticalEdge(BB, PN->getParent(), P);
BasicBlock *NewBB = SplitCriticalEdge(BB, Parent, 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