diff --git a/include/llvm/Analysis/ConstantFolding.h b/include/llvm/Analysis/ConstantFolding.h index 263d42a7ec7..9805c6cf28d 100644 --- a/include/llvm/Analysis/ConstantFolding.h +++ b/include/llvm/Analysis/ConstantFolding.h @@ -66,8 +66,7 @@ Constant *ConstantFoldCompareInstOperands(unsigned Predicate, /// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a /// getelementptr constantexpr, return the constant value being addressed by the /// constant expression, or null if something is funny and we can't decide. -Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE, - LLVMContext &Context); +Constant *ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE); /// canConstantFoldCallTo - Return true if its even possible to fold a call to /// the specified function. diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 16f2c4db4c4..1ca7cb05b41 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -606,8 +606,7 @@ Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, /// getelementptr constantexpr, return the constant value being addressed by the /// constant expression, or null if something is funny and we can't decide. Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C, - ConstantExpr *CE, - LLVMContext &Context) { + ConstantExpr *CE) { if (CE->getOperand(1) != Constant::getNullValue(CE->getOperand(1)->getType())) return 0; // Do not allow stepping over the value! diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 8edd79ccef9..a44386e6c15 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -304,7 +304,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init, if (CE->getOpcode() == Instruction::GetElementPtr) { Constant *SubInit = 0; if (Init) - SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE, Context); + SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE); Changed |= CleanupConstantGlobalUsers(CE, SubInit, Context); } else if (CE->getOpcode() == Instruction::BitCast && isa(CE->getType())) { @@ -325,7 +325,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init, ConstantExpr *CE = dyn_cast_or_null(ConstantFoldInstruction(GEP, Context)); if (Init && CE && CE->getOpcode() == Instruction::GetElementPtr) - SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE, Context); + SubInit = ConstantFoldLoadThroughGEPConstantExpr(Init, CE); } Changed |= CleanupConstantGlobalUsers(GEP, SubInit, Context); @@ -2475,8 +2475,7 @@ static bool isSimpleEnoughPointerToCommit(Constant *C, LLVMContext &Context) { if (!CE->isGEPWithNoNotionalOverIndexing()) return false; - return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE, - Context); + return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE); } return false; } @@ -2588,8 +2587,7 @@ static Constant *ComputeLoadResult(Constant *P, isa(CE->getOperand(0))) { GlobalVariable *GV = cast(CE->getOperand(0)); if (GV->hasDefinitiveInitializer()) - return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE, - Context); + return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE); } return 0; // don't know how to evaluate. diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 26bf27c0695..0daa6a5548b 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -11439,8 +11439,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) { if (GlobalVariable *GV = dyn_cast(CE->getOperand(0))) if (GV->isConstant() && GV->hasDefinitiveInitializer()) if (Constant *V = - ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE, - *Context)) + ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE)) return ReplaceInstUsesWith(LI, V); if (CE->getOperand(0)->isNullValue()) { // Insert a new store to null instruction before the load to indicate diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index e08bddbe567..b5edf4e0582 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1162,8 +1162,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) { if (GlobalVariable *GV = dyn_cast(CE->getOperand(0))) if (GV->isConstant() && GV->hasDefinitiveInitializer()) if (Constant *V = - ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE, - *Context)) { + ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE)) { markConstant(IV, &I, V); return; } diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp index f042bc9f22c..30130fa0a12 100644 --- a/lib/Transforms/Utils/CloneFunction.cpp +++ b/lib/Transforms/Utils/CloneFunction.cpp @@ -346,7 +346,7 @@ ConstantFoldMappedInstruction(const Instruction *I) { if (GlobalVariable *GV = dyn_cast(CE->getOperand(0))) if (GV->isConstant() && GV->hasDefinitiveInitializer()) return ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), - CE, Context); + CE); return ConstantFoldInstOperands(I->getOpcode(), I->getType(), &Ops[0], Ops.size(), Context, TD);