Fix an iterator invalidation problem when we decide a phi has a constant value

llvm-svn: 22675
This commit is contained in:
Chris Lattner 2005-08-05 15:34:10 +00:00
parent 11e7a5eda7
commit 1749aaa5e6
1 changed files with 2 additions and 1 deletions

View File

@ -189,7 +189,8 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
// Okay, now we know that we need to remove predecessor #pred_idx from all
// PHI nodes. Iterate over each PHI node fixing them up
PHINode *PN;
for (iterator II = begin(); (PN = dyn_cast<PHINode>(II)); ++II) {
for (iterator II = begin(); (PN = dyn_cast<PHINode>(II)); ) {
++II;
PN->removeIncomingValue(Pred, false);
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.