Remove an unnnecessary LLVMContext argument in
authorDan Gohman <gohman@apple.com>
Mon, 5 Oct 2009 16:36:26 +0000 (16:36 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 5 Oct 2009 16:36:26 +0000 (16:36 +0000)
ConstantFoldLoadThroughGEPConstantExpr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83311 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ConstantFolding.h
lib/Analysis/ConstantFolding.cpp
lib/Transforms/IPO/GlobalOpt.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Utils/CloneFunction.cpp

index 263d42a7ec754b7f5513fad34ce5c71ccbf202a6..9805c6cf28d3d5de5e407ee52d846900a28a8e7e 100644 (file)
@@ -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.
index 16f2c4db4c46f2e20d8c70d1cdd84361d79d7798..1ca7cb05b419545d95ce5be763745943c1f5305b 100644 (file)
@@ -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!
   
index 8edd79ccef926350ee11ab2da33f62e55c99e2ab..a44386e6c15f17aa465561e020b6bfb6cd8bdc5e 100644 (file)
@@ -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<PointerType>(CE->getType())) {
@@ -325,7 +325,7 @@ static bool CleanupConstantGlobalUsers(Value *V, Constant *Init,
         ConstantExpr *CE = 
           dyn_cast_or_null<ConstantExpr>(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<GlobalVariable>(CE->getOperand(0))) {
       GlobalVariable *GV = cast<GlobalVariable>(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.
index 26bf27c0695aa95895ab3cac1e60ee741e66e827..0daa6a5548b0331393e280870b3d966988a306b4 100644 (file)
@@ -11439,8 +11439,7 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
         if (GlobalVariable *GV = dyn_cast<GlobalVariable>(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
index e08bddbe56752d13f8979b8b6e1988b959389d23..b5edf4e058214cb53306fcd3943b17db257544b7 100644 (file)
@@ -1162,8 +1162,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) {
     if (GlobalVariable *GV = dyn_cast<GlobalVariable>(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;
         }
index f042bc9f22cd2fe716ae789facbe242e2bf6f0df..30130fa0a126549793c576cfa95bcd00603591cd 100644 (file)
@@ -346,7 +346,7 @@ ConstantFoldMappedInstruction(const Instruction *I) {
         if (GlobalVariable *GV = dyn_cast<GlobalVariable>(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);