[PATCH] D157755: [InstSimplify] Use knownbits for simplifying `(icmp ugt/ule (or X, Y), X)`; PR64610
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 12 10:49:24 PDT 2023
nikic accepted this revision.
nikic added a comment.
This revision is now accepted and ready to land.
LGTM
================
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:
> >
> 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.
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