summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-05 01:04:30 +0000
committerChris Lattner <sabre@nondot.org>2005-08-05 01:04:30 +0000
commit9f9c260b8c91f61e2ddcdfc3d5633578fa3a3664 (patch)
tree4991bcf72eb63c4f53280a0a1e2dfc1e1de59b24 /llvm/lib/Transforms
parent37774affb1da456f4715bc607904659f694d730d (diff)
downloadbcm5719-llvm-9f9c260b8c91f61e2ddcdfc3d5633578fa3a3664.tar.gz
bcm5719-llvm-9f9c260b8c91f61e2ddcdfc3d5633578fa3a3664.zip
now that hasConstantValue defaults to only returning values that dominate
the PHI node, this ugly code can vanish. llvm-svn: 22672
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp21
1 files changed, 2 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 5767afc4099..4ee833bf6f7 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4401,25 +4401,8 @@ static bool DeadPHICycle(PHINode *PN, std::set<PHINode*> &PotentiallyDeadPHIs) {
// PHINode simplification
//
Instruction *InstCombiner::visitPHINode(PHINode &PN) {
- if (Value *V = PN.hasConstantValue()) {
- // If V is an instruction, we have to be certain that it dominates PN.
- // However, because we don't have dom info, we can't do a perfect job.
- if (Instruction *I = dyn_cast<Instruction>(V)) {
- // We know that the instruction dominates the PHI if there are no undef
- // values coming in. If the instruction is defined in the entry block,
- // and is not an invoke, we know it is ok.
- if (I->getParent() != &I->getParent()->getParent()->front() ||
- isa<InvokeInst>(I))
- for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i)
- if (isa<UndefValue>(PN.getIncomingValue(i))) {
- V = 0;
- break;
- }
- }
-
- if (V)
- return ReplaceInstUsesWith(PN, V);
- }
+ if (Value *V = PN.hasConstantValue())
+ return ReplaceInstUsesWith(PN, V);
// If the only user of this instruction is a cast instruction, and all of the
// incoming values are constants, change this PHI to merge together the casted
OpenPOWER on IntegriCloud