mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
Reserve space in these vectors to prevent having to grow the array too
much. This gets us an addition 0.9% on 445.gobmk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149952 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eb446511ce
commit
a7a3f04eb9
@ -784,9 +784,10 @@ Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) {
|
||||
StructType *ConstantStruct::getTypeForElements(LLVMContext &Context,
|
||||
ArrayRef<Constant*> V,
|
||||
bool Packed) {
|
||||
SmallVector<Type*, 16> EltTypes;
|
||||
for (unsigned i = 0, e = V.size(); i != e; ++i)
|
||||
EltTypes.push_back(V[i]->getType());
|
||||
unsigned VecSize = V.size();
|
||||
SmallVector<Type*, 16> EltTypes(VecSize);
|
||||
for (unsigned i = 0; i != VecSize; ++i)
|
||||
EltTypes[i] = V[i]->getType();
|
||||
|
||||
return StructType::get(Context, EltTypes, Packed);
|
||||
}
|
||||
|
@ -440,11 +440,12 @@ bool FunctionType::isValidArgumentType(Type *ArgTy) {
|
||||
StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
|
||||
bool isPacked) {
|
||||
// FIXME: std::vector is horribly inefficient for this probe.
|
||||
std::vector<Type*> Key;
|
||||
for (unsigned i = 0, e = ETypes.size(); i != e; ++i) {
|
||||
unsigned ETypesSize = ETypes.size();
|
||||
std::vector<Type*> Key(ETypesSize);
|
||||
for (unsigned i = 0, e = ETypesSize; i != e; ++i) {
|
||||
assert(isValidElementType(ETypes[i]) &&
|
||||
"Invalid type for structure element!");
|
||||
Key.push_back(ETypes[i]);
|
||||
Key[i] = ETypes[i];
|
||||
}
|
||||
if (isPacked)
|
||||
Key.push_back(0);
|
||||
|
Loading…
Reference in New Issue
Block a user