[PATCH] D149421: [KnownBits] Improve `KnownBits::rem(X, Y)` in cases where we can deduce low-bits of output

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 00:20:04 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Support/KnownBits.cpp:594
     APInt LowBits = RHS.getConstant() - 1;
     Known.Zero = LHS.Zero & LowBits;
 
----------------
goldstein.w.n wrote:
> foad wrote:
> > Remove this line too.
> Why? Isn't it a bit confusing that we only set zeros?
I'm saying you should remove `Known.Zero = LHS.Zero & LowBits`, because it has already been done by `remGetLowBits`. The only extra stuff we need to do in the constant RHS case is to do the high bits.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149421/new/

https://reviews.llvm.org/D149421



More information about the llvm-commits mailing list