Go to file
Roman Lebedev 7cdeac43e5 [InstCombine] Fold conditional sign-extend of high-bit-extract into high-bit-extract-with-signext (PR42389)
This can come up in Bit Stream abstractions.

The pattern looks big/scary, but it can't be simplified any further.
It only is so simple because a number of my preparatory folds had
happened already (shift amount reassociation / shift amount
reassociation in bit test, sign bit test detection).

Highlights:
* There are two main flavors: https://rise4fun.com/Alive/zWi
  The difference is add vs. sub, and left-shift of -1 vs. 1
* Since we only change the shift opcode,
  we can preserve the exact-ness: https://rise4fun.com/Alive/4u4
* There can be truncation after high-bit-extraction:
  https://rise4fun.com/Alive/slHc1   (the main pattern i'm after!)
  Which means that we need to ignore zext of shift amounts and of NBits.
* The sign-extending magic can be extended itself (in add pattern
  via sext, in sub pattern via zext. not the other way around!)
  https://rise4fun.com/Alive/NhG
  (or those sext/zext can be sinked into `select`!)
  Which again means we should pay attention when matching NBits.
* We can have both truncation of extraction and widening of magic:
  https://rise4fun.com/Alive/XTw
  In other words, i don't believe we need to have any checks on
  bitwidths of any of these constructs.

This is worsened in general by the fact that we may have `sext` instead
of `zext` for shift amounts, and we don't yet canonicalize to `zext`,
although we should. I have not done anything about that here.

Also, we really should have something to weed out `sub` like these,
by folding them into `add` variant.

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

llvm-svn: 373964
2019-10-07 20:53:27 +00:00
clang [OPENMP]Fix caonical->canonical, NFC. 2019-10-07 19:57:40 +00:00
clang-tools-extra Attempt to fix a few clang-tidy tests on Windows, see PR43593. 2019-10-07 19:54:19 +00:00
compiler-rt [scudo][standalone] Correct releaseToOS behavior 2019-10-07 17:37:39 +00:00
debuginfo-tests Make nrvo-string test more robust. 2019-06-27 20:38:37 +00:00
libc Add few docs and implementation of strcpy and strcat. 2019-10-04 17:30:54 +00:00
libclc travis: Add LLVM 9 build 2019-09-27 05:58:15 +00:00
libcxx [libc++] Guard cxx_experimental settings behind LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY 2019-10-04 23:08:20 +00:00
libcxxabi [libc++abi] Introduce a LIBCXXABI_LIBRARY_VERSION option 2019-10-07 19:22:04 +00:00
libunwind [libunwind] Adjust libunwind_01.pass.cpp test for ARM EHABI 2019-10-03 17:01:04 +00:00
lld [ELF][MIPS] De-template writeValue. NFC 2019-10-07 08:52:07 +00:00
lldb [debugserver] Include the correct header. 2019-10-07 20:35:22 +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] Fold conditional sign-extend of high-bit-extract into high-bit-extract-with-signext (PR42389) 2019-10-07 20:53:27 +00:00
openmp [libomptarget][nfc] Update remaining uint32 to use lanemask_t 2019-10-04 22:30:28 +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 [Alignment][NFC] Remove StoreInst::setAlignment(unsigned) 2019-10-03 13:17:21 +00:00
pstl [pstl] Allow customizing whether per-TU insulation is provided 2019-08-13 12:49:00 +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
.git-blame-ignore-revs Add LLDB reformatting to .git-blame-ignore-revs 2019-09-04 09:31:55 +00:00
.gitignore Add a newline at the end of the file 2019-09-04 06:33:46 +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.