diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index 026dbe3e803..0195231701f 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -82,9 +82,8 @@ bool IPCP::processFunction(Function &F) { if (*AI == &F) return false; // Passes the function into itself if (!ArgumentConstants[i].second) { - if (isa(*AI) || isa(*AI)) { + if (isa(*AI)) { Constant *C = dyn_cast(*AI); - if (!C) C = ConstantPointerRef::get(cast(*AI)); if (!ArgumentConstants[i].first) ArgumentConstants[i].first = C; @@ -114,9 +113,6 @@ bool IPCP::processFunction(Function &F) { if (!ArgumentConstants[i].second && !AI->use_empty()) { assert(ArgumentConstants[i].first && "Unknown constant value!"); Value *V = ArgumentConstants[i].first; - if (ConstantPointerRef *CPR = dyn_cast(V)) - V = CPR->getValue(); - AI->replaceAllUsesWith(V); ++NumArgumentsProped; MadeChange = true; diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index c0d97c5515b..791b21356e6 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -78,8 +78,7 @@ static unsigned CountCodeReductionForConstant(Value *V) { Instruction &Inst = cast(**UI); bool AllOperandsConstant = true; for (unsigned i = 0, e = Inst.getNumOperands(); i != e; ++i) - if (!isa(Inst.getOperand(i)) && - !isa(Inst.getOperand(i)) && Inst.getOperand(i) != V) { + if (!isa(Inst.getOperand(i)) && Inst.getOperand(i) != V) { AllOperandsConstant = false; break; } @@ -205,7 +204,7 @@ int SimpleInliner::getInlineCost(CallSite CS) { // If this is a constant being passed into the function, use the argument // weights calculated for the callee to determine how much will be folded // away with this information. - } else if (isa(I) || isa(I)) { + } else if (isa(I)) { if (ArgNo < CalleeFI.ArgumentWeights.size()) InlineCost -= CalleeFI.ArgumentWeights[ArgNo].ConstantWeight; } diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index 7d93c50373e..c24941320fc 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -78,8 +78,7 @@ bool GCSE::runOnFunction(Function &F) { VN.getEqualNumberNodes(AI, EqualValues); if (!EqualValues.empty()) { for (unsigned i = 0, e = EqualValues.size(); i != e; ++i) - if (isa(EqualValues[i]) || - isa(EqualValues[i])) { + if (isa(EqualValues[i])) { AI->replaceAllUsesWith(EqualValues[i]); ++NumArgsRepl; Changed = true; @@ -186,7 +185,7 @@ void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) { // If we are not replacing the instruction with a constant, we cannot do // anything special. - if (!isa(V)) { + if (!isa(V) || isa(V)) { I->replaceAllUsesWith(V); if (InvokeInst *II = dyn_cast(I)) { diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index c3ed43d1f0c..cc28e54c374 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -211,8 +211,7 @@ static bool DominatesMergePoint(Value *V, BasicBlock *BB, bool AllowAggressive){ if (cast(I)->isVolatile()) return false; if (!isa(I->getOperand(0)) && - !isa(I->getOperand(0)) && - !isa(I->getOperand(0))) + !isa(I->getOperand(0))) return false; // Finally, we have to check to make sure there are no instructions