aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-08-20 09:55:43 +0900
committerGitHub <noreply@github.com>2025-08-20 09:55:43 +0900
commit276c1d8114621f59d561cd9abd13f90a8c173fff (patch)
tree0798c1bbede23dfe5fb71dd7c9f354c4aa724d18 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentc97322d048e864701b687251397c73d64cb1af02 (diff)
downloadllvm-276c1d8114621f59d561cd9abd13f90a8c173fff.zip
llvm-276c1d8114621f59d561cd9abd13f90a8c173fff.tar.gz
llvm-276c1d8114621f59d561cd9abd13f90a8c173fff.tar.bz2
DAG: Add assert to getNode for EXTRACT_SUBVECTOR indexes (#154099)
Verify it's a multiple of the result vector element count instead of asserting this in random combines. The testcase in #153808 fails in the wrong point. Add an assert to getNode so the invalid extract asserts at construction instead of use.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 23102d3..531297b 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -7960,6 +7960,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
assert(N2C->getAPIntValue().getBitWidth() ==
TLI->getVectorIdxWidth(getDataLayout()) &&
"Constant index for EXTRACT_SUBVECTOR has an invalid size");
+ assert(N2C->getZExtValue() % VT.getVectorMinNumElements() == 0 &&
+ "Extract index is not a multiple of the output vector length");
// Trivial extraction.
if (VT == N1VT)