[PATCH] Move transforms from InstCombine to InstSimplify

David Majnemer david.majnemer at gmail.com
Fri Jul 12 14:56:58 PDT 2013


On Thu, Jul 11, 2013 at 10:42 PM, Duncan Sands <duncan.sands at gmail.com>wrote:

> Hi David,
>
>
>          +      } else {
>>         +        // 'shl CI2, x' produces [CI2, CI2 << (Width-1)]
>>         +        Lower = CI2Value;
>>         +        Upper = CI2Value.shl(Width - 1) + 1;
>>
>>
>>     this one seems wrong to me.  Consider for example CI2 (in binary)
>> equal to
>>        10001000
>>     Then Lower=10001000, Upper=00000001, but a left-shift by 1 of CI2 is
>>     00010000 which is not in the range Lower .. Upper.
>>
>>
>> Thanks, I've updated the patch so that we will set Lower to zero and
>> Upper to
>> CI2 << CLZ(CI2) which is conservative but, AFAIK, correct.
>>
>
> are you sure?
>
> 10110000
>
> Lower = 0, Upper = 10110000, but shifting left by two gives 11000000 which
> is
> out of the range.
>

Right again. I'm giving up on the general case, at least for now.


>
> Ciao, Duncan.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130712/91ec5c32/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shfcmpv4.diff
Type: application/octet-stream
Size: 5282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130712/91ec5c32/attachment.obj>


More information about the llvm-commits mailing list