llvm-project/llvm
Roman Lebedev 25aebe2ccf
[LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case miscompilation for %x.next
While `%x.curr` is always safe to compute, because `LoopBackedgeTakenCount`
will always be smaller than `bitwidth(X)`, i.e. we never get poison,
rewriting `%x.next` is more complicated, however, because `X << LoopTripCount`
will be poison iff `LoopTripCount == bitwidth(X)` (which will happen
iff `BitPos` is `bitwidth(x) - 1` and `X` is `1`).

So unless we know that isn't the case (as alive2 notes, we know it's safe
to do iff shift had no-wrap flags, or bitpos does not indicate signbit,
or we know that %x is never `1`), we'll need to emit an alternative,
safe IR, by either just shifting the `%x.curr`, or conditionally selecting
between the computed `%x.next` and `0`..
Former IR looks better so let's do that.

While there, ensure that we don't drop no-wrap flags from said shift.
2020-12-24 21:20:52 +03:00
..
benchmarks
bindings [Go] Fix bindings/go/llvm/IRBindings.cpp 2020-12-16 10:09:58 -08:00
cmake [CMake] Avoid __FakeVCSRevision.h with no git repository 2020-12-16 17:33:20 +01:00
docs [AMDGPU] Use MUBUF instructions for global address space access 2020-12-24 10:13:04 +00:00
examples [NFC] Reduce include files dependency and AA header cleanup (part 2). 2020-12-17 14:04:48 +03:00
include [IR][InstCombine] Add m_ImmConstant(), that matches on non-ConstantExpr constants, and use it 2020-12-24 21:20:47 +03:00
lib [LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case miscompilation for %x.next 2020-12-24 21:20:52 +03:00
projects
resources
runtimes [OpenMP] Fixed the issue that CMake variables for OpenMP were not passed through when building OpenMP with LLVM_ENABLE_RUNTIMES 2020-12-20 18:40:12 -05:00
test [LoopIdiom] 'left-shift-until-bittest': keep no-wrap flags on shift, fix edge-case miscompilation for %x.next 2020-12-24 21:20:52 +03:00
tools [obj2yaml] - Dump the content of a broken GNU hash table properly. 2020-12-24 11:16:31 +03:00
unittests [Support] Add KnownBits::getSignedMinValue/getSignedMaxValue helpers. 2020-12-24 14:10:12 +00:00
utils clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too 2020-12-23 14:27:09 -05:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Remove Python2 fallback and only advertise Python3 in the doc 2020-12-17 15:40:16 +01:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

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.