eliminate temporary vectors.
authorChris Lattner <sabre@nondot.org>
Sat, 10 Feb 2007 20:31:59 +0000 (20:31 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 10 Feb 2007 20:31:59 +0000 (20:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34161 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter.cpp
lib/CodeGen/MachOWriter.cpp

index 2d7dec40f751b29bcea64643db52bfb118c89072..4e7db4ef529033ca18df2cadbcb3cbcf18152a5d 100644 (file)
@@ -613,8 +613,9 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
     case Instruction::GetElementPtr: {
       // generate a symbolic expression for the byte address
       const Constant *ptrVal = CE->getOperand(0);
-      std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
-      if (int64_t Offset = TD->getIndexedOffset(ptrVal->getType(), idxVec)) {
+      SmallVector<Value*, 8> idxVec(CE->op_begin()+1, CE->op_end());
+      if (int64_t Offset = TD->getIndexedOffset(ptrVal->getType(), &idxVec[0],
+                                                idxVec.size())) {
         if (Offset)
           O << "(";
         EmitConstantValueOnly(ptrVal);
index 384dd3ee54771aae135340794757b87e24d56fd0..fe9d997ec51af5c1e9b62ef302c42e0433d6e0c3 100644 (file)
@@ -779,9 +779,9 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
       //
       switch (CE->getOpcode()) {
       case Instruction::GetElementPtr: {
-        std::vector<Value*> Indexes(CE->op_begin()+1, CE->op_end());
+        SmallVector<Value*, 8> Indices(CE->op_begin()+1, CE->op_end());
         ScatteredOffset = TD->getIndexedOffset(CE->getOperand(0)->getType(),
-                                               Indexes);
+                                               &Indices[0], Indices.size());
         WorkList.push_back(CPair(CE->getOperand(0), PA));
         break;
       }