diff options
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 8ad5373..955a028 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -248,10 +248,11 @@ void BasicBlock::removePredecessor(BasicBlock *Pred, // If all incoming values to the Phi are the same, we can replace the Phi // with that value. Value* PNV = 0; - if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue())) { - PN->replaceAllUsesWith(PNV); - PN->eraseFromParent(); - } + if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue())) + if (PNV != PN) { + PN->replaceAllUsesWith(PNV); + PN->eraseFromParent(); + } } } } |