[PATCH] D153505: [ConstantRange] Handle `Intrinsic::cttz` and `Intrinsic::ctpop`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 02:03:39 PDT 2023


nikic requested changes to this revision.
nikic added a comment.
This revision now requires changes to proceed.

If it's not possible to have efficient precise implementations for these, please just use simple approximations like this:

  ConstantRange ConstantRange::ctpop() const {
    if (isEmptySet())
      return getEmpty();     
      
    KnownBits Known = toKnownBits();
    return getNonEmpty(APInt(getBitWidth(), Known.countMinPopulation()),
                       APInt(getBitWidth(), Known.countMaxPopulation() + 1));
  }   

I'm not willing to have linear time ConstantRange methods.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153505



More information about the llvm-commits mailing list