[PATCH] D142271: [ValueTracking] Add KnownBits patterns `xor(x, x - 1)` and `and(x, -x)` for knowing upper bits to be zero
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 26 05:45:44 PST 2023
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1136
+ C->isAllOnes()) {
+ const KnownBits &XBits = I->getOperand(0) == X ? Known2 : Known;
+ Known = XBits.blsmsk();
----------------
nikic wrote:
> Shouldn't this be `? Known : Known2`? We want the known bits of X, not of X-1.
Ignore this comment, the variable naming is a bit confusing here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142271/new/
https://reviews.llvm.org/D142271
More information about the llvm-commits
mailing list