use smallvector instead of vector to make constant folding a bit more efficient

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33672 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-01-30 23:15:19 +00:00
parent 6c1f56574c
commit cd2492e6ff

View File

@ -33,6 +33,7 @@
#include "llvm/Support/CallSite.h" #include "llvm/Support/CallSite.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/ADT/hash_map" #include "llvm/ADT/hash_map"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
#include <algorithm> #include <algorithm>
@ -1093,7 +1094,7 @@ void SCCPSolver::visitCallSite(CallSite CS) {
return; return;
} }
std::vector<Constant*> Operands; SmallVector<Constant*, 8> Operands;
Operands.reserve(I->getNumOperands()-1); Operands.reserve(I->getNumOperands()-1);
for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end(); for (CallSite::arg_iterator AI = CS.arg_begin(), E = CS.arg_end();
@ -1109,7 +1110,7 @@ void SCCPSolver::visitCallSite(CallSite CS) {
Operands.push_back(State.getConstant()); Operands.push_back(State.getConstant());
} }
if (Constant *C = ConstantFoldCall(F, Operands)) if (Constant *C = ConstantFoldCall(F, &Operands[0], Operands.size()))
markConstant(IV, I, C); markConstant(IV, I, C);
else else
markOverdefined(IV, I); markOverdefined(IV, I);