[llvm] [SelectionDAG] Add computeKnownBits support for VP_LOAD_FF's second result (PR #227389)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 14:46:40 PDT 2026
================
@@ -4541,6 +4541,25 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
Known, MF, MF.getFrameInfo().getObjectAlign(FrameIdx));
break;
}
+ case ISD::VP_LOAD_FF: {
+ if (Op.getResNo() != 1)
+ break;
+ // The second result of vp.load.ff is an unsigned value that is less than or
+ // equal to the EVL operand.
+ KnownBits VLKB =
+ computeKnownBits(Op.getOperand(3), DemandedElts, Depth + 1);
+ // The new VL is also bounded by the largest vector length.
+ EVT ResVT = Op->getValueType(0);
+ auto ResKB = KnownBits::makeConstant(
+ APInt(BitWidth, ResVT.getVectorMinNumElements()));
+ if (ResVT.isScalableVector()) {
+ const Function &F = getMachineFunction().getFunction();
+ ResKB = KnownBits::mul(getVScaleRange(&F, BitWidth).toKnownBits(), ResKB);
----------------
topperc wrote:
Do we need to detect overflow on this multiply? If the vscale_range attribute isn't present the upper bound is a large number. Granted in that case the lower bound 1 so toKnownBits probably can't resolve anything.
https://github.com/llvm/llvm-project/pull/227389
More information about the llvm-commits
mailing list