summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-09-19 00:11:01 +0000
committerDevang Patel <dpatel@apple.com>2007-09-19 00:11:01 +0000
commit4c238c451ff8e65a10afe53ba77f05df1f4994c9 (patch)
tree81ded306585a3030acd368757f29e316d8a2663a /llvm/lib/Transforms
parent31f2c8592c6466d166ce7eb8149542bca9baefa3 (diff)
downloadbcm5719-llvm-4c238c451ff8e65a10afe53ba77f05df1f4994c9.tar.gz
bcm5719-llvm-4c238c451ff8e65a10afe53ba77f05df1f4994c9.zip
Bail out early, before modifying anything.
llvm-svn: 42120
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp
index c2e9d500a93..92a6058b5a6 100644
--- a/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIndexSplit.cpp
@@ -542,6 +542,11 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) {
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 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) {
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) {
OpenPOWER on IntegriCloud