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

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 29 11:45:19 PDT 2023


goldstein.w.n marked an inline comment as done.
goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2884
+
     break;
   }
----------------
nikic wrote:
> Similar to the add case, we should compute mul known bits here based on the already computed XKnown/YKnown, rather than computing them again via the fallback.
> 
> I think just using KnownBits::mul should be enough, as the NSW case handled by computeKnownBitsMul is already handled better above.
> Similar to the add case, we should compute mul known bits here based on the already computed XKnown/YKnown, rather than computing them again via the fallback.
> 
> I think just using KnownBits::mul should be enough, as the NSW case handled by computeKnownBitsMul is already handled better above.

Added the actual logic b.c there is a trick for knowing the sign of the result that doesn't appear to be handled by `KnownBits::mul`. Also seems more future-proof incase someone has a new bright idea and improves it further.

But we don't recompute knownbits now :)


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