[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
Wed May 3 12:14:07 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Support/KnownBits.cpp:549
 
+static KnownBits remGetLowBits(const KnownBits &Known, const KnownBits &LHS,
+                               const KnownBits &RHS) {
----------------
goldstein.w.n wrote:
> nikic wrote:
> > goldstein.w.n wrote:
> > > RKSimon wrote:
> > > > goldstein.w.n wrote:
> > > > > RKSimon wrote:
> > > > > > Do we need Known?
> > > > > Yeah. We don't have a "merge" function (to take known results from A and apply them to B).
> > > > > There was a bit of conversation below (around L580) about it.
> > > > But do we need a merge? All the calls to remGetLowBits are at the start when Known is empty
> > > Oh yeah. My feeling there was the API should work on arbitrary state, not just init state. Otherwise just seems like a bug waiting to happen.
> > As this is a private API, I don't think there's a need to generalize it to a use case that currently doesn't exist...
> Private API to users sure, if in a year if someone add some improvement will it be clear? To me it seems like basically zero cost to passing `Known` and potential cost in not doing so. If you're not convinced, however, (either of you), ill change. LMK.
I much prefer not passing in `Known`.


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