summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/redundant-left-shift-input-masking-variant-b.ll
Commit message (Collapse)AuthorAgeFilesLines
* [NFC][InstCombine] More tests for "Dropping pointless masking before left ↵Roman Lebedev2019-09-171-25/+0
| | | | | | | | | | | | | shift" (PR42563) While we already fold that pattern if the sum of shift amounts is not smaller than bitwidth, there's painfully obvious generalization: https://rise4fun.com/Alive/F5R I.e. the "sub of shift amounts" tells us how many bits will be left in the output. If it's less than bitwidth, we simply need to apply a mask, which is constant. llvm-svn: 372170
* [InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)Roman Lebedev2019-07-191-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If we have some pattern that leaves only some low bits set, and then performs left-shift of those bits, if none of the bits that are left after the final shift are modified by the mask, we can omit the mask. There are many variants to this pattern: b. `(x & (~(-1 << maskNbits))) << shiftNbits` All these patterns can be simplified to just: `x << ShiftShAmt` iff: b. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)` alive proof: b: https://rise4fun.com/Alive/y8M 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 Differential Revision: https://reviews.llvm.org/D64514 llvm-svn: 366536
* [NFC][InstCombine] Comb through just-added "omit mask before left-shift" ↵Roman Lebedev2019-07-101-14/+14
| | | | | | tests once more llvm-svn: 365694
* [NFC][InstCombine] Fixup some tests in just-added "omit mask before ↵Roman Lebedev2019-07-101-4/+6
| | | | | | left-shift" tests llvm-svn: 365663
* [NFC][InstCombine] Redundant masking before left-shift (PR42563)Roman Lebedev2019-07-101-0/+407
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
OpenPOWER on IntegriCloud