[PATCH] Fix PR22222

David Majnemer david.majnemer at gmail.com
Wed Jan 14 18:50:44 PST 2015


On Wednesday, January 14, 2015, Sanjoy Das <sanjoy at playingwithpointers.com>
wrote:

> In http://reviews.llvm.org/D6979#108906, @majnemer wrote:
>
> > LGTM.
> >
> > Out of curiosity, why isn't this implemented like the code here:
> >
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?revision=222213&view=markup#l1733
>
>
> In retrospect, that would have been the right way to do it.  Directly
> checking zext(A + B) == zext(A) + zext(B) does not catch
> `test.unsigned.add.0` (in the test file), but I think that is fixable.
>
> Moreover, the approach you pointed out can be easily generalized to
> subtraction.  I don't think you can easily generalize it to multiplication
> (since checking for `BitWidth + 1` may not be sufficient in that case); but
> we're not handling multiplication anyway.


Multiplication can be handled the same way but you must use bitwidth * 2
instead of bitwidth+1.


>
> I'll try to implement the approach `LinearFunctionTestReplace` and send in
> a patch for review sometime this week.
>
>
> REPOSITORY
>   rL LLVM
>
> http://reviews.llvm.org/D6979
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150114/3f9c1938/attachment.html>


More information about the llvm-commits mailing list