[all-commits] [llvm/llvm-project] 9d73a8: [KnownBits] Make shl/lshr/ashr implementations opt...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Tue May 16 00:44:51 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9d73a8bdc66496b673c11e991fd9cf0cba0a1bff
https://github.com/llvm/llvm-project/commit/9d73a8bdc66496b673c11e991fd9cf0cba0a1bff
Author: Nikita Popov <npopov at redhat.com>
Date: 2023-05-16 (Tue, 16 May 2023)
Changed paths:
M llvm/lib/Support/KnownBits.cpp
M llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll
M llvm/test/Transforms/InstCombine/not-add.ll
M llvm/unittests/Support/KnownBitsTest.cpp
Log Message:
-----------
[KnownBits] Make shl/lshr/ashr implementations optimal
The implementations for shifts were suboptimal in the case where
the max shift amount was >= bitwidth. In that case we should still
use the usual code clamped to BitWidth-1 rather than just giving up
entirely.
Additionally, there was an implementation bug where the known zero
bits for the individual shift amounts were not set in the shl/lshr
implementations. I think after these changes, we'll be able to drop
some of the code in ValueTracking which *also* evaluates all possible
shift amounts and has been papering over this issue.
For the "all poison" case I've opted to return an unknown value for
now. It would be better to return zero, but this has fairly
substantial test fallout, so I figured it's best to not mix it into
this change. (The "correct" return value would be a conflict, but
given that a lot of our APIs assert conflict-freedom, that's probably
not the best idea to actually return.)
Differential Revision: https://reviews.llvm.org/D150587
More information about the All-commits
mailing list