[llvm-commits] [patch][pr12251] Use the range metadata in computeMaskedBits and add an optimization to InstructionSimplify.

Duncan Sands baldrick at free.fr
Mon Mar 26 03:15:50 PDT 2012


On 26/03/12 03:48, Rafael EspĂ­ndola wrote:
>>> +  for (unsigned i = 0; i<  NumRanges; ++i) {
>>> +    ConstantInt *Lower = cast<ConstantInt>(Ranges.getOperand(2*i + 0));
>>> +    ConstantInt *Upper = cast<ConstantInt>(Ranges.getOperand(2*i + 1));
>>> +    ConstantRange Range(Lower->getValue(), Upper->getValue());
>>> +    if (Range.isWrappedSet())
>>> +      MinLeadingZeros = 0; // -1 has no zeros
>>
>>
>> here you could break out of the loop.
>
> True, but for all current uses NumRanges is 1.

True, but why not be future proof?

Ciao, Duncan.



More information about the llvm-commits mailing list