[llvm] [SelectionDAG] Handle VSCALE in isKnownNeverZero (PR #97789)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 07:38:08 PDT 2024
================
@@ -5623,6 +5623,15 @@ bool SelectionDAG::isKnownNeverZero(SDValue Op, unsigned Depth) const {
case ISD::ZERO_EXTEND:
case ISD::SIGN_EXTEND:
return isKnownNeverZero(Op.getOperand(0), Depth + 1);
+ case ISD::VSCALE: {
+ const Function &F = getMachineFunction().getFunction();
+ const APInt &Multiplier = Op.getConstantOperandAPInt(0);
+ ConstantRange CR =
+ getVScaleRange(&F, Op.getScalarValueSizeInBits()).multiply(Multiplier);
+ if (!CR.getUnsignedMin().isZero())
----------------
preames wrote:
I believe this check is incorrect. Consider a wrapping range of the form [4, 2]. This includes 0 despite the 0 not being the minimum element. The correct check here would be a contains check.
https://github.com/llvm/llvm-project/pull/97789
More information about the llvm-commits
mailing list