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

Chris Lattner clattner at apple.com
Tue Jun 24 22:03:56 PDT 2008


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




More information about the llvm-commits mailing list