1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

[DAG] SelectionDAG::MaskedElementsAreZero - assert we're calling with a vector. NFCI.

Add an assertion that we've calling MaskedElementsAreZero with a vector op and that the DemandedElts arg is a matching width.

Makes the error a lot easier to grok when something else accidentally gets used.
This commit is contained in:
Simon Pilgrim 2021-07-16 12:05:05 +01:00
parent ac7796917a
commit e00330583b

View File

@ -2450,6 +2450,10 @@ bool SelectionDAG::MaskedValueIsZero(SDValue V, const APInt &Mask,
/// use this predicate to simplify operations downstream.
bool SelectionDAG::MaskedElementsAreZero(SDValue Op, const APInt &DemandedElts,
unsigned Depth) const {
assert(Op.getValueType().isFixedLengthVector() &&
Op.getValueType().getVectorNumElements() ==
DemandedElts.getBitWidth() &&
"MaskedElementsAreZero vector size mismatch");
unsigned BitWidth = Op.getScalarValueSizeInBits();
APInt DemandedBits = APInt::getAllOnesValue(BitWidth);
return MaskedValueIsZero(Op, DemandedBits, DemandedElts, Depth);