aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-02-16 20:53:06 +0000
committerDuncan Sands <baldrick@free.fr>2008-02-16 20:53:06 +0000
commitb3a94608b3b9bde5d6e79b88cf5c09ad212b29ce (patch)
tree5c12a135ca8d2c06abb6bbe83f7e378db45aa2b0
parentd497d9fab6e90499c703f3e672ec001dbfa074f9 (diff)
Some micro-optimizations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47219 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/ParameterAttributes.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/VMCore/ParameterAttributes.cpp b/lib/VMCore/ParameterAttributes.cpp
index b099c8fed8..344e52c59a 100644
--- a/lib/VMCore/ParameterAttributes.cpp
+++ b/lib/VMCore/ParameterAttributes.cpp
@@ -124,6 +124,7 @@ ParamAttrsList::getModified(const ParamAttrsList *PAL,
if (!PAL) {
// Strip any instances of ParamAttr::None from modVec before calling 'get'.
ParamAttrsVector newVec;
+ newVec.reserve(modVec.size());
for (unsigned i = 0, e = modVec.size(); i < e; ++i)
if (modVec[i].attrs != ParamAttr::None)
newVec.push_back(modVec[i]);
@@ -175,8 +176,8 @@ ParamAttrsList::includeAttrs(const ParamAttrsList *PAL,
if (NewAttrs == OldAttrs)
return PAL;
- ParamAttrsVector modVec;
- modVec.push_back(ParamAttrsWithIndex::get(idx, NewAttrs));
+ ParamAttrsVector modVec(1);
+ modVec[0] = ParamAttrsWithIndex::get(idx, NewAttrs);
return getModified(PAL, modVec);
}
@@ -188,8 +189,8 @@ ParamAttrsList::excludeAttrs(const ParamAttrsList *PAL,
if (NewAttrs == OldAttrs)
return PAL;
- ParamAttrsVector modVec;
- modVec.push_back(ParamAttrsWithIndex::get(idx, NewAttrs));
+ ParamAttrsVector modVec(1);
+ modVec[0] = ParamAttrsWithIndex::get(idx, NewAttrs);
return getModified(PAL, modVec);
}