aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/BasicBlock.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-05 15:34:10 +0000
committerChris Lattner <sabre@nondot.org>2005-08-05 15:34:10 +0000
commit80f4d88a97e1b925c2ea67f932dd9c3ce1df1f8d (patch)
tree6735cc59fe9005d98cf2d6c9addcacd75c6a0b60 /lib/VMCore/BasicBlock.cpp
parent9a59fbb89606aaefb27f6fe07dcb7c188bf1b3cd (diff)
Fix an iterator invalidation problem when we decide a phi has a constant value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22675 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r--lib/VMCore/BasicBlock.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index bdcfb365c6..66344db150 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -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.