[PATCH] D17921: [CorrelatedValuePropagation] Convert an SDiv to a UDiv if both operands are known to be nonnegative

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 14:18:14 PST 2016


reames added a comment.

In http://reviews.llvm.org/D17921#371213, @haicheng wrote:

> In http://reviews.llvm.org/D17921#371030, @reames wrote:
>
> > Why is it a good idea to canonicalize sdiv to udiv in general?  I can see why when the second operand is a special constant, but why in general?
>
>
> Thank you for reviewing the patch.  I do this in general just because InstCombiner::visitSDiv() changes sdiv->udiv when both operands are nonnegative (the last case in visitSDiv()).
>
> I agree that the most profitable case is that the second operand is a PowerOfTwo and I have no problem only taking care of this special case.


I hadn't realized we already canonicalized one to the other.  Given that parts not new, I'm happy to take this patch essentially as is with the previously expressed comments addressed.


Repository:
  rL LLVM

http://reviews.llvm.org/D17921





More information about the llvm-commits mailing list