From 89d4411cef736898047aa7e3bc159da39cacf8e6 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 25 Aug 2011 01:08:34 +0000 Subject: 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 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp') diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index ac4e741a6e..2d93cac11c 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3621,10 +3621,11 @@ void LSRInstance::RewriteForPHI(PHINode *PN, // users. if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 && !isa(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 -- cgit v1.2.3