[llvm-commits] [PATCH] [InstCombine] Allow for urem optimization to occur when the quotient is a power of two that is being zero extended.

Nick Lewycky nlewycky at google.com
Mon Oct 1 15:18:21 PDT 2012


Hm. I wish m_Power2 did this internally, but I can also see that this is
following a pattern like m_One and friends that only match constants.

One other question though, why not transform shl+zext into zext+shl? Casts
should be at the outside as much as possible -- functions should have
expansions first, then math in the expanded bitwidths, then truncates -- so
that we don't have these operations in the middle of expressions because
they cause problems, just like the one symptom you're seeing here.

Nick

On 1 October 2012 13:27, Michael Gottesman <mgottesman at apple.com> wrote:

> Currently LLVM optimizes urem appropriately for power of two quotients if
> the numerator and quotient are the same size. On the other hand if the
> quotient is a power of two which is zero extended, pattern matching fails
> resulting in no optimizations occuring. This patch adds code to InstCombine
> to properly match and handle this case.
>
> Patch by David Majnemer. Test Case by me.
>
> Please review,
>
>
>
>
> Michael
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121001/9a568c41/attachment.html>


More information about the llvm-commits mailing list