summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-07-19 08:26:58 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-07-19 08:26:58 +0000
commitf2eb403144959e9da93ed28ee7b9736c993b5a3c (patch)
tree32623c0a960559447c50dbf71e91b264c42c064d /clang/lib/CodeGen/BackendUtil.cpp
parent441c9d6ca897663408446af956630399e988cd6d (diff)
downloadbcm5719-llvm-f2eb403144959e9da93ed28ee7b9736c993b5a3c.tar.gz
bcm5719-llvm-f2eb403144959e9da93ed28ee7b9736c993b5a3c.zip
[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)
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: f. `((x << MaskShAmt) a>> MaskShAmt) << ShiftShAmt` All these patterns can be simplified to just: `x << ShiftShAmt` iff: f. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`) Normally, the inner pattern is sign-extend, but for our purposes it's no different to other patterns: alive proofs: f: https://rise4fun.com/Alive/7U3 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/D64524 llvm-svn: 366540
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud