[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp LowerPacked.cpp ScalarReplAggregates.cpp

Chris Lattner sabre at nondot.org
Mon Feb 12 14:57:00 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.629 -> 1.630
LowerPacked.cpp updated: 1.16 -> 1.17
ScalarReplAggregates.cpp updated: 1.72 -> 1.73
---
Log message:

stop using methods that take vectors.


---
Diffs of the changes:  (+14 -9)

 InstructionCombining.cpp |    3 ++-
 LowerPacked.cpp          |    4 ++--
 ScalarReplAggregates.cpp |   16 ++++++++++------
 3 files changed, 14 insertions(+), 9 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.629 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.630
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.629	Sat Feb 10 19:23:03 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Feb 12 16:56:41 2007
@@ -7832,7 +7832,8 @@
     }
 
     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: llvm/lib/Transforms/Scalar/LowerPacked.cpp
diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.16 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.17
--- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.16	Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/Scalar/LowerPacked.cpp	Mon Feb 12 16:56:41 2007
@@ -231,7 +231,7 @@
 
             // Get the pointer
             Value* val = new GetElementPtrInst(array,
-                                               Idx,
+                                               &Idx[0], Idx.size(),
                                                LI.getName() +
                                                ".ge." + utostr(i),
                                                &LI);
@@ -329,7 +329,7 @@
             // 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: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.72 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.73
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.72	Sat Feb 10 19:23:03 2007
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp	Mon Feb 12 16:56:41 2007
@@ -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 @@
         // 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 @@
                               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.






More information about the llvm-commits mailing list