[llvm-commits] [llvm] r42120 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Devang Patel
dpatel at apple.com
Tue Sep 18 17:11:06 PDT 2007
Author: dpatel
Date: Tue Sep 18 19:11:01 2007
New Revision: 42120
URL: http://llvm.org/viewvc/llvm-project?rev=42120&view=rev
Log:
Bail out early, before modifying anything.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=42120&r1=42119&r2=42120&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Sep 18 19:11:01 2007
@@ -542,6 +542,11 @@
if (!safeSplitCondition(SD))
return false;
+ BasicBlock *Latch = L->getLoopLatch();
+ BranchInst *BR = dyn_cast<BranchInst>(Latch->getTerminator());
+ if (!BR)
+ return false;
+
// Update CFG.
// Replace index variable with split value in loop body. Loop body is executed
@@ -549,11 +554,7 @@
IndVar->replaceAllUsesWith(SD.SplitValue);
// Remove Latch to Header edge.
- BasicBlock *Latch = L->getLoopLatch();
BasicBlock *LatchSucc = NULL;
- BranchInst *BR = dyn_cast<BranchInst>(Latch->getTerminator());
- if (!BR)
- return false;
Header->removePredecessor(Latch);
for (succ_iterator SI = succ_begin(Latch), E = succ_end(Latch);
SI != E; ++SI) {
More information about the llvm-commits
mailing list