From 68ee736694c9e485de6729ec657f5a993e5f1027 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 5 Aug 2005 01:04:30 +0000 Subject: [PATCH] now that hasConstantValue defaults to only returning values that dominate the PHI node, this ugly code can vanish. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22672 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Scalar/InstructionCombining.cpp | 21 ++----------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 5767afc4099..4ee833bf6f7 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4401,25 +4401,8 @@ static bool DeadPHICycle(PHINode *PN, std::set &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(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(I)) - for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) - if (isa(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