Skip to content

Commit 6a85cf8

Browse files
authored
[SelectionDAG] Verify SPLAT_VECTOR nodes when they are created. (llvm#88305)
This applies the same rules we have for the scalar operands of a BUILD_VECTOR where the scalar type must match the element type or for integer vectors we allow the scalar type to be larger than the element type. Hexagon uses i32 for an FP zero vector so we allow that as an exception.
1 parent dcd097c commit 6a85cf8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6032,6 +6032,17 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
60326032
if (N1.getValueType().getScalarType() == MVT::i1)
60336033
return getNode(ISD::VECREDUCE_AND, DL, VT, N1);
60346034
break;
6035+
case ISD::SPLAT_VECTOR:
6036+
assert(VT.isVector() && "Wrong return type!");
6037+
// FIXME: Hexagon uses i32 scalar for a floating point zero vector so allow
6038+
// that for now.
6039+
assert((VT.getVectorElementType() == N1.getValueType() ||
6040+
(VT.isFloatingPoint() && N1.getValueType() == MVT::i32) ||
6041+
(VT.getVectorElementType().isInteger() &&
6042+
N1.getValueType().isInteger() &&
6043+
VT.getVectorElementType().bitsLE(N1.getValueType()))) &&
6044+
"Wrong operand type!");
6045+
break;
60356046
}
60366047

60376048
SDNode *N;

0 commit comments

Comments
 (0)