[PATCH] D157755: [InstSimplify] Use knownbits for simplifying `(icmp ugt/ule (or X, Y), X)`; PR64610
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 12 11:24:46 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:3135-3140
+ // Get NOT of knownbits by swapping ones/zeros
+ std::swap(RHSKnown.One, RHSKnown.Zero);
+ KnownBits UniqueBits = RHSKnown & YKnown;
+ // We know there is a unique bit so equality conditions cannot be
+ // false.
+ if (UniqueBits.isNonZero())
----------------
goldstein.w.n wrote:
> nikic wrote:
> > goldstein.w.n wrote:
> > > nikic wrote:
> > > >
> > > Is that right. It's really 'have a common bit not set', it's okay if there are some though
> > Oh, I see, I misunderstood what you're going for here. In that case I don't think your comment in the patch description that this does not add new capability is probably not right. I don't think we'd fold the case where there are common bits elsewhere.
> >
> > I personally think writing the condition here as `if ((YKnown.One & RHSKnown.Zero) != 0)` would be cleaner.
> I added some tests that have some overlapping bits to make it more clear.
We handle this in other passes. Its new to instsimplify/instcombine.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157755/new/
https://reviews.llvm.org/D157755
More information about the llvm-commits
mailing list