mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-19 19:31:50 +00:00
Preallocate vector, avoid unnecessary vector growth.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109971 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
57dba1cf53
commit
ad2b04c07f
@ -526,6 +526,7 @@ Constant* ConstantArray::get(const ArrayType* T, Constant* const* Vals,
|
||||
Constant* ConstantArray::get(LLVMContext &Context, StringRef Str,
|
||||
bool AddNull) {
|
||||
std::vector<Constant*> ElementVals;
|
||||
ElementVals.reserve(Str.size() + size_t(AddNull));
|
||||
for (unsigned i = 0; i < Str.size(); ++i)
|
||||
ElementVals.push_back(ConstantInt::get(Type::getInt8Ty(Context), Str[i]));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user