While removing PHI, use basicblock to identify incoming value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55678 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2008-09-03 00:02:42 +00:00
parent cb7f483d8c
commit c72139134c

View File

@ -1909,6 +1909,7 @@ BinaryOperator *getNewPHIIncrement(BinaryOperator *Incr, PHINode *PHI,
void LoopStrengthReduce::OptimizeIVType(Loop *L) { void LoopStrengthReduce::OptimizeIVType(Loop *L) {
BasicBlock *LPH = L->getLoopPreheader(); BasicBlock *LPH = L->getLoopPreheader();
BasicBlock *LatchBB = L->getLoopLatch();
SmallVector<PHINode *, 4> PHIs; SmallVector<PHINode *, 4> PHIs;
for (BasicBlock::iterator BI = L->getHeader()->begin(), for (BasicBlock::iterator BI = L->getHeader()->begin(),
BE = L->getHeader()->end(); BI != BE; ++BI) { BE = L->getHeader()->end(); BI != BE; ++BI) {
@ -2000,8 +2001,8 @@ void LoopStrengthReduce::OptimizeIVType(Loop *L) {
// Remove old PHI and increment instruction. // Remove old PHI and increment instruction.
SE->deleteValueFromRecords(PHI); SE->deleteValueFromRecords(PHI);
PHI->removeIncomingValue(Entry); PHI->removeIncomingValue(LatchBB);
PHI->removeIncomingValue(Latch); PHI->removeIncomingValue(LPH);
SE->deleteValueFromRecords(Incr); SE->deleteValueFromRecords(Incr);
Incr->eraseFromParent(); Incr->eraseFromParent();
} }