aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 83231c1ae8..b2c5977a1b 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1909,6 +1909,7 @@ BinaryOperator *getNewPHIIncrement(BinaryOperator *Incr, PHINode *PHI,
void LoopStrengthReduce::OptimizeIVType(Loop *L) {
BasicBlock *LPH = L->getLoopPreheader();
+ BasicBlock *LatchBB = L->getLoopLatch();
SmallVector<PHINode *, 4> PHIs;
for (BasicBlock::iterator BI = L->getHeader()->begin(),
BE = L->getHeader()->end(); BI != BE; ++BI) {
@@ -2000,8 +2001,8 @@ void LoopStrengthReduce::OptimizeIVType(Loop *L) {
// Remove old PHI and increment instruction.
SE->deleteValueFromRecords(PHI);
- PHI->removeIncomingValue(Entry);
- PHI->removeIncomingValue(Latch);
+ PHI->removeIncomingValue(LatchBB);
+ PHI->removeIncomingValue(LPH);
SE->deleteValueFromRecords(Incr);
Incr->eraseFromParent();
}