aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-05 01:02:04 +0000
committerChris Lattner <sabre@nondot.org>2005-08-05 01:02:04 +0000
commit1325b42a7dc38e99e1aa3531395d1678b31d3c55 (patch)
treeb114a77fefb3f9cbb45a3f817c42a9394ef27aa7
parentb3b48e11dad271bd236aaec1a601f4a02bfb5374 (diff)
downloadexternal_llvm-1325b42a7dc38e99e1aa3531395d1678b31d3c55.tar.gz
external_llvm-1325b42a7dc38e99e1aa3531395d1678b31d3c55.tar.bz2
external_llvm-1325b42a7dc38e99e1aa3531395d1678b31d3c55.zip
Now that hasConstantValue is more careful w.r.t. returning values that only
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
-rw-r--r--lib/VMCore/BasicBlock.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 407080cf68..bdcfb365c6 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -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();
+ }
}
}
}