Skip to content

Commit 9599567

Browse files
committed
[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.
1 parent dd57ba1 commit 9599567

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,10 @@ bool SelectionDAG::MaskedValueIsZero(SDValue V, const APInt &Mask,
24502450
/// use this predicate to simplify operations downstream.
24512451
bool SelectionDAG::MaskedElementsAreZero(SDValue Op, const APInt &DemandedElts,
24522452
unsigned Depth) const {
2453+
assert(Op.getValueType().isFixedLengthVector() &&
2454+
Op.getValueType().getVectorNumElements() ==
2455+
DemandedElts.getBitWidth() &&
2456+
"MaskedElementsAreZero vector size mismatch");
24532457
unsigned BitWidth = Op.getScalarValueSizeInBits();
24542458
APInt DemandedBits = APInt::getAllOnesValue(BitWidth);
24552459
return MaskedValueIsZero(Op, DemandedBits, DemandedElts, Depth);

0 commit comments

Comments
 (0)