<br><br>On Wednesday, January 14, 2015, Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com">sanjoy@playingwithpointers.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In <a href="http://reviews.llvm.org/D6979#108906" target="_blank">http://reviews.llvm.org/D6979#108906</a>, @majnemer wrote:<br>
<br>
> LGTM.<br>
><br>
> Out of curiosity, why isn't this implemented like the code here:<br>
>  <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?revision=222213&view=markup#l1733" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?revision=222213&view=markup#l1733</a><br>
<br>
<br>
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.<br>
<br>
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.</blockquote><div><br></div><div>Multiplication can be handled the same way but you must use bitwidth * 2 instead of bitwidth+1.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I'll try to implement the approach `LinearFunctionTestReplace` and send in a patch for review sometime this week.<br>
<br>
<br>
REPOSITORY<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D6979" target="_blank">http://reviews.llvm.org/D6979</a><br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
<br>
<br>
</blockquote>