Skip to content

Commit baf22a5

Browse files
committed
[SelectionDAG] Handle vscale range wrapping in isKnownNeverZero
As pointed out by @preames, ConstantRange can wrap so it's possible for zero to be in a range without zero being the minimum. This fixes this by checking contains instead.
1 parent 7346e7c commit baf22a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5649,7 +5649,7 @@ bool SelectionDAG::isKnownNeverZero(SDValue Op, unsigned Depth) const {
56495649
const APInt &Multiplier = Op.getConstantOperandAPInt(0);
56505650
ConstantRange CR =
56515651
getVScaleRange(&F, Op.getScalarValueSizeInBits()).multiply(Multiplier);
5652-
if (!CR.getUnsignedMin().isZero())
5652+
if (!CR.contains(APInt(CR.getBitWidth(), 0)))
56535653
return true;
56545654
break;
56555655
}

0 commit comments

Comments
 (0)