[llvm] 42c2dfb - [SelectionDAG] Verify SDTCisSameNumEltsAs in SDNodeInfo::verifyNode (#230616)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 11 13:18:57 PDT 2026
Author: Craig Topper
Date: 2026-10-11T20:18:51Z
New Revision: 42c2dfb7cb5c67de98c9b540f3409f6fbecc751d
URL: https://github.com/llvm/llvm-project/commit/42c2dfb7cb5c67de98c9b540f3409f6fbecc751d
DIFF: https://github.com/llvm/llvm-project/commit/42c2dfb7cb5c67de98c9b540f3409f6fbecc751d.diff
LOG: [SelectionDAG] Verify SDTCisSameNumEltsAs in SDNodeInfo::verifyNode (#230616)
Assisted-by: Claude
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SDNodeInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SDNodeInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/SDNodeInfo.cpp
index a2ff2c049e8d6..ebc169ad5bd22 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SDNodeInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SDNodeInfo.cpp
@@ -302,8 +302,23 @@ void SDNodeInfo::verifyNode(const SelectionDAG &DAG, const SDNode *N) const {
}
break;
}
- case SDTCisSameNumEltsAs:
+ case SDTCisSameNumEltsAs: {
+ SDNodeValue OtherVal = GetConstraintValue(C.ConstrainingValIdx);
+ EVT OtherVT = OtherVal.getValueType();
+
+ // Scalars are treated as having the same "number of elements" as any
+ // other scalar, so this only requires equal element counts when both
+ // are vectors.
+ if (VT.isVector() != OtherVT.isVector() ||
+ (VT.isVector() &&
+ VT.getVectorElementCount() != OtherVT.getVectorElementCount())) {
+ SS << Val << " and " << OtherVal
+ << " must have the same number of elements, but have " << VT
+ << " and " << OtherVT;
+ reportNodeError(DAG, N, SS.str());
+ }
break;
+ }
case SDTCisSameSizeAs: {
SDNodeValue OtherVal = GetConstraintValue(C.ConstrainingValIdx);
EVT OtherVT = OtherVal.getValueType();
More information about the llvm-commits
mailing list