[PATCH] D149418: [ValueTracking] Add additional cases for `isKnownNonZero(mul X, Y)`

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 13:56:33 PDT 2023


goldstein.w.n added a comment.

In D149418#4335780 <https://reviews.llvm.org/D149418#4335780>, @holland11 wrote:

> I'm probably missing something obvious here, but what does it matter that one of the operands is odd? If we are multiplying two numbers where one is odd **or even** (as long as its non-zero) and the other is non-zero, the result will be non-zero, no? I can't figure out what's special about odd in this context.

Its because multiple by odd preserves the low-bit from the input i.e
X * Y if Y is not, the low bit in X will be set in the result: https://alive2.llvm.org/ce/z/RD-MCy
So if X != 0 then the low-bit in X is non-zero then the result X * Y is non-zero.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149418/new/

https://reviews.llvm.org/D149418



More information about the llvm-commits mailing list