diff options
author | Craig Topper <craig.topper@sifive.com> | 2024-04-12 10:22:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 10:22:21 -0700 |
commit | 6a85cf8fc0437d4885fc829948befe32c1e5a21d (patch) | |
tree | 83350ec0f7572cce975b568b140f1223fd7b44c2 | |
parent | dcd097c475163b9bd41ff009a9157e86c6f2f171 (diff) | |
download | llvm-6a85cf8fc0437d4885fc829948befe32c1e5a21d.zip llvm-6a85cf8fc0437d4885fc829948befe32c1e5a21d.tar.gz llvm-6a85cf8fc0437d4885fc829948befe32c1e5a21d.tar.bz2 |
[SelectionDAG] Verify SPLAT_VECTOR nodes when they are created. (#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.
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index ddb12a1..412e1de 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -6032,6 +6032,17 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT, if (N1.getValueType().getScalarType() == MVT::i1) return getNode(ISD::VECREDUCE_AND, DL, VT, N1); break; + case ISD::SPLAT_VECTOR: + assert(VT.isVector() && "Wrong return type!"); + // FIXME: Hexagon uses i32 scalar for a floating point zero vector so allow + // that for now. + assert((VT.getVectorElementType() == N1.getValueType() || + (VT.isFloatingPoint() && N1.getValueType() == MVT::i32) || + (VT.getVectorElementType().isInteger() && + N1.getValueType().isInteger() && + VT.getVectorElementType().bitsLE(N1.getValueType()))) && + "Wrong operand type!"); + break; } SDNode *N; |