[llvm-commits] [llvm] r60288 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/sdiv-2.ll

Bill Wendling isanbard at gmail.com
Mon Dec 1 00:03:05 PST 2008


On Nov 30, 2008, at 11:50 PM, Duncan Sands wrote:

> Hi Bill,
>
>> -    if ((RHS->getSExtValue() < 0 && RHSNegAPI.slt(TwoToExp - 1)) ||
>> -        (RHS->getSExtValue() > 0 && RHSNegAPI.sgt(TwoToExp *  
>> NegOne))) {
>> +    if ((RHS->getValue().isNegative() && RHSNegAPI.slt(TwoToExp -  
>> 1)) ||
>> +        (RHS->getValue().isNonNegative() && RHSNegAPI.sgt(TwoToExp  
>> * NegOne))) {
>
> before you were testing RHS > 0, but it looks like you are now  
> testing RHS >= 0.
>
>> -          if ((CI->getSExtValue() < 0 && CINegAPI.slt(TwoToExp -  
>> 1)) ||
>> -              (CI->getSExtValue() > 0 && CINegAPI.sgt(TwoToExp *  
>> NegOne)))
>> +          if ((CI->getValue().isNegative() &&  
>> CINegAPI.slt(TwoToExp - 1)) ||
>> +              (CI->getValue().isNonNegative() &&  
>> CINegAPI.sgt(TwoToExp*NegOne)))
>
> Likewise.  No idea if this matters!
>
I think that it will be okay. In the case of RHS == 0, negation of  
that should also be 0 (for integers).

-bw




More information about the llvm-commits mailing list