eliminate vector-related allocations
authorChris Lattner <sabre@nondot.org>
Tue, 13 Feb 2007 06:01:22 +0000 (06:01 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 Feb 2007 06:01:22 +0000 (06:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34223 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/IntrinsicLowering.cpp
lib/ExecutionEngine/JIT/JIT.cpp

index 51879daa7c7e56fa077d4f6f11b9b425a901025c..35e20e3c694af4bbf262a5e4be076477ac81d8dc 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/CodeGen/IntrinsicLowering.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/ADT/SmallVector.h"
 using namespace llvm;
 
 template <class ArgIt>
@@ -52,8 +53,9 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
                                     FunctionType::get(RetTy, ParamTys, false));
   }
 
-  std::vector<Value*> Operands(ArgBegin, ArgEnd);
-  CallInst *NewCI = new CallInst(FCache, Operands, CI->getName(), CI);
+  SmallVector<Value*, 8> Operands(ArgBegin, ArgEnd);
+  CallInst *NewCI = new CallInst(FCache, &Operands[0], Operands.size(),
+                                 CI->getName(), CI);
   if (!CI->use_empty())
     CI->replaceAllUsesWith(NewCI);
   return NewCI;
index eabe4ea075979708aa5966cfd46ce6f6c0c0e294..ca3dbb96a7b2959491a4d7c4985bd08e1a0353bc 100644 (file)
@@ -187,7 +187,7 @@ GenericValue JIT::runFunction(Function *F,
 
   // Convert all of the GenericValue arguments over to constants.  Note that we
   // currently don't support varargs.
-  std::vector<Value*> Args;
+  SmallVector<Value*, 8> Args;
   for (unsigned i = 0, e = ArgValues.size(); i != e; ++i) {
     Constant *C = 0;
     const Type *ArgTy = FTy->getParamType(i);
@@ -225,7 +225,7 @@ GenericValue JIT::runFunction(Function *F,
     Args.push_back(C);
   }
 
-  CallInst *TheCall = new CallInst(F, Args, "", StubBB);
+  CallInst *TheCall = new CallInst(F, &Args[0], Args.size(), "", StubBB);
   TheCall->setTailCall();
   if (TheCall->getType() != Type::VoidTy)
     new ReturnInst(TheCall, StubBB);             // Return result of the call.