[llvm-commits] [llvm] r52700 - /llvm/trunk/lib/VMCore/Constants.cpp

Owen Anderson resistor at mac.com
Tue Jun 24 22:09:54 PDT 2008


No, it's significantly slower because resize() has to zero the elements.

--Owen

On Jun 24, 2008, at 10:03 PM, Chris Lattner wrote:

>
> On Jun 24, 2008, at 6:05 PM, Owen Anderson wrote:
>
>> Author: resistor
>> Date: Tue Jun 24 20:05:05 2008
>> New Revision: 52700
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=52700&view=rev
>> Log:
>> Use push_back rather than operator[], which is incorrect in this
>> cases. Unfortunately, this slow the testcase down a little bit,
>> but only marginally.
>
> Is resize + [] faster?
>
> -Chris
>
>>
>>
>> Modified:
>>   llvm/trunk/lib/VMCore/Constants.cpp
>>
>> Modified: llvm/trunk/lib/VMCore/Constants.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52700&r1=52699&r2=52700&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/VMCore/Constants.cpp (original)
>> +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Jun 24 20:05:05 2008
>> @@ -1380,7 +1380,7 @@
>>  std::string Result;
>>  Result.reserve(getNumOperands());
>>  for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
>> -    Result[i] = (char)cast<ConstantInt>(getOperand(i))-
>>> getZExtValue();
>> +    Result.push_back((char)cast<ConstantInt>(getOperand(i))-
>>> getZExtValue());
>>  return Result;
>> }
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080624/67ca35e8/attachment.bin>


More information about the llvm-commits mailing list