[PATCH] D142271: [ValueTracking] Add KnownBits patterns `xor(x, x - 1)` and `and(x, -x)` for knowing upper bits to be zero
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 14:00:03 PST 2023
craig.topper added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1094
+ match(I->getOperand(1), m_Neg(m_Specific(I->getOperand(0))))) {
+ unsigned MinBit = std::min(Known.One.countTrailingZeros(),
+ Known2.One.countTrailingZeros());
----------------
I'm not sure about this min. The `-x` operand will potentially find less trailing bits due to the recursion limit in computeKnownBits. It has one more node to walk through. Using the tailing zeros bits based on which operand is `x` seems more reliable.
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