[llvm] [InstSimplify] Provide information about the range of possible values that `ucmp`/`scmp` can return (PR #96410)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 23 00:27:56 PDT 2024
================
@@ -9393,6 +9393,10 @@ static ConstantRange getRangeForIntrinsic(const IntrinsicInst &II) {
if (!II.getParent() || !II.getFunction())
break;
return getVScaleRange(II.getFunction(), Width);
+ case Intrinsic::scmp:
+ case Intrinsic::ucmp:
+ return ConstantRange::getNonEmpty(APInt::getAllOnes(Width),
+ APInt::getOneBitSet(Width, 0));
----------------
nikic wrote:
```suggestion
APInt(Width, 2));
```
The upper bound is exclusive, so the range should be `[-1, 2)`, while you're currently constructing `[-1, 1)`.
https://github.com/llvm/llvm-project/pull/96410
More information about the llvm-commits
mailing list