mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Bail out early, before modifying anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42120 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4e062e520a
commit
84ef08bfee
@ -542,6 +542,11 @@ bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) {
|
|||||||
if (!safeSplitCondition(SD))
|
if (!safeSplitCondition(SD))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
BasicBlock *Latch = L->getLoopLatch();
|
||||||
|
BranchInst *BR = dyn_cast<BranchInst>(Latch->getTerminator());
|
||||||
|
if (!BR)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Update CFG.
|
// Update CFG.
|
||||||
|
|
||||||
// Replace index variable with split value in loop body. Loop body is executed
|
// 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);
|
IndVar->replaceAllUsesWith(SD.SplitValue);
|
||||||
|
|
||||||
// Remove Latch to Header edge.
|
// Remove Latch to Header edge.
|
||||||
BasicBlock *Latch = L->getLoopLatch();
|
|
||||||
BasicBlock *LatchSucc = NULL;
|
BasicBlock *LatchSucc = NULL;
|
||||||
BranchInst *BR = dyn_cast<BranchInst>(Latch->getTerminator());
|
|
||||||
if (!BR)
|
|
||||||
return false;
|
|
||||||
Header->removePredecessor(Latch);
|
Header->removePredecessor(Latch);
|
||||||
for (succ_iterator SI = succ_begin(Latch), E = succ_end(Latch);
|
for (succ_iterator SI = succ_begin(Latch), E = succ_end(Latch);
|
||||||
SI != E; ++SI) {
|
SI != E; ++SI) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user