Fix bug: ADCE/2003-04-25-PHIPostDominateProblem.ll

llvm-svn: 5952
This commit is contained in:
Chris Lattner 2003-04-25 22:53:27 +00:00
parent b093bf312f
commit b68a34eb3f
1 changed files with 10 additions and 9 deletions

View File

@ -310,15 +310,16 @@ bool ADCE::doADCE() {
// should be identical to the incoming values for LastDead. // should be identical to the incoming values for LastDead.
// //
for (BasicBlock::iterator II = NextAlive->begin(); for (BasicBlock::iterator II = NextAlive->begin();
PHINode *PN = dyn_cast<PHINode>(II); ++II) { PHINode *PN = dyn_cast<PHINode>(II); ++II)
// Get the incoming value for LastDead... if (LiveSet.count(PN)) { // Only modify live phi nodes
int OldIdx = PN->getBasicBlockIndex(LastDead); // Get the incoming value for LastDead...
assert(OldIdx != -1 && "LastDead is not a pred of NextAlive!"); int OldIdx = PN->getBasicBlockIndex(LastDead);
Value *InVal = PN->getIncomingValue(OldIdx); assert(OldIdx != -1 &&"LastDead is not a pred of NextAlive!");
Value *InVal = PN->getIncomingValue(OldIdx);
// Add an incoming value for BB now...
PN->addIncoming(InVal, BB); // Add an incoming value for BB now...
} PN->addIncoming(InVal, BB);
}
} }
} }