Reserve the size we'll need in advance.
authorOwen Anderson <resistor@mac.com>
Thu, 26 Jun 2008 04:47:41 +0000 (04:47 +0000)
committerOwen Anderson <resistor@mac.com>
Thu, 26 Jun 2008 04:47:41 +0000 (04:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52763 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ValueTracking.cpp

index 3c4e6bc6963e9cc1d4db06993d64a0d15c8029b1..39a91dfc29d626d070ffbdf6ea4c25b1f5886326 100644 (file)
@@ -1004,6 +1004,7 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str) {
   
   // Traverse the constant array from StartIdx (derived above) which is
   // the place the GEP refers to in the array.
+  Str.reserve(NumElts);
   for (unsigned i = StartIdx; i < NumElts; ++i) {
     Constant *Elt = Array->getOperand(i);
     ConstantInt *CI = dyn_cast<ConstantInt>(Elt);