Go to file
Roman Lebedev 3c212ce305 [InstCombine] Dropping redundant masking before left-shift [3/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:
d. `(x & ((-1 << MaskShAmt) >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
d. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
d: https://rise4fun.com/Alive/I5Y

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/D64519

llvm-svn: 366538
2019-07-19 08:26:37 +00:00
clang Fix formatting of inline argument comments. NFC. 2019-07-19 00:30:23 +00:00
clang-tools-extra [clangd] Remove dead code from BackgroundIndex 2019-07-18 17:25:57 +00:00
compiler-rt [libFuzzer] Set Android specific ALL_FUZZER_SUPPORTED_ARCH 2019-07-19 02:07:46 +00:00
debuginfo-tests Make nrvo-string test more robust. 2019-06-27 20:38:37 +00:00
libclc travis: Add LLVM-8 build 2019-03-27 21:28:31 +00:00
libcxx [libc++] Add C++17 deduction guides for std::function 2019-07-18 19:50:56 +00:00
libcxxabi [libcxxabi] Don't process exceptions in cxa_handlers when they're disabled 2019-07-12 19:10:59 +00:00
libunwind Bump the trunk version to 10.0.0svn 2019-07-18 11:51:05 +00:00
lld [ELF][test] Fix aarch64-condb-reloc.s 2019-07-19 08:00:22 +00:00
lldb [Target] Fix formatting and whitespace (NFC) 2019-07-19 00:56:26 +00:00
llgo IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
llvm [InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563) 2019-07-19 08:26:37 +00:00
openmp [OpenMP][libomptarget] Suppress C++ 11 related warnings when building libomptarget-nvptx bitcode library, by Doru Bercea. 2019-07-18 13:54:01 +00:00
parallel-libs Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
polly Update polly test for SCEV change. 2019-07-18 22:35:45 +00:00
pstl [NFC][pstl] Run clang-format on the sources, including the tests 2019-07-18 20:22:28 +00:00
.arcconfig Update monorepo .arcconfig with new project callsign. 2019-01-31 14:34:59 +00:00
.clang-format Add .clang-tidy and .clang-format files to the toplevel of the 2019-01-29 16:43:16 +00:00
.clang-tidy Disable tidy checks with too many hits 2019-02-01 11:20:13 +00:00
.gitignore Add a reduced copy of the llvm .gitignore 2019-04-09 00:52:49 +00:00
README.md

README.md

The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and runtime environments.