Now that hasConstantValue is more careful w.r.t. returning values that only
authorChris Lattner <sabre@nondot.org>
Fri, 5 Aug 2005 01:02:04 +0000 (01:02 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 5 Aug 2005 01:02:04 +0000 (01:02 +0000)
dominate the PHI node, this code can go away.  This also makes passes more
aggressive, e.g. implementing Transforms/CondProp/phisimplify2.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22670 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/BasicBlock.cpp

index 407080cf68b98ed68485e963f4a61fcaae3fdaef..bdcfb365c6ede372c37280f95ae4d5e0f3c988fe 100644 (file)
@@ -193,11 +193,10 @@ 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())
-        if (!isa<Instruction>(PNV)) {
-          PN->replaceAllUsesWith(PNV);
-          PN->eraseFromParent();
-        }
+      if (Value *PNV = PN->hasConstantValue()) {
+        PN->replaceAllUsesWith(PNV);
+        PN->eraseFromParent();
+      }
     }
   }
 }