1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Go to file
Roman Lebedev 6d7c602ff1 [InstSimplify] shl nuw C, %x -> C iff signbit is set on C.
Summary:
`%r = shl nuw i8 C, %x`

As per langref:
```
If the nuw keyword is present, then the shift produces
a poison value if it shifts out any non-zero bits.
```
Thus, if the sign bit is set on `C`, then `%x` can only be `0`,
which means that `%r` can only be `C`.
Or in other words, set sign bit means that the signed value
is negative, so the constant is `<= 0`.

https://rise4fun.com/Alive/WMk
https://rise4fun.com/Alive/udv

Was mentioned in D47428 review.

We already handle the `0` constant, https://godbolt.org/g/UZq1sJ, so this only handles negative constants.

Could use computeKnownBits() / LazyValueInfo,
but the cost-benefit analysis (https://reviews.llvm.org/D47891)
suggests it isn't worth it.

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D47883

llvm-svn: 334222
2018-06-07 20:03:45 +00:00
bindings [LLVM-C] [OCaml] Remove LLVMAddBBVectorizePass 2018-05-28 16:58:10 +00:00
cmake [CMake] Pass additional CMake tools to external projects 2018-06-06 21:43:37 +00:00
docs [docs] add various sanitisers support for FreeBSD/OpenBSD 2018-06-07 16:33:48 +00:00
examples [ORC] Update JITCompileCallbackManager to support multi-threaded code. 2018-05-30 01:57:45 +00:00
include [FileSystem] Split up the OpenFlags enumeration. 2018-06-07 19:58:58 +00:00
lib [InstSimplify] shl nuw C, %x -> C iff signbit is set on C. 2018-06-07 20:03:45 +00:00
projects [cmake] Support moving debuginfo-tests to llvm/projects 2017-12-12 17:06:08 +00:00
resources
runtimes [CMake] Pass additional CMake tools to external projects 2018-06-06 21:43:37 +00:00
test [InstSimplify] shl nuw C, %x -> C iff signbit is set on C. 2018-06-07 20:03:45 +00:00
tools [FileSystem] Split up the OpenFlags enumeration. 2018-06-07 19:58:58 +00:00
unittests [FileSystem] Split up the OpenFlags enumeration. 2018-06-07 19:58:58 +00:00
utils [X86] Rename vy512mem->vy512xmem and vz256xmem->vz256mem. 2018-06-06 19:15:12 +00:00
.arcconfig [llvm] Set up .arcconfig to point to Diffusion L repository 2018-01-12 15:37:41 +00:00
.clang-format
.clang-tidy .clang-tidy: correct style name is 'camelBack' not 'lowerCase'. 2016-09-13 19:04:26 +00:00
.gitattributes [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
.gitignore gitignore: Ignore .vs folder (VS2017 config files) 2017-04-08 00:16:58 +00:00
CMakeLists.txt [cmake] Add a switch to enable/disable bindings. 2018-05-20 08:37:54 +00:00
CODE_OWNERS.TXT [CODE_OWNERS] Update my email address. 2018-04-23 19:09:49 +00:00
configure Remove autoconf support 2016-01-26 21:29:08 +00:00
CREDITS.TXT Update my information in the CREDITS file. 2018-05-23 14:44:42 +00:00
LICENSE.TXT Bump year to 2017 in LICENSE.txt 2017-01-12 18:02:42 +00:00
llvm.spec.in
LLVMBuild.txt
README.txt Update the project name in README.txt 2018-06-06 11:15:54 +00:00
RELEASE_TESTERS.TXT Update my email addresses, NFC. 2017-10-26 10:16:54 +00:00

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.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.