From a90793b431458c1bac4c7267946738968c4cdf58 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Fri, 3 Oct 2008 06:55:35 +0000 Subject: [PATCH] SplitBlock should only attempt to update LoopInfo if it is actually being used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56994 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/BasicBlockUtils.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index a98e1356ad3..1b018cbdf67 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -240,16 +240,15 @@ BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, Pass *P) { /// the loop info is updated. /// BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) { - - LoopInfo &LI = P->getAnalysis(); BasicBlock::iterator SplitIt = SplitPt; while (isa(SplitIt)) ++SplitIt; BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split"); // The new block lives in whichever loop the old one did. - if (Loop *L = LI.getLoopFor(Old)) - L->addBasicBlockToLoop(New, LI.getBase()); + if (LoopInfo* LI = P->getAnalysisToUpdate()) + if (Loop *L = LI->getLoopFor(Old)) + L->addBasicBlockToLoop(New, LI->getBase()); if (DominatorTree *DT = P->getAnalysisToUpdate()) {