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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 29 12:23:11 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2884
+
     break;
   }
----------------
goldstein.w.n wrote:
> 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 :)
But isn't all the sign bit logic behind `if (NSW)`, which we already handle separately?




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