When asked not to delete useless PHIs, really don't delete them, no matter how
[oota-llvm.git] / lib / VMCore / BasicBlock.cpp
index 18a90d6b443d10396aa88024e4fdda150ea74ed7..1b7100c68b21326a791a443318fa7fa5d8a1cfd6 100644 (file)
@@ -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();
       }