diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-12-18 20:24:38 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-12-20 01:47:57 +0300 |
commit | 047186cc986f5bb53ce716dfe363ba517b7d0ed8 (patch) | |
tree | e021c5b0ab7f82e971753e1665a37bc8597924bc /llvm/lib/Support/CommandLine.cpp | |
parent | 92083a295a02f46ecd168438d2145a0ca3c9b6ec (diff) | |
download | llvm-047186cc986f5bb53ce716dfe363ba517b7d0ed8.zip llvm-047186cc986f5bb53ce716dfe363ba517b7d0ed8.tar.gz llvm-047186cc986f5bb53ce716dfe363ba517b7d0ed8.tar.bz2 |
[ValueTracking] isKnownNonZero() should take non-null-ness assumptions into consideration (PR43267)
Summary:
It is pretty common to assume that something is not zero.
Even optimizer itself sometimes emits such assumptions
(e.g. `addAssumeNonNull()` in `PromoteMemoryToRegister.cpp`).
But we currently don't deal with such assumptions :)
The only way `isKnownNonZero()` handles assumptions is
by calling `computeKnownBits()` which calls `computeKnownBitsFromAssume()`.
But `x != 0` does not tell us anything about set bits,
it only says that there are *some* set bits.
So naturally, `KnownBits` does not get populated,
and we fail to make use of this assumption.
I propose to deal with this special case by special-casing it
via adding a `isKnownNonZeroFromAssume()` that returns boolean
when there is an applicable assumption.
While there, we also deal with other predicates,
mainly if the comparison is with constant.
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=43267 | PR43267 ]].
Differential Revision: https://reviews.llvm.org/D71660
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
0 files changed, 0 insertions, 0 deletions