[PATCH] D149407: [ValueTracking] Pull out logic for detecting if `(add X, Y)` is non-zero; NFC
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 08:04:02 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2840
return true;
break;
}
----------------
goldstein.w.n wrote:
> nikic wrote:
> > Can we directly return isNonZeroAdd?
> No, we actually benefit from compute known bits. Take the following. `X[0] == 0` and `Y[0] == 1`. The result will be odd (from computeknownbits) so non-zero, but we don't get that here (would need to replicate computeknownnbits to do that).
Okay, can we then just call `KnownBits::computeForAddSub(...).isNonZero()` at the end? After all we already calculated known bits for both operands, so no point in calculating them again via the generic code.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149407/new/
https://reviews.llvm.org/D149407
More information about the llvm-commits
mailing list