[llvm-commits] [llvm] r85478 - /llvm/trunk/lib/Analysis/MemoryBuiltins.cpp

Victor Hernandez vhernandez at apple.com
Mon Nov 2 10:52:12 PST 2009


Duncan,
Thanks for the feedback.  I just committed the pow removal.

Victor

On Oct 30, 2009, at 12:59 AM, Duncan Sands wrote:

> Hi Victor,
>
>> +      unsigned Op1BitWidth = Op1->getType()->getPrimitiveSizeInBits 
>> ();
>
> you could also get the constant int as an APInt and use the  
> getBitWidth
> method.
>
>> +      // check for overflow
>> +      if (Op1Int->getZExtValue() > Op1BitWidth)
>> +        return NULL;
>
> This will cause an assertion failure if Op1Int's value does not fit
> in 64 bits.
>
>> +
>> +      Value* Op1Pow = ConstantInt::get(Context,
>> +                            APInt(Op1BitWidth, 1, false) << Op1Int- 
>> >getValue());
>
> The APInt class has a "set" method that allows you to set a
> particular bit.  I think that would be better.
>
> Ciao,
>
> Duncan.




More information about the llvm-commits mailing list