[NFC][InstCombine] Redundant masking before left-shift (PR42563)
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 10 Jul 2019 15:08:06 +0000 (15:08 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 10 Jul 2019 15:08:06 +0000 (15:08 +0000)
commit1c51073a3ad8dd4ec4f6a2c962c89cab9ca220e0
tree9610a1cdc6e8c19f735d1fc6aebd7107bb4513e0
parentbba37e89a57acfb161549b5a57acbe2a228331b8
[NFC][InstCombine] Redundant masking before left-shift (PR42563)

alive proofs:
a,b:     https://rise4fun.com/Alive/4zsf
c,d,e,f: https://rise4fun.com/Alive/RC49

Indeed, not all of these patterns are canonical.
But since this fold will only produce a single instruction
i'm really interested in handling even uncanonical patterns.

Other than these 6 patterns, i can't think of any other
reasonable variants right now, although i'm sure they exist.

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

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

llvm-svn: 365641
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-a.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-b.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-c.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-d.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-e.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-f.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/redundant-right-shift-input-masking.ll [moved from llvm/test/Transforms/InstCombine/redundant-shift-input-masking.ll with 100% similarity]