stop using methods that take vectors.
authorChris Lattner <sabre@nondot.org>
Mon, 12 Feb 2007 22:56:41 +0000 (22:56 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 12 Feb 2007 22:56:41 +0000 (22:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34205 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/IPO/GlobalOpt.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/LowerPacked.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Utils/LowerInvoke.cpp

index 4c1b2c3f28137c97177c7fcc1ac60c2f66e78657..86f3f74db32c79e17481844b0c007ab86949afa3 100644 (file)
@@ -370,7 +370,9 @@ Function *ArgPromotion::DoPromotion(Function *F,
       // Add a parameter to the function for each element passed in.
       for (ScalarizeTable::iterator SI = ArgIndices.begin(),
              E = ArgIndices.end(); SI != E; ++SI)
-        Params.push_back(GetElementPtrInst::getIndexedType(I->getType(), *SI));
+        Params.push_back(GetElementPtrInst::getIndexedType(I->getType(),
+                                                           &(*SI)[0],
+                                                           SI->size()));
 
       if (ArgIndices.size() == 1 && ArgIndices.begin()->empty())
         ++NumArgumentsPromoted;
@@ -421,7 +423,8 @@ Function *ArgPromotion::DoPromotion(Function *F,
           Value *V = *AI;
           LoadInst *OrigLoad = OriginalLoads[*SI];
           if (!SI->empty()) {
-            V = new GetElementPtrInst(V, *SI, V->getName()+".idx", Call);
+            V = new GetElementPtrInst(V, &(*SI)[0], SI->size(),
+                                      V->getName()+".idx", Call);
             AA.copyValue(OrigLoad->getOperand(0), V);
           }
           Args.push_back(new LoadInst(V, V->getName()+".val", Call));
index f5b12712f3aec2bbe7a5e37e0df2505a3a5e69c1..e2e707c4d8325a9819c72af32686ca650edc6ee6 100644 (file)
@@ -908,11 +908,12 @@ static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Ptr,
     Value *NewPtr = InsertedLoadsForPtr[FieldNo];
 
     // Create the new GEP idx vector.
-    std::vector<Value*> GEPIdx;
+    SmallVector<Value*, 8> GEPIdx;
     GEPIdx.push_back(GEPI->getOperand(1));
-    GEPIdx.insert(GEPIdx.end(), GEPI->op_begin()+3, GEPI->op_end());
+    GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end());
 
-    Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx, GEPI->getName(), GEPI);
+    Value *NGEPI = new GetElementPtrInst(NewPtr, &GEPIdx[0], GEPIdx.size(),
+                                         GEPI->getName(), GEPI);
     GEPI->replaceAllUsesWith(NGEPI);
     GEPI->eraseFromParent();
   }
index 37f4c75a0972ffefd1bdbf88474e78803938a66f..556c054a9941da2f5eb2e885e53f7cd365ce7dc2 100644 (file)
@@ -7832,7 +7832,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
     }
 
     if (!Indices.empty())
-      return new GetElementPtrInst(SrcGEPOperands[0], Indices, GEP.getName());
+      return new GetElementPtrInst(SrcGEPOperands[0], &Indices[0],
+                                   Indices.size(), GEP.getName());
 
   } else if (GlobalValue *GV = dyn_cast<GlobalValue>(PtrOp)) {
     // GEP of global variable.  If all of the indices for this GEP are
index 116cccad62aaec70a0a6575cac15818f0d4f8d3d..72307a18a40c9706d1fcc84f5523dc3d0fa1840d 100644 (file)
@@ -231,7 +231,7 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
 
             // Get the pointer
             Value* val = new GetElementPtrInst(array,
-                                               Idx,
+                                               &Idx[0], Idx.size(),
                                                LI.getName() +
                                                ".ge." + utostr(i),
                                                &LI);
@@ -329,7 +329,7 @@ void LowerPacked::visitStoreInst(StoreInst& SI)
             // Generate the indices for getelementptr
             Idx[1] = ConstantInt::get(Type::Int32Ty,i);
             Value* val = new GetElementPtrInst(array,
-                                               Idx,
+                                               &Idx[0], Idx.size(),
                                                "store.ge." +
                                                utostr(i) + ".",
                                                &SI);
index e77eca11ca047aaa45744a764ad7efb5808a6701..bd0cf7476c86bed3776d6f54f4113aa7f8ba0b57 100644 (file)
@@ -33,6 +33,7 @@
 #include "llvm/Support/GetElementPtrTypeIterator.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Compiler.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringExtras.h"
 using namespace llvm;
@@ -224,10 +225,11 @@ bool SROA::performScalarRepl(Function &F) {
         // getelement ptr instruction to finish the indexing.  This may be
         // expanded itself once the worklist is rerun.
         //
-        std::vector<Value*> NewArgs;
+        SmallVector<Value*, 8> NewArgs;
         NewArgs.push_back(Constant::getNullValue(Type::Int32Ty));
-        NewArgs.insert(NewArgs.end(), GEPI->op_begin()+3, GEPI->op_end());
-        RepValue = new GetElementPtrInst(AllocaToUse, NewArgs, "", GEPI);
+        NewArgs.append(GEPI->op_begin()+3, GEPI->op_end());
+        RepValue = new GetElementPtrInst(AllocaToUse, &NewArgs[0],
+                                         NewArgs.size(), "", GEPI);
         RepValue->takeName(GEPI);
       }
 
@@ -397,12 +399,14 @@ void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) {
                               Constant::getNullValue(I.getOperand()->getType()),
              "isone", GEPI);
           // Insert the new GEP instructions, which are properly indexed.
-          std::vector<Value*> Indices(GEPI->op_begin()+1, GEPI->op_end());
+          SmallVector<Value*, 8> Indices(GEPI->op_begin()+1, GEPI->op_end());
           Indices[1] = Constant::getNullValue(Type::Int32Ty);
-          Value *ZeroIdx = new GetElementPtrInst(GEPI->getOperand(0), Indices,
+          Value *ZeroIdx = new GetElementPtrInst(GEPI->getOperand(0),
+                                                 &Indices[0], Indices.size(),
                                                  GEPI->getName()+".0", GEPI);
           Indices[1] = ConstantInt::get(Type::Int32Ty, 1);
-          Value *OneIdx = new GetElementPtrInst(GEPI->getOperand(0), Indices,
+          Value *OneIdx = new GetElementPtrInst(GEPI->getOperand(0),
+                                                &Indices[0], Indices.size(),
                                                 GEPI->getName()+".1", GEPI);
           // Replace all loads of the variable index GEP with loads from both
           // indexes and a select.
index 0da30e2428acdb893ace70a05d85f3087b9656e0..5a4408f802fb3f2dd75a695be6cbb39228ac48b6 100644 (file)
@@ -441,7 +441,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
     std::vector<Value*> Idx;
     Idx.push_back(Constant::getNullValue(Type::Int32Ty));
     Idx.push_back(ConstantInt::get(Type::Int32Ty, 1));
-    OldJmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, "OldBuf",
+    OldJmpBufPtr = new GetElementPtrInst(JmpBuf, &Idx[0], 2, "OldBuf",
                                          EntryBB->getTerminator());
 
     // Copy the JBListHead to the alloca.
@@ -480,7 +480,8 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
                                                      "setjmp.cont");
 
     Idx[1] = ConstantInt::get(Type::Int32Ty, 0);
-    Value *JmpBufPtr = new GetElementPtrInst(JmpBuf, Idx, "TheJmpBuf",
+    Value *JmpBufPtr = new GetElementPtrInst(JmpBuf, &Idx[0], Idx.size(),
+                                             "TheJmpBuf",
                                              EntryBB->getTerminator());
     Value *SJRet = new CallInst(SetJmpFn, JmpBufPtr, "sjret",
                                 EntryBB->getTerminator());
@@ -530,7 +531,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
   std::vector<Value*> Idx;
   Idx.push_back(Constant::getNullValue(Type::Int32Ty));
   Idx.push_back(ConstantInt::get(Type::Int32Ty, 0));
-  Idx[0] = new GetElementPtrInst(BufPtr, Idx, "JmpBuf", UnwindBlock);
+  Idx[0] = new GetElementPtrInst(BufPtr, &Idx[0], 2, "JmpBuf", UnwindBlock);
   Idx[1] = ConstantInt::get(Type::Int32Ty, 1);
   new CallInst(LongJmpFn, Idx, "", UnwindBlock);
   new UnreachableInst(UnwindBlock);