[PATCH] [IR] Fix the definition of 'shl nsw'
Chandler Carruth
chandlerc at gmail.com
Wed Apr 8 00:05:32 PDT 2015
In http://reviews.llvm.org/D8890#153142, @sanjoy wrote:
> 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.
Not the first-principles *motivation*. I'm not suggesting that the bit-math is what is the primary motivation or the most important consequences. I'm suggesting that it doesn't rely on reasoning about anything other than the basic bit shifting operation, and I find it very nice to define in those terms as the basis, and merely state the equivalence that is intended (and motivating that particular definition). We can (and probably should!) even call out that this *is* a strange definition but that it is specifically chosen to establish this equivalence.
http://reviews.llvm.org/D8890
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list