Skip to content

Commit 9f387d8

Browse files
committed
fixup! [DAGCombine] Fix an incorrect folding of extract_subvector
1 parent 2d8d901 commit 9f387d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26018,12 +26018,12 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
2601826018
// Combine an extract of an extract into a single extract_subvector.
2601926019
// ext (ext X, C), 0 --> ext X, C
2602026020
if (ExtIdx == 0 && V.getOpcode() == ISD::EXTRACT_SUBVECTOR && V.hasOneUse()) {
26021-
if (TLI.isExtractSubvectorCheap(NVT, V.getOperand(0).getValueType(),
26021+
// The index has to be a multiple of the new result type's known minimum
26022+
// vector length.
26023+
if (V.getConstantOperandVal(1) % NVT.getVectorMinNumElements() == 0 &&
26024+
TLI.isExtractSubvectorCheap(NVT, V.getOperand(0).getValueType(),
2602226025
V.getConstantOperandVal(1)) &&
26023-
TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NVT) &&
26024-
// The index has to be a multiple of the new result type's known minimum
26025-
// vector length.
26026-
V.getConstantOperandVal(1) % NVT.getVectorMinNumElements() == 0) {
26026+
TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NVT)) {
2602726027
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NVT, V.getOperand(0),
2602826028
V.getOperand(1));
2602926029
}

0 commit comments

Comments
 (0)