[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 8 18:35:00 PDT 2002
Changes in directory llvm/lib/VMCore:
Constants.cpp updated: 1.28 -> 1.29
---
Log message:
Fix bug: Assembler/2002-10-08-LargeArrayPerformance.ll by using
std::vector::reserve when possible
---
Diffs of the changes:
Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.28 llvm/lib/VMCore/Constants.cpp:1.29
--- llvm/lib/VMCore/Constants.cpp:1.28 Fri Sep 13 17:24:57 2002
+++ llvm/lib/VMCore/Constants.cpp Tue Oct 8 18:33:52 2002
@@ -191,7 +191,8 @@
ConstantArray::ConstantArray(const ArrayType *T,
const std::vector<Constant*> &V) : Constant(T) {
- for (unsigned i = 0; i < V.size(); i++) {
+ Operands.reserve(V.size());
+ for (unsigned i = 0, e = V.size(); i != e; ++i) {
assert(V[i]->getType() == T->getElementType());
Operands.push_back(Use(V[i], this));
}
@@ -202,7 +203,8 @@
const StructType::ElementTypes &ETypes = T->getElementTypes();
assert(V.size() == ETypes.size() &&
"Invalid initializer vector for constant structure");
- for (unsigned i = 0; i < V.size(); i++) {
+ Operands.reserve(V.size());
+ for (unsigned i = 0, e = V.size(); i != e; ++i) {
assert(V[i]->getType() == ETypes[i]);
Operands.push_back(Use(V[i], this));
}
More information about the llvm-commits
mailing list