OSDN Git Service

[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)
commit424f2598df4410c5b5d93fced2bd640195e03ff4
treed9ba0c25077e7f133112b493ea6cc13a3782a959
parent75eb01ba01479c5635b7a87e3c989632bb954e80
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365641 91177308-0d34-0410-b5e6-96231b3b80d8
test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-a.ll [new file with mode: 0644]
test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-b.ll [new file with mode: 0644]
test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-c.ll [new file with mode: 0644]
test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-d.ll [new file with mode: 0644]
test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-e.ll [new file with mode: 0644]
test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-f.ll [new file with mode: 0644]
test/Transforms/InstCombine/redundant-right-shift-input-masking.ll [moved from test/Transforms/InstCombine/redundant-shift-input-masking.ll with 100% similarity]