[llvm-commits] [llvm] r56994 - /llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
Owen Anderson
resistor at mac.com
Thu Oct 2 23:55:36 PDT 2008
Author: resistor
Date: Fri Oct 3 01:55:35 2008
New Revision: 56994
URL: http://llvm.org/viewvc/llvm-project?rev=56994&view=rev
Log:
SplitBlock should only attempt to update LoopInfo if it is actually being used.
Modified:
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=56994&r1=56993&r2=56994&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Fri Oct 3 01:55:35 2008
@@ -240,16 +240,15 @@
/// the loop info is updated.
///
BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) {
-
- LoopInfo &LI = P->getAnalysis<LoopInfo>();
BasicBlock::iterator SplitIt = SplitPt;
while (isa<PHINode>(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<LoopInfo>())
+ if (Loop *L = LI->getLoopFor(Old))
+ L->addBasicBlockToLoop(New, LI->getBase());
if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>())
{
More information about the llvm-commits
mailing list