[llvm] [ConstantRange] Handle `Intrinsic::ctpop` (PR #68310)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 06:43:22 PDT 2023
================
@@ -1736,6 +1739,52 @@ ConstantRange ConstantRange::ctlz(bool ZeroIsPoison) const {
APInt(getBitWidth(), getUnsignedMin().countl_zero() + 1));
}
+static ConstantRange getUnsignedPopCountRange(const APInt &Lower,
+ const APInt &Upper) {
+ assert(Lower.ule(Upper) && "Unexpected wrapped set.");
+ unsigned BitWidth = Lower.getBitWidth();
+ if (Lower == Upper)
+ return ConstantRange::getEmpty(BitWidth);
----------------
nikic wrote:
Can we assert this case doesn't happen (possibly with the isUpperWrapped -> isWrappedSet suggestion below)?
https://github.com/llvm/llvm-project/pull/68310
More information about the llvm-commits
mailing list