OSDN Git Service
(root)
/
android-x86
/
external-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57dba1c
)
Preallocate vector, avoid unnecessary vector growth.
author
Benjamin Kramer
<benny.kra@googlemail.com>
Sun, 1 Aug 2010 11:43:26 +0000
(11:43 +0000)
committer
Benjamin Kramer
<benny.kra@googlemail.com>
Sun, 1 Aug 2010 11:43:26 +0000
(11:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109971
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/VMCore/Constants.cpp
patch
|
blob
|
history
diff --git
a/lib/VMCore/Constants.cpp
b/lib/VMCore/Constants.cpp
index
b833c4e
..
e9a95c9
100644
(file)
--- a/
lib/VMCore/Constants.cpp
+++ b/
lib/VMCore/Constants.cpp
@@
-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]));