Some micro-optimizations.
authorDuncan Sands <baldrick@free.fr>
Sat, 16 Feb 2008 20:53:06 +0000 (20:53 +0000)
committerDuncan Sands <baldrick@free.fr>
Sat, 16 Feb 2008 20:53:06 +0000 (20:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47219 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/ParameterAttributes.cpp

index b099c8fed860e5168ce3cd2861cb237ac5257c6c..344e52c59a470eef1e21d68d7eaab431a5b4772d 100644 (file)
@@ -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);
 }