[llvm-bugs] [Bug 42563] [InstCombine] Dropping pointless masking before left shift

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Aug 11 14:36:07 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42563

Roman Lebedev <lebedev.ri at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #4 from Roman Lebedev <lebedev.ri at gmail.com> ---
Actually, i'm missing the point here.
While indeed if the mask does not touch any bits that will remain
after the shift means we can drop the mask, we still can trivially do
the fold if it *does* touch some bits - that legality check also tells
us how many high bits to clear.

https://rise4fun.com/Alive/x2Cq
Obviously, that won't work if we had `ashr`.

The mask is constant, so we only need one extra instruction.
I guess that means the input to `%r` needs to be one-use (or %x a constant.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190811/a82c9fa7/attachment.html>


More information about the llvm-bugs mailing list