[PATCH] [IR] Fix the definition of 'shl nsw'

Sanjoy Das sanjoy at playingwithpointers.com
Tue Apr 7 23:52:14 PDT 2015


I'm fine keeping the sign-bit based definition as a corollary,
especially if we can prove and list the edge cases.

I don't think that _is_ the first-principles definition though, given
that we're adding exceptions to it just so that multiplication based
definition works.

On Tue, Apr 7, 2015 at 11:46 PM, David Majnemer
<david.majnemer at gmail.com> wrote:
> In http://reviews.llvm.org/D8890#153126, @chandlerc wrote:
>
>> FWIW, I really liked having a definition explicit in terms of what kinds of bits can be shifted out. I think its good to *both* define this from first principles of where bits move in the shift operation, *and* how it should relate to an NSW multiply by a power of two.
>>
>> Unsure when after when we chatted this wording went away, but I'd really like to keep it.
>
>
> The explicit definition gets hairy very quickly.  It didn't correctly handle `shl nsw i32 1073741824, 1` or `shl nsw i32 -1, 31`.
>
>
> http://reviews.llvm.org/D8890
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>




More information about the llvm-commits mailing list