1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

While removing PHI, use basicblock to identify incoming value.

llvm-svn: 55678
This commit is contained in:
Devang Patel 2008-09-03 00:02:42 +00:00
parent 5659d2508e
commit df5dce4aa8

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();
} }