diff options
author | Devang Patel <dpatel@apple.com> | 2007-09-19 00:11:01 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-09-19 00:11:01 +0000 |
commit | 09531c29e5a7629323b31e7df5a4d104e4ac5e02 (patch) | |
tree | b8340b01e9fb25018bb842a9199b6d36310e8952 /lib | |
parent | c8f8393300abc8603ddfb576ed8c363f7ce22ffa (diff) | |
download | external_llvm-09531c29e5a7629323b31e7df5a4d104e4ac5e02.tar.gz external_llvm-09531c29e5a7629323b31e7df5a4d104e4ac5e02.tar.bz2 external_llvm-09531c29e5a7629323b31e7df5a4d104e4ac5e02.zip |
Bail out early, before modifying anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/LoopIndexSplit.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index c2e9d500a9..92a6058b5a 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/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) { |