[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 15:12:31 PDT 2023
goldstein.w.n marked 2 inline comments as done.
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2884
+
break;
}
----------------
nikic wrote:
> nikic wrote:
> > 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?
> >
> >
> I mainly find the computeKnownBitsMulDoMul() function pretty ugly and would prefer to avoid it :) KnownBits::mul should handle anything that is not based on nowrap flags, and we handle nowrap flags ourselves.
>
>
You're right no difference. Thanks for all the reviews on this very long series :)
thinkwe are in the home stretch 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