[llvm] [SelectionDAG] Handle VSCALE in isKnownNeverZero (PR #97789)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 9 08:06:10 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())
----------------
lukel97 wrote:
Thanks for catching this, I was not aware ConstantRange could wrap. I've gone ahead and pushed a fix for this in baf22a527ca6571cdf5cd57c524a1fc261207947
https://github.com/llvm/llvm-project/pull/97789
More information about the llvm-commits
mailing list