[llvm] [DAGCombine] Fix an incorrect folding of extract_subvector (PR #153709)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 15:57:19 PDT 2025
================
@@ -26020,7 +26020,10 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
if (ExtIdx == 0 && V.getOpcode() == ISD::EXTRACT_SUBVECTOR && V.hasOneUse()) {
if (TLI.isExtractSubvectorCheap(NVT, V.getOperand(0).getValueType(),
V.getConstantOperandVal(1)) &&
- TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NVT)) {
+ TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NVT) &&
+ // The index has to be a multiple of the new result type's known minimum
+ // vector length.
+ V.getConstantOperandVal(1) % NVT.getVectorMinNumElements() == 0) {
----------------
alexey-bataev wrote:
Shall this be checked before checking isExtractSubvectorCheap?
https://github.com/llvm/llvm-project/pull/153709
More information about the llvm-commits
mailing list