Skip to content

Commit f11568b

Browse files
committed
Revert "[RISCV][TTI] Recognize CONCAT_VECTORS if a shufflevector mask is multiple insert subvector. (#110457)"
This reverts commit 554eaec. Change was not approved when landed.
1 parent 32e90bb commit f11568b

File tree

5 files changed

+3
-74
lines changed

5 files changed

+3
-74
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

-47
Original file line numberDiff line numberDiff line change
@@ -343,49 +343,6 @@ RISCVTTIImpl::getConstantPoolLoadCost(Type *Ty, TTI::TargetCostKind CostKind) {
343343
/*AddressSpace=*/0, CostKind);
344344
}
345345

346-
InstructionCost
347-
RISCVTTIImpl::isMultipleInsertSubvector(VectorType *Tp, ArrayRef<int> Mask,
348-
TTI::TargetCostKind CostKind) {
349-
if (!isa<FixedVectorType>(Tp))
350-
return InstructionCost::getInvalid();
351-
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Tp);
352-
if (LT.second.getScalarSizeInBits() == 1)
353-
return InstructionCost::getInvalid();
354-
// Try to guess SubTp.
355-
for (unsigned SubVecSize = 1, E = Mask.size(); SubVecSize < E;
356-
SubVecSize <<= 1) {
357-
if (E % SubVecSize != 0)
358-
continue;
359-
SmallVector<int> RepeatedPattern(createSequentialMask(0, SubVecSize, 0));
360-
bool Skip = false;
361-
for (unsigned I = 0; I != E; I += SubVecSize)
362-
if (!Mask.slice(I, SubVecSize).equals(RepeatedPattern)) {
363-
Skip = true;
364-
break;
365-
}
366-
if (Skip)
367-
continue;
368-
InstructionCost Cost = 0;
369-
unsigned NumSlides = Log2_32(E / SubVecSize);
370-
// The cost of extraction from a subvector is 0 if the index is 0.
371-
for (unsigned I = 0; I != NumSlides; ++I) {
372-
unsigned InsertIndex = SubVecSize * (1 << I);
373-
FixedVectorType *SubTp = FixedVectorType::get(
374-
cast<FixedVectorType>(Tp)->getElementType(), InsertIndex);
375-
FixedVectorType *DesTp =
376-
FixedVectorType::getDoubleElementsVectorType(SubTp);
377-
std::pair<InstructionCost, MVT> DesLT = getTypeLegalizationCost(DesTp);
378-
// Add the cost of whole vector register move because the destination
379-
// vector register group for vslideup cannot overlap the source.
380-
Cost += DesLT.first * TLI->getLMULCost(DesLT.second);
381-
Cost += getShuffleCost(TTI::SK_InsertSubvector, DesTp, {}, CostKind,
382-
InsertIndex, SubTp);
383-
}
384-
return Cost;
385-
}
386-
return InstructionCost::getInvalid();
387-
}
388-
389346
static VectorType *getVRGatherIndexType(MVT DataVT, const RISCVSubtarget &ST,
390347
LLVMContext &C) {
391348
assert((DataVT.getScalarSizeInBits() != 8 ||
@@ -437,10 +394,6 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
437394
LT.second, CostKind);
438395
}
439396
}
440-
if (InstructionCost Cost =
441-
isMultipleInsertSubvector(Tp, Mask, CostKind);
442-
Cost.isValid())
443-
return Cost;
444397
}
445398
// vrgather + cost of generating the mask constant.
446399
// We model this for an unknown mask with a single vrgather.

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

-6
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
5555
/// type.
5656
InstructionCost getConstantPoolLoadCost(Type *Ty,
5757
TTI::TargetCostKind CostKind);
58-
59-
/// Return the cost if a shufflevector can be consist of multiple vslideup.
60-
/// Otherwise, return InstructionCost::getInvalid().
61-
InstructionCost isMultipleInsertSubvector(VectorType *Tp, ArrayRef<int> Mask,
62-
TTI::TargetCostKind CostKind);
63-
6458
public:
6559
explicit RISCVTTIImpl(const RISCVTargetMachine *TM, const Function &F)
6660
: BaseT(TM, F.getDataLayout()), ST(TM->getSubtargetImpl(F)),

llvm/test/Analysis/CostModel/RISCV/fixed-vector-insert-subvector.ll

-18
This file was deleted.

llvm/test/Transforms/SLPVectorizer/RISCV/remarks-insert-into-small-vector.ll

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
; YAML-NEXT: Function: test
99
; YAML-NEXT: Args:
1010
; YAML-NEXT: - String: 'Stores SLP vectorized with cost '
11-
; YAML-NEXT: - Cost: '0'
11+
; YAML-NEXT: - Cost: '2'
1212
; YAML-NEXT: - String: ' and with tree size '
1313
; YAML-NEXT: - TreeSize: '7'
1414

llvm/test/Transforms/SLPVectorizer/RISCV/revec-getGatherCost.ll

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
; YAML: Function: test1
99
; YAML: Args:
1010
; YAML: - String: 'Stores SLP vectorized with cost '
11-
; YAML: - Cost: '4'
11+
; YAML: - Cost: '6'
1212
; YAML: - String: ' and with tree size '
1313
; YAML: - TreeSize: '5'
1414

@@ -47,7 +47,7 @@ declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>)
4747
; YAML: Function: test2
4848
; YAML: Args:
4949
; YAML: - String: 'Stores SLP vectorized with cost '
50-
; YAML: - Cost: '12'
50+
; YAML: - Cost: '16'
5151
; YAML: - String: ' and with tree size '
5252
; YAML: - TreeSize: '5'
5353

0 commit comments

Comments
 (0)