From 4e744af80c583ee92f0bcff3fdb082bcd8e7386b Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 14 Jun 2006 04:43:14 +0000 Subject: [PATCH] When asked not to delete useless PHIs, really don't delete them, no matter how redundant they are. llvm-svn: 28777 --- llvm/lib/VMCore/BasicBlock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 18a90d6b443d..1b7100c68b21 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -213,7 +213,8 @@ void BasicBlock::removePredecessor(BasicBlock *Pred, PN->removeIncomingValue(Pred, false); // If all incoming values to the Phi are the same, we can replace the Phi // with that value. - if (Value *PNV = PN->hasConstantValue()) { + Value* PNV = 0; + if (!DontDeleteUselessPHIs && (PNV = PN->hasConstantValue())) { PN->replaceAllUsesWith(PNV); PN->eraseFromParent(); }