[llvm] [NFC][TTI] Remove default CostKind from TTI::getShuffleCost() (PR #217996)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 11:09:35 PDT 2026
https://github.com/bababuck created https://github.com/llvm/llvm-project/pull/217996
Reordered arguments to maintain proper Cpp syntax.
See #135598.
>From 0fdf6442b2fa9387a9bfa20c5b211ac4ee5605f1 Mon Sep 17 00:00:00 2001
From: bababuck <buchner.ryan at gmail.com>
Date: Thu, 20 Aug 2026 13:08:55 -0700
Subject: [PATCH] [NFC][TTI] Remove default CostKind from TTI::getShuffleCost()
Reordered arguments to maintain proper Cpp syntax.
---
.../llvm/Analysis/TargetTransformInfo.h | 3 +-
.../llvm/Analysis/TargetTransformInfoImpl.h | 36 +++----
llvm/include/llvm/CodeGen/BasicTTIImpl.h | 32 +++---
llvm/lib/Analysis/TargetTransformInfo.cpp | 9 +-
.../AArch64/AArch64TargetTransformInfo.cpp | 10 +-
.../AArch64/AArch64TargetTransformInfo.h | 2 +-
.../Target/PowerPC/PPCTargetTransformInfo.cpp | 4 +-
.../Target/PowerPC/PPCTargetTransformInfo.h | 2 +-
.../Target/RISCV/RISCVTargetTransformInfo.cpp | 30 +++---
.../Target/RISCV/RISCVTargetTransformInfo.h | 2 +-
.../lib/Target/X86/X86TargetTransformInfo.cpp | 72 ++++++-------
llvm/lib/Target/X86/X86TargetTransformInfo.h | 2 +-
.../Scalar/LowerMatrixIntrinsics.cpp | 4 +-
.../Transforms/Vectorize/LoopVectorize.cpp | 8 +-
.../Transforms/Vectorize/SLPVectorizer.cpp | 2 +-
.../SLPVectorizer/SLPCostAnalysis.cpp | 8 +-
.../Transforms/Vectorize/VPlanLowering.cpp | 2 +-
.../lib/Transforms/Vectorize/VPlanRecipes.cpp | 6 +-
.../Transforms/Vectorize/VectorCombine.cpp | 100 +++++++++---------
19 files changed, 167 insertions(+), 167 deletions(-)
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 634042f946dfd..633b1bbebecbe 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -1565,8 +1565,7 @@ class TargetTransformInfo {
/// estimation in some cases, like in broadcast loads.
LLVM_ABI InstructionCost getShuffleCost(
ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask = {},
- TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput, int Index = 0,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask = {}, int Index = 0,
VectorType *SubTp = nullptr, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const;
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
index 4c8ef16f8271f..4931c2b6cf3da 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -778,7 +778,7 @@ class LLVM_ABI TargetTransformInfoImplBase {
virtual InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const {
return 1;
@@ -1647,12 +1647,12 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
if (Shuffle->isExtractSubvectorMask(SubIndex))
return TargetTTI->getShuffleCost(TTI::SK_ExtractSubvector, VecTy,
- VecSrcTy, Mask, CostKind, SubIndex,
+ VecSrcTy, CostKind, Mask, SubIndex,
VecTy, Operands, Shuffle);
if (Shuffle->isInsertSubvectorMask(NumSubElts, SubIndex))
return TargetTTI->getShuffleCost(
- TTI::SK_InsertSubvector, VecTy, VecSrcTy, Mask, CostKind,
+ TTI::SK_InsertSubvector, VecTy, VecSrcTy, CostKind, Mask,
SubIndex,
FixedVectorType::get(VecTy->getScalarType(), NumSubElts),
Operands, Shuffle);
@@ -1682,7 +1682,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
return TargetTTI->getShuffleCost(
IsUnary ? TTI::SK_PermuteSingleSrc : TTI::SK_PermuteTwoSrc, VecTy,
- VecTy, AdjustMask, CostKind, 0, nullptr, Operands, Shuffle);
+ VecTy, CostKind, AdjustMask, 0, nullptr, Operands, Shuffle);
}
// Narrowing shuffle - perform shuffle at original wider width and
@@ -1693,57 +1693,57 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
InstructionCost ShuffleCost = TargetTTI->getShuffleCost(
IsUnary ? TTI::SK_PermuteSingleSrc : TTI::SK_PermuteTwoSrc,
- VecSrcTy, VecSrcTy, AdjustMask, CostKind, 0, nullptr, Operands,
+ VecSrcTy, VecSrcTy, CostKind, AdjustMask, 0, nullptr, Operands,
Shuffle);
SmallVector<int, 16> ExtractMask(Mask.size());
std::iota(ExtractMask.begin(), ExtractMask.end(), 0);
return ShuffleCost + TargetTTI->getShuffleCost(
TTI::SK_ExtractSubvector, VecTy, VecSrcTy,
- ExtractMask, CostKind, 0, VecTy, {}, Shuffle);
+ CostKind, ExtractMask, 0, VecTy, {}, Shuffle);
}
if (Shuffle->isIdentity())
return TTI::TCC_Free;
if (Shuffle->isReverse())
- return TargetTTI->getShuffleCost(TTI::SK_Reverse, VecTy, VecSrcTy, Mask,
- CostKind, 0, nullptr, Operands,
+ return TargetTTI->getShuffleCost(TTI::SK_Reverse, VecTy, VecSrcTy,
+ CostKind, Mask, 0, nullptr, Operands,
Shuffle);
if (Shuffle->isTranspose())
return TargetTTI->getShuffleCost(TTI::SK_Transpose, VecTy, VecSrcTy,
- Mask, CostKind, 0, nullptr, Operands,
+ CostKind, Mask, 0, nullptr, Operands,
Shuffle);
if (Shuffle->isZeroEltSplat())
return TargetTTI->getShuffleCost(TTI::SK_Broadcast, VecTy, VecSrcTy,
- Mask, CostKind, 0, nullptr, Operands,
+ CostKind, Mask, 0, nullptr, Operands,
Shuffle);
if (Shuffle->isSingleSource())
return TargetTTI->getShuffleCost(TTI::SK_PermuteSingleSrc, VecTy,
- VecSrcTy, Mask, CostKind, 0, nullptr,
+ VecSrcTy, CostKind, Mask, 0, nullptr,
Operands, Shuffle);
if (Shuffle->isInsertSubvectorMask(NumSubElts, SubIndex))
return TargetTTI->getShuffleCost(
- TTI::SK_InsertSubvector, VecTy, VecSrcTy, Mask, CostKind, SubIndex,
+ TTI::SK_InsertSubvector, VecTy, VecSrcTy, CostKind, Mask, SubIndex,
FixedVectorType::get(VecTy->getScalarType(), NumSubElts), Operands,
Shuffle);
if (Shuffle->isSelect())
- return TargetTTI->getShuffleCost(TTI::SK_Select, VecTy, VecSrcTy, Mask,
- CostKind, 0, nullptr, Operands,
+ return TargetTTI->getShuffleCost(TTI::SK_Select, VecTy, VecSrcTy,
+ CostKind, Mask, 0, nullptr, Operands,
Shuffle);
if (Shuffle->isSplice(SubIndex))
- return TargetTTI->getShuffleCost(TTI::SK_Splice, VecTy, VecSrcTy, Mask,
- CostKind, SubIndex, nullptr, Operands,
- Shuffle);
+ return TargetTTI->getShuffleCost(TTI::SK_Splice, VecTy, VecSrcTy,
+ CostKind, Mask, SubIndex, nullptr,
+ Operands, Shuffle);
return TargetTTI->getShuffleCost(TTI::SK_PermuteTwoSrc, VecTy, VecSrcTy,
- Mask, CostKind, 0, nullptr, Operands,
+ CostKind, Mask, 0, nullptr, Operands,
Shuffle);
}
case Instruction::ExtractElement: {
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 5b88859ba090b..789812cf27831 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -344,7 +344,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
ElementCount VF = getVectorizedTypeVF(RetTy);
auto VecTy = VectorType::get(IntegerType::getInt1Ty(Ctx), VF);
Cost += thisT()->getShuffleCost(TargetTransformInfo::SK_Broadcast, VecTy,
- VecTy, {}, CostKind, 0, nullptr, {});
+ VecTy, CostKind, {}, 0, nullptr, {});
}
// Lowering to a library call (with output pointers) may require us to emit
@@ -1216,7 +1216,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override {
switch (improveShuffleKindFromMask(Kind, Mask, SrcTy, Index, SubTp)) {
@@ -2061,10 +2061,10 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
if (isa<ScalableVectorType>(RetTy))
return BaseT::getIntrinsicInstrCost(ICA, CostKind);
unsigned Index = cast<ConstantInt>(Args[1])->getZExtValue();
- return thisT()->getShuffleCost(TTI::SK_ExtractSubvector,
- cast<VectorType>(RetTy),
- cast<VectorType>(Args[0]->getType()), {},
- CostKind, Index, cast<VectorType>(RetTy));
+ return thisT()->getShuffleCost(
+ TTI::SK_ExtractSubvector, cast<VectorType>(RetTy),
+ cast<VectorType>(Args[0]->getType()), CostKind, {}, Index,
+ cast<VectorType>(RetTy));
}
case Intrinsic::vector_insert: {
// FIXME: Handle case where a scalable vector is inserted into a scalable
@@ -2074,7 +2074,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
unsigned Index = cast<ConstantInt>(Args[2])->getZExtValue();
return thisT()->getShuffleCost(
TTI::SK_InsertSubvector, cast<VectorType>(RetTy),
- cast<VectorType>(Args[0]->getType()), {}, CostKind, Index,
+ cast<VectorType>(Args[0]->getType()), CostKind, {}, Index,
cast<VectorType>(Args[1]->getType()));
}
case Intrinsic::vector_splice_left:
@@ -2085,7 +2085,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
unsigned Index = COffset->getZExtValue();
return thisT()->getShuffleCost(
TTI::SK_Splice, cast<VectorType>(RetTy),
- cast<VectorType>(Args[0]->getType()), {}, CostKind,
+ cast<VectorType>(Args[0]->getType()), CostKind, {},
IID == Intrinsic::vector_splice_left ? Index : -Index,
cast<VectorType>(RetTy));
}
@@ -2574,8 +2574,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
CostKind, 1, nullptr, nullptr);
Cost += thisT()->getVectorInstrCost(Instruction::InsertElement, SearchTy,
CostKind, 0, nullptr, nullptr);
- Cost += thisT()->getShuffleCost(TTI::SK_Broadcast, SearchTy, SearchTy, {},
- CostKind, 0, nullptr);
+ Cost += thisT()->getShuffleCost(TTI::SK_Broadcast, SearchTy, SearchTy,
+ CostKind, {}, 0, nullptr);
Cost += thisT()->getCmpSelInstrCost(BinaryOperator::ICmp, SearchTy, RetTy,
CmpInst::ICMP_EQ, CostKind);
Cost +=
@@ -2587,8 +2587,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
}
case Intrinsic::vector_reverse:
return thisT()->getShuffleCost(TTI::SK_Reverse, cast<VectorType>(RetTy),
- cast<VectorType>(ICA.getArgTypes()[0]), {},
- CostKind, 0, cast<VectorType>(RetTy));
+ cast<VectorType>(ICA.getArgTypes()[0]),
+ CostKind, {}, 0, cast<VectorType>(RetTy));
case Intrinsic::experimental_vector_histogram_add:
case Intrinsic::experimental_vector_histogram_uadd_sat:
case Intrinsic::experimental_vector_histogram_umax:
@@ -3353,7 +3353,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
NumVecElts /= 2;
VectorType *SubTy = FixedVectorType::get(ScalarTy, NumVecElts);
ShuffleCost += thisT()->getShuffleCost(
- TTI::SK_ExtractSubvector, SubTy, Ty, {}, CostKind, NumVecElts, SubTy);
+ TTI::SK_ExtractSubvector, SubTy, Ty, CostKind, {}, NumVecElts, SubTy);
ArithCost += thisT()->getArithmeticInstrCost(Opcode, SubTy, CostKind);
Ty = SubTy;
++LongVectorCount;
@@ -3369,7 +3369,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
// By default reductions need one shuffle per reduction level.
ShuffleCost +=
NumReduxLevels * thisT()->getShuffleCost(TTI::SK_PermuteSingleSrc, Ty,
- Ty, {}, CostKind, 0, Ty);
+ Ty, CostKind, {}, 0, Ty);
ArithCost +=
NumReduxLevels * thisT()->getArithmeticInstrCost(Opcode, Ty, CostKind);
return ShuffleCost + ArithCost +
@@ -3444,7 +3444,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
auto *SubTy = FixedVectorType::get(ScalarTy, NumVecElts);
ShuffleCost += thisT()->getShuffleCost(
- TTI::SK_ExtractSubvector, SubTy, Ty, {}, CostKind, NumVecElts, SubTy);
+ TTI::SK_ExtractSubvector, SubTy, Ty, CostKind, {}, NumVecElts, SubTy);
IntrinsicCostAttributes Attrs(IID, SubTy, {SubTy, SubTy}, FMF);
MinMaxCost += getIntrinsicInstrCost(Attrs, CostKind);
@@ -3460,7 +3460,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
// architecture-dependent length.
ShuffleCost +=
NumReduxLevels * thisT()->getShuffleCost(TTI::SK_PermuteSingleSrc, Ty,
- Ty, {}, CostKind, 0, Ty);
+ Ty, CostKind, {}, 0, Ty);
IntrinsicCostAttributes Attrs(IID, Ty, {Ty, Ty}, FMF);
MinMaxCost += NumReduxLevels * getIntrinsicInstrCost(Attrs, CostKind);
// The last min/max should be in vector registers and we counted it above.
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index a0ecb16cfb97b..d334c4fd9b856 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -1043,16 +1043,17 @@ InstructionCost TargetTransformInfo::getAltInstrCost(
}
InstructionCost TargetTransformInfo::getShuffleCost(
- ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy, ArrayRef<int> Mask,
- TTI::TargetCostKind CostKind, int Index, VectorType *SubTp,
- ArrayRef<const Value *> Args, const Instruction *CxtI) const {
+ ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
+ VectorType *SubTp, ArrayRef<const Value *> Args,
+ const Instruction *CxtI) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
"Expected the Mask to match the return size if given");
assert(SrcTy->getScalarType() == DstTy->getScalarType() &&
"Expected the same scalar types");
InstructionCost Cost = TTIImpl->getShuffleCost(
- Kind, DstTy, SrcTy, Mask, CostKind, Index, SubTp, Args, CxtI);
+ Kind, DstTy, SrcTy, CostKind, Mask, Index, SubTp, Args, CxtI);
assert(Cost >= 0 && "TTI should not produce negative costs!");
return Cost;
}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 586d0aafa0205..4aec6721f0e04 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -6850,9 +6850,9 @@ InstructionCost AArch64TTIImpl::getPartialReductionCost(
InstructionCost
AArch64TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
- VectorType *SrcTy, ArrayRef<int> Mask,
- TTI::TargetCostKind CostKind, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args,
+ VectorType *SrcTy, TTI::TargetCostKind CostKind,
+ ArrayRef<int> Mask, int Index, VectorType *SubTp,
+ ArrayRef<const Value *> Args,
const Instruction *CxtI) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
@@ -6947,7 +6947,7 @@ AArch64TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
NumSources <= 2
? getShuffleCost(NumSources <= 1 ? TTI::SK_PermuteSingleSrc
: TTI::SK_PermuteTwoSrc,
- NTp, NTp, NMask, CostKind, 0, nullptr, Args,
+ NTp, NTp, CostKind, NMask, 0, nullptr, Args,
CxtI)
: LTNumElts;
Result.first->second = NCost;
@@ -7210,7 +7210,7 @@ AArch64TTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
// Restore optimal kind.
if (IsExtractSubvector)
Kind = TTI::SK_ExtractSubvector;
- return BaseT::getShuffleCost(Kind, DstTy, SrcTy, Mask, CostKind, Index, SubTp,
+ return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index, SubTp,
Args, CxtI);
}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
index 19de90427cb74..6cd9ba15b06a1 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h
@@ -505,7 +505,7 @@ class AArch64TTIImpl final : public BasicTTIImplBase<AArch64TTIImpl> {
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override;
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
index b3a54fd4c1ef4..48f16ad507425 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
@@ -619,9 +619,9 @@ InstructionCost PPCTTIImpl::getArithmeticInstrCost(
InstructionCost PPCTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask,
TTI::TargetCostKind CostKind,
- int Index, VectorType *SubTp,
+ ArrayRef<int> Mask, int Index,
+ VectorType *SubTp,
ArrayRef<const Value *> Args,
const Instruction *CxtI) const {
diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
index c8ec1960b17dd..26ff6b39d6143 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
+++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h
@@ -113,7 +113,7 @@ class PPCTTIImpl final : public BasicTTIImplBase<PPCTTIImpl> {
const Instruction *CxtI = nullptr) const override;
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override;
InstructionCost
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 970b1605cc610..a02800e2fcee6 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -526,13 +526,13 @@ static InstructionCost costShuffleViaSplitting(const RISCVTTIImpl &TTI,
Cost += TTI.getShuffleCost(
TTI::SK_PermuteSingleSrc,
FixedVectorType::get(SingleOpTy->getElementType(), RegMask.size()),
- SingleOpTy, RegMask, CostKind, 0, nullptr);
+ SingleOpTy, CostKind, RegMask, 0, nullptr);
},
[&](ArrayRef<int> RegMask, unsigned Idx1, unsigned Idx2, bool NewReg) {
Cost += TTI.getShuffleCost(
TTI::SK_PermuteTwoSrc,
FixedVectorType::get(SingleOpTy->getElementType(), RegMask.size()),
- SingleOpTy, RegMask, CostKind, 0, nullptr);
+ SingleOpTy, CostKind, RegMask, 0, nullptr);
});
return Cost;
}
@@ -601,11 +601,11 @@ costShuffleViaVRegSplitting(const RISCVTTIImpl &TTI, MVT LegalVT,
return;
++NumShuffles;
Cost += TTI.getShuffleCost(TTI::SK_PermuteSingleSrc, SingleOpTy,
- SingleOpTy, RegMask, CostKind, 0, nullptr);
+ SingleOpTy, CostKind, RegMask, 0, nullptr);
},
[&](ArrayRef<int> RegMask, unsigned Idx1, unsigned Idx2, bool NewReg) {
Cost += TTI.getShuffleCost(TTI::SK_PermuteTwoSrc, SingleOpTy,
- SingleOpTy, RegMask, CostKind, 0, nullptr);
+ SingleOpTy, CostKind, RegMask, 0, nullptr);
NumShuffles += 2;
});
// Note: check that we do not emit too many shuffles here to prevent code
@@ -678,9 +678,9 @@ InstructionCost RISCVTTIImpl::getSlideCost(FixedVectorType *Tp,
InstructionCost
RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
- VectorType *SrcTy, ArrayRef<int> Mask,
- TTI::TargetCostKind CostKind, int Index,
- VectorType *SubTp, ArrayRef<const Value *> Args,
+ VectorType *SrcTy, TTI::TargetCostKind CostKind,
+ ArrayRef<int> Mask, int Index, VectorType *SubTp,
+ ArrayRef<const Value *> Args,
const Instruction *CxtI) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
Mask.size() == DstTy->getElementCount().getKnownMinValue()) &&
@@ -753,8 +753,8 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
// destination vector register group for vslideup cannot overlap the
// source.
Cost += DestLT.first * TLI->getLMULCost(DestLT.second);
- Cost += getShuffleCost(TTI::SK_InsertSubvector, DestTp, DestTp, {},
- CostKind, InsertIndex, SubTp);
+ Cost += getShuffleCost(TTI::SK_InsertSubvector, DestTp, DestTp,
+ CostKind, {}, InsertIndex, SubTp);
}
return Cost;
}
@@ -950,7 +950,7 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
cast<VectorType>(SrcTy)->getElementCount());
return getCastInstrCost(Instruction::ZExt, WideTy, SrcTy,
TTI::CastContextHint::None, CostKind) +
- getShuffleCost(TTI::SK_Reverse, WideTy, WideTy, {}, CostKind, 0,
+ getShuffleCost(TTI::SK_Reverse, WideTy, WideTy, CostKind, {}, 0,
nullptr) +
getCastInstrCost(Instruction::Trunc, SrcTy, WideTy,
TTI::CastContextHint::None, CostKind);
@@ -998,7 +998,7 @@ RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy,
return FixedCost + LT.first * (GatherCost + SlideCost);
}
}
- return BaseT::getShuffleCost(Kind, DstTy, SrcTy, Mask, CostKind, Index,
+ return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index,
SubTp);
}
@@ -1204,7 +1204,7 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
Mask.resize(VF * Factor, -1);
InstructionCost ShuffleCost =
getShuffleCost(TTI::ShuffleKind::SK_PermuteSingleSrc, VecTy, VecTy,
- Mask, CostKind, 0, nullptr, {});
+ CostKind, Mask, 0, nullptr, {});
Cost += ShuffleCost;
}
return Cost;
@@ -1230,8 +1230,8 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
// shuffle that goes into the wide store
auto Mask = createInterleaveMask(VF, Factor);
InstructionCost ShuffleCost =
- getShuffleCost(TTI::ShuffleKind::SK_PermuteSingleSrc, FVTy, FVTy, Mask,
- CostKind, 0, nullptr, {});
+ getShuffleCost(TTI::ShuffleKind::SK_PermuteSingleSrc, FVTy, FVTy,
+ CostKind, Mask, 0, nullptr, {});
return MemCost + ShuffleCost;
}
@@ -1747,7 +1747,7 @@ RISCVTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
// Note that index only change the cost from vslide.vx to vslide.vi and in
// current implementations they have same costs.
return getShuffleCost(TTI::SK_Splice, cast<VectorType>(ICA.getReturnType()),
- cast<VectorType>(ICA.getArgTypes()[0]), {}, CostKind,
+ cast<VectorType>(ICA.getArgTypes()[0]), CostKind, {},
0, cast<VectorType>(ICA.getReturnType()));
}
case Intrinsic::vp_merge: {
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 7c133468f7260..447c3d7c3326e 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -177,7 +177,7 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override;
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index e3d838a7f4fde..efcc1b664a86b 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -1597,9 +1597,9 @@ X86TTIImpl::getAltInstrCost(VectorType *VecTy, unsigned Opcode0,
InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask,
TTI::TargetCostKind CostKind,
- int Index, VectorType *SubTp,
+ ArrayRef<int> Mask, int Index,
+ VectorType *SubTp,
ArrayRef<const Value *> Args,
const Instruction *CxtI) const {
assert((Mask.empty() || DstTy->isScalableTy() ||
@@ -1625,8 +1625,8 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
ShuffleVectorInst::isIdentityMask(Mask, Mask.size()))
return getShuffleCost(TTI::SK_InsertSubvector,
VectorType::getDoubleElementsVectorType(SrcTy),
- VectorType::getDoubleElementsVectorType(SrcTy), Mask,
- CostKind, Mask.size() / 2, SrcTy);
+ VectorType::getDoubleElementsVectorType(SrcTy),
+ CostKind, Mask, Mask.size() / 2, SrcTy);
// Treat Transpose as 2-op shuffles - there's no difference in lowering.
if (Kind == TTI::SK_Transpose)
@@ -1740,7 +1740,7 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
SubLT.second.getVectorNumElements());
int ExtractIndex = alignDown((Index % NumElts), NumSubElts);
InstructionCost ExtractCost =
- getShuffleCost(TTI::SK_ExtractSubvector, VecTy, VecTy, {}, CostKind,
+ getShuffleCost(TTI::SK_ExtractSubvector, VecTy, VecTy, CostKind, {},
ExtractIndex, SubTy);
// If the original size is 32-bits or more, we can use pshufd. Otherwise
@@ -1890,7 +1890,7 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
PrevRegMask != RegMask)
Cost +=
getShuffleCost(TTI::SK_PermuteSingleSrc, SingleOpTy,
- SingleOpTy, RegMask, CostKind, 0, nullptr);
+ SingleOpTy, CostKind, RegMask, 0, nullptr);
else
// Just a copy of previous destination register.
Cost += TTI::TCC_Basic;
@@ -1908,18 +1908,18 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
&Cost](ArrayRef<int> RegMask, unsigned /*Unused*/,
unsigned /*Unused*/, bool /*Unused*/) {
Cost += getShuffleCost(TTI::SK_PermuteTwoSrc, SingleOpTy,
- SingleOpTy, RegMask, CostKind, 0, nullptr);
+ SingleOpTy, CostKind, RegMask, 0, nullptr);
});
return Cost;
}
InstructionCost NumOfShuffles = (NumOfSrcs - 1) * NumOfDests;
return NumOfShuffles * getShuffleCost(TTI::SK_PermuteTwoSrc, SingleOpTy,
- SingleOpTy, {}, CostKind, 0,
+ SingleOpTy, CostKind, {}, 0,
nullptr);
}
- return BaseT::getShuffleCost(Kind, DstTy, SrcTy, Mask, CostKind, Index,
+ return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index,
SubTp);
}
@@ -2417,7 +2417,7 @@ InstructionCost X86TTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
return LT.first * *KindCost;
}
- return BaseT::getShuffleCost(Kind, DstTy, SrcTy, Mask, CostKind, Index,
+ return BaseT::getShuffleCost(Kind, DstTy, SrcTy, CostKind, Mask, Index,
SubTp);
}
@@ -5124,8 +5124,8 @@ InstructionCost X86TTIImpl::getVectorInstrCost(
EVT VT = TLI->getValueType(DL, Val);
if (VT.getScalarType() != MScalarTy || VT.getSizeInBits() >= 128)
SubTy = FixedVectorType::get(ScalarType, SubNumElts);
- ShuffleCost = getShuffleCost(TTI::SK_PermuteTwoSrc, SubTy, SubTy, {},
- CostKind, 0, SubTy);
+ ShuffleCost = getShuffleCost(TTI::SK_PermuteTwoSrc, SubTy, SubTy,
+ CostKind, {}, 0, SubTy);
}
int IntOrFpCost = ScalarType->isFloatingPointTy() ? 0 : 1;
return ShuffleCost + IntOrFpCost + RegisterFileMoveCost;
@@ -5222,8 +5222,8 @@ InstructionCost X86TTIImpl::getScalarizationOverhead(
// FIXME: we don't need to extract if all non-demanded elements
// are legalization-inserted padding.
if (!LaneEltMask.isAllOnes())
- Cost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, {},
- CostKind, I * NumEltsPerLane, LaneTy);
+ Cost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, CostKind,
+ {}, I * NumEltsPerLane, LaneTy);
Cost += BaseT::getScalarizationOverhead(LaneTy, LaneEltMask, Insert,
/*Extract*/ false, CostKind);
}
@@ -5240,8 +5240,8 @@ InstructionCost X86TTIImpl::getScalarizationOverhead(
if (!AffectedLanes[I] ||
(Lane == 0 && FullyAffectedLegalVectors[LegalVec]))
continue;
- Cost += getShuffleCost(TTI::SK_InsertSubvector, Ty, Ty, {},
- CostKind, I * NumEltsPerLane, LaneTy);
+ Cost += getShuffleCost(TTI::SK_InsertSubvector, Ty, Ty, CostKind,
+ {}, I * NumEltsPerLane, LaneTy);
}
}
}
@@ -5300,7 +5300,7 @@ InstructionCost X86TTIImpl::getScalarizationOverhead(
NumEltsPerLane, I * NumEltsPerLane);
if (LaneEltMask.isZero())
continue;
- Cost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, {}, CostKind,
+ Cost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, CostKind, {},
I * NumEltsPerLane, LaneTy);
Cost += BaseT::getScalarizationOverhead(
LaneTy, LaneEltMask, /*Insert*/ false, Extract, CostKind);
@@ -5420,7 +5420,7 @@ X86TTIImpl::getReplicationShuffleCost(Type *EltTy, int ReplicationFactor,
InstructionCost SingleShuffleCost =
getShuffleCost(TTI::SK_PermuteSingleSrc, SingleDstVecTy, SingleDstVecTy,
- /*Mask=*/{}, CostKind,
+ CostKind, /*Mask=*/{},
/*Index=*/0, /*SubTp=*/nullptr);
return NumDstVectorsDemanded * SingleShuffleCost;
}
@@ -5570,7 +5570,7 @@ InstructionCost X86TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
Cost +=
getShuffleCost(IsLoad ? TTI::ShuffleKind::SK_InsertSubvector
: TTI::ShuffleKind::SK_ExtractSubvector,
- VTy, VTy, {}, CostKind, NumEltDone(), CurrVecTy);
+ VTy, VTy, CostKind, {}, NumEltDone(), CurrVecTy);
}
// While we can directly load/store ZMM, YMM, and 64-bit halves of XMM,
@@ -5665,9 +5665,9 @@ X86TTIImpl::getMaskedMemoryOpCost(const MemIntrinsicCostAttributes &MICA,
if (VT.isSimple() && Ty != VT.getSimpleVT() &&
LT.second.getVectorNumElements() == NumElem)
// Promotion requires extend/truncate for data and a shuffle for mask.
- Cost += getShuffleCost(TTI::SK_PermuteTwoSrc, SrcVTy, SrcVTy, {}, CostKind,
+ Cost += getShuffleCost(TTI::SK_PermuteTwoSrc, SrcVTy, SrcVTy, CostKind, {},
0, nullptr) +
- getShuffleCost(TTI::SK_PermuteTwoSrc, MaskTy, MaskTy, {}, CostKind,
+ getShuffleCost(TTI::SK_PermuteTwoSrc, MaskTy, MaskTy, CostKind, {},
0, nullptr);
else if (LT.first * Ty.getVectorNumElements() > NumElem) {
@@ -5675,8 +5675,8 @@ X86TTIImpl::getMaskedMemoryOpCost(const MemIntrinsicCostAttributes &MICA,
(unsigned)LT.first.getValue() *
Ty.getVectorNumElements());
// Expanding requires fill mask with zeroes
- Cost += getShuffleCost(TTI::SK_InsertSubvector, NewMaskTy, NewMaskTy, {},
- CostKind, 0, MaskTy);
+ Cost += getShuffleCost(TTI::SK_InsertSubvector, NewMaskTy, NewMaskTy,
+ CostKind, {}, 0, MaskTy);
}
// Pre-AVX512 - each maskmov load costs 2 + store costs ~8.
@@ -6070,8 +6070,8 @@ X86TTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy,
// If we're reducing from 256/512 bits, use an extract_subvector.
if (Size > 128) {
auto *SubTy = FixedVectorType::get(ValVTy->getElementType(), NumVecElts);
- ReductionCost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, {},
- CostKind, NumVecElts, SubTy);
+ ReductionCost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty,
+ CostKind, {}, NumVecElts, SubTy);
Ty = SubTy;
} else if (Size == 128) {
// Reducing from 128 bits is a permute of v2f64/v2i64.
@@ -6083,7 +6083,7 @@ X86TTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy,
ShufTy =
FixedVectorType::get(Type::getInt64Ty(ValVTy->getContext()), 2);
ReductionCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, ShufTy,
- {}, CostKind, 0, nullptr);
+ CostKind, {}, 0, nullptr);
} else if (Size == 64) {
// Reducing from 64 bits is a shuffle of v4f32/v4i32.
FixedVectorType *ShufTy;
@@ -6094,7 +6094,7 @@ X86TTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *ValTy,
ShufTy =
FixedVectorType::get(Type::getInt32Ty(ValVTy->getContext()), 4);
ReductionCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, ShufTy,
- {}, CostKind, 0, nullptr);
+ CostKind, {}, 0, nullptr);
} else {
// Reducing from smaller size is a shift by immediate.
auto *ShiftTy = FixedVectorType::get(
@@ -6340,8 +6340,8 @@ X86TTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *ValTy,
// If we're reducing from 256/512 bits, use an extract_subvector.
if (Size > 128) {
auto *SubTy = FixedVectorType::get(ValVTy->getElementType(), NumVecElts);
- MinMaxCost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, {},
- CostKind, NumVecElts, SubTy);
+ MinMaxCost += getShuffleCost(TTI::SK_ExtractSubvector, Ty, Ty, CostKind,
+ {}, NumVecElts, SubTy);
Ty = SubTy;
} else if (Size == 128) {
// Reducing from 128 bits is a permute of v2f64/v2i64.
@@ -6351,8 +6351,8 @@ X86TTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *ValTy,
FixedVectorType::get(Type::getDoubleTy(ValTy->getContext()), 2);
else
ShufTy = FixedVectorType::get(Type::getInt64Ty(ValTy->getContext()), 2);
- MinMaxCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, ShufTy, {},
- CostKind, 0, nullptr);
+ MinMaxCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, ShufTy,
+ CostKind, {}, 0, nullptr);
} else if (Size == 64) {
// Reducing from 64 bits is a shuffle of v4f32/v4i32.
FixedVectorType *ShufTy;
@@ -6360,8 +6360,8 @@ X86TTIImpl::getMinMaxReductionCost(Intrinsic::ID IID, VectorType *ValTy,
ShufTy = FixedVectorType::get(Type::getFloatTy(ValTy->getContext()), 4);
else
ShufTy = FixedVectorType::get(Type::getInt32Ty(ValTy->getContext()), 4);
- MinMaxCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, ShufTy, {},
- CostKind, 0, nullptr);
+ MinMaxCost += getShuffleCost(TTI::SK_PermuteSingleSrc, ShufTy, ShufTy,
+ CostKind, {}, 0, nullptr);
} else {
// Reducing from smaller size is a shift by immediate.
auto *ShiftTy = FixedVectorType::get(
@@ -7162,7 +7162,7 @@ InstructionCost X86TTIImpl::getInterleavedMemoryOpCostAVX512(
(NumOfMemOps > 1) ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc;
InstructionCost ShuffleCost = getShuffleCost(
- ShuffleKind, SingleMemOpTy, SingleMemOpTy, {}, CostKind, 0, nullptr);
+ ShuffleKind, SingleMemOpTy, SingleMemOpTy, CostKind, {}, 0, nullptr);
unsigned NumOfLoadsInInterleaveGrp =
Indices.size() ? Indices.size() : Factor;
@@ -7219,8 +7219,8 @@ InstructionCost X86TTIImpl::getInterleavedMemoryOpCostAVX512(
// shuffle.
unsigned NumOfSources = Factor; // The number of values to be merged.
InstructionCost ShuffleCost =
- getShuffleCost(TTI::SK_PermuteTwoSrc, SingleMemOpTy, SingleMemOpTy, {},
- CostKind, 0, nullptr);
+ getShuffleCost(TTI::SK_PermuteTwoSrc, SingleMemOpTy, SingleMemOpTy,
+ CostKind, {}, 0, nullptr);
unsigned NumOfShufflesPerStore = NumOfSources - 1;
// The SK_MergeTwoSrc shuffle clobbers one of src operands.
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.h b/llvm/lib/Target/X86/X86TargetTransformInfo.h
index 69c9df33630d8..422e4aad2316c 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.h
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.h
@@ -79,7 +79,7 @@ class X86TTIImpl final : public BasicTTIImplBase<X86TTIImpl> {
InstructionCost
getShuffleCost(TTI::ShuffleKind Kind, VectorType *DstTy, VectorType *SrcTy,
- ArrayRef<int> Mask, TTI::TargetCostKind CostKind, int Index,
+ TTI::TargetCostKind CostKind, ArrayRef<int> Mask, int Index,
VectorType *SubTp, ArrayRef<const Value *> Args = {},
const Instruction *CxtI = nullptr) const override;
InstructionCost
diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index 1e363437348f9..44a6caf3c228f 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -1625,7 +1625,7 @@ class LowerMatrixIntrinsics {
for (unsigned I = 1; I < N; ++I)
EmbedCost += TTI.getShuffleCost(
TTI::SK_Splice, FixedVectorType::get(EltTy, 1),
- FixedVectorType::get(EltTy, 1), {}, TTI::TCK_RecipThroughput);
+ FixedVectorType::get(EltTy, 1), TTI::TCK_RecipThroughput);
return EmbedCost;
}
@@ -1647,7 +1647,7 @@ class LowerMatrixIntrinsics {
for (unsigned I = 1; I < N; ++I)
EmbedCost -= TTI.getShuffleCost(
TTI::SK_Splice, FixedVectorType::get(EltTy, 1),
- FixedVectorType::get(EltTy, 1), {}, TTI::TCK_RecipThroughput);
+ FixedVectorType::get(EltTy, 1), TTI::TCK_RecipThroughput);
return EmbedCost;
}
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 24083eb7e8e6e..1968efc5cef6a 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4291,7 +4291,7 @@ InstructionCost LoopVectorizationCostModel::getConsecutiveMemOpCost(
if (Kind == CM_Widen_Reverse)
Cost += TTI.getShuffleCost(TargetTransformInfo::SK_Reverse, VectorTy,
- VectorTy, {}, Config.CostKind, 0);
+ VectorTy, Config.CostKind, {}, 0);
return Cost;
}
@@ -4311,7 +4311,7 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
TTI.getMemoryOpCost(Instruction::Load, ValTy, Alignment, AS,
Config.CostKind) +
TTI.getShuffleCost(TargetTransformInfo::SK_Broadcast, VectorTy,
- VectorTy, {}, Config.CostKind);
+ VectorTy, Config.CostKind);
}
StoreInst *SI = cast<StoreInst>(I);
@@ -4388,7 +4388,7 @@ LoopVectorizationCostModel::getInterleaveGroupCost(Instruction *I,
"Reverse masked interleaved access not supported.");
Cost += Group->getNumMembers() *
TTI.getShuffleCost(TargetTransformInfo::SK_Reverse, VectorTy,
- VectorTy, {}, Config.CostKind, 0);
+ VectorTy, Config.CostKind, {}, 0);
}
return Cost;
}
@@ -5016,7 +5016,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
if (VF.isVector() && Legal->isFixedOrderRecurrence(Phi)) {
return TTI.getShuffleCost(
TargetTransformInfo::SK_Splice, cast<VectorType>(VectorTy),
- cast<VectorType>(VectorTy), {}, Config.CostKind, -1);
+ cast<VectorType>(VectorTy), Config.CostKind, {}, -1);
}
// Phi nodes in non-header blocks (not inductions, reductions, etc.) are
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 75d726bdf2e8c..6c98a56e62a57 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -15512,7 +15512,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
if (isa<FixedVectorType>(ScalarTy)) {
assert(SLPReVec && "FixedVectorType is not expected.");
return TTI.getShuffleCost(
- TTI::SK_InsertSubvector, VecTy, VecTy, {}, CostKind,
+ TTI::SK_InsertSubvector, VecTy, VecTy, CostKind, {},
std::distance(VL.begin(), It) * getNumElements(ScalarTy),
cast<FixedVectorType>(ScalarTy));
}
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
index 8a8d6b029bdd4..6ad2ad32c570d 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer/SLPCostAnalysis.cpp
@@ -32,7 +32,7 @@ InstructionCost getShuffleCost(const TargetTransformInfo &TTI,
DstTy = FixedVectorType::get(Tp->getScalarType(), Mask.size());
if (Kind != TTI::SK_PermuteTwoSrc)
- return TTI.getShuffleCost(Kind, DstTy, Tp, Mask, CostKind, Index, SubTp,
+ return TTI.getShuffleCost(Kind, DstTy, Tp, CostKind, Mask, Index, SubTp,
Args);
int NumSrcElts = Tp->getElementCount().getKnownMinValue();
int NumSubElts;
@@ -40,10 +40,10 @@ InstructionCost getShuffleCost(const TargetTransformInfo &TTI,
Mask, NumSrcElts, NumSubElts, Index)) {
if (Index + NumSubElts > NumSrcElts &&
Index + NumSrcElts <= static_cast<int>(Mask.size()))
- return TTI.getShuffleCost(TTI::SK_InsertSubvector, DstTy, Tp, Mask,
- CostKind, Index, Tp);
+ return TTI.getShuffleCost(TTI::SK_InsertSubvector, DstTy, Tp, CostKind,
+ Mask, Index, Tp);
}
- return TTI.getShuffleCost(Kind, DstTy, Tp, Mask, CostKind, Index, SubTp,
+ return TTI.getShuffleCost(Kind, DstTy, Tp, CostKind, Mask, Index, SubTp,
Args);
}
diff --git a/llvm/lib/Transforms/Vectorize/VPlanLowering.cpp b/llvm/lib/Transforms/Vectorize/VPlanLowering.cpp
index 36a1129f5cefe..c254138e742f5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanLowering.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanLowering.cpp
@@ -87,7 +87,7 @@ void VPlanTransforms::replaceWideCanonicalIVWithWideIV(
// Introduce a new VPWidenIntOrFpInductionRecipe if profitable.
auto *VecTy = VectorType::get(CanIVTy, VF);
InstructionCost BroadcastCost = TTI.getShuffleCost(
- TargetTransformInfo::SK_Broadcast, VecTy, VecTy, {}, CostKind);
+ TargetTransformInfo::SK_Broadcast, VecTy, VecTy, CostKind);
InstructionCost PHICost = TTI.getCFInstrCost(Instruction::PHI, CostKind);
if (PHICost > BroadcastCost)
return;
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 306a4a259affe..c91ebcbfb0908 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1424,7 +1424,7 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
Type *VectorTy = toVectorTy(this->getScalarType(), VF);
return Ctx.TTI.getShuffleCost(
TargetTransformInfo::SK_Splice, cast<VectorType>(VectorTy),
- cast<VectorType>(VectorTy), {}, Ctx.CostKind, -1);
+ cast<VectorType>(VectorTy), Ctx.CostKind, {}, -1);
}
case VPInstruction::ActiveLaneMask:
case VPInstruction::WideActiveLaneMask: {
@@ -1456,7 +1456,7 @@ InstructionCost VPInstruction::computeCost(ElementCount VF,
return 0;
auto *VectorTy = cast<VectorType>(toVectorTy(EltTy, VF));
return Ctx.TTI.getShuffleCost(TargetTransformInfo::SK_Reverse, VectorTy,
- VectorTy, /*Mask=*/{}, Ctx.CostKind,
+ VectorTy, Ctx.CostKind, /*Mask=*/{},
/*Index=*/0);
}
case VPInstruction::ExtractLastLane: {
@@ -4856,7 +4856,7 @@ InstructionCost VPInterleaveBase::computeCost(ElementCount VF,
return Cost + IG->getNumMembers() *
Ctx.TTI.getShuffleCost(TargetTransformInfo::SK_Reverse,
- VectorTy, VectorTy, {}, Ctx.CostKind,
+ VectorTy, VectorTy, Ctx.CostKind, {},
0);
}
diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index 01f6f20ecff5c..ce4954161d69a 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -346,8 +346,8 @@ bool VectorCombine::vectorizeLoadInsert(Instruction &I) {
assert(OffsetEltIndex < MinVecNumElts && "Address offset too big");
Mask[0] = OffsetEltIndex;
if (OffsetEltIndex)
- NewCost += TTI.getShuffleCost(TTI::SK_PermuteSingleSrc, Ty, MinVecTy, Mask,
- CostKind);
+ NewCost += TTI.getShuffleCost(TTI::SK_PermuteSingleSrc, Ty, MinVecTy,
+ CostKind, Mask);
// We can aggressively convert to the vector form because the backend can
// invert this transform if it does not result in a performance win.
@@ -568,11 +568,11 @@ bool VectorCombine::isExtractExtractCheap(ExtractElementInst *Ext0,
PoisonMaskElem);
ShuffleMask[BestInsIndex] = BestExtIndex;
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
- VecTy, VecTy, ShuffleMask, CostKind, 0,
+ VecTy, VecTy, CostKind, ShuffleMask, 0,
nullptr, {ConvertToShuffle});
} else {
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
- VecTy, VecTy, {}, CostKind, 0, nullptr,
+ VecTy, VecTy, CostKind, {}, 0, nullptr,
{ConvertToShuffle});
}
}
@@ -778,7 +778,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
InstructionCost NewCost =
TTI.getArithmeticInstrCost(Instruction::FNeg, SrcVecTy, CostKind) +
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, DstVecTy,
- DstVecTy, Mask, CostKind);
+ DstVecTy, CostKind, Mask);
bool NeedLenChg = SrcVecTy->getNumElements() != NumDstElts;
// If the lengths of the two vectors are not equal,
@@ -788,7 +788,7 @@ bool VectorCombine::foldInsExtFNeg(Instruction &I) {
SrcMask.assign(NumDstElts, PoisonMaskElem);
SrcMask[ExtIdx % NumDstElts] = ExtIdx;
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
- DstVecTy, SrcVecTy, SrcMask, CostKind);
+ DstVecTy, SrcVecTy, CostKind, SrcMask);
}
LLVM_DEBUG(dbgs() << "Found an insertion of (extract)fneg : " << I
@@ -1160,12 +1160,12 @@ bool VectorCombine::foldBitcastShuffle(Instruction &I) {
: TargetTransformInfo::SK_PermuteTwoSrc;
InstructionCost NewCost =
- TTI.getShuffleCost(SK, DestTy, NewShuffleTy, NewMask, CostKind) +
+ TTI.getShuffleCost(SK, DestTy, NewShuffleTy, CostKind, NewMask) +
(NumOps * TTI.getCastInstrCost(Instruction::BitCast, NewShuffleTy, SrcTy,
TargetTransformInfo::CastContextHint::None,
CostKind));
InstructionCost OldCost =
- TTI.getShuffleCost(SK, OldShuffleTy, SrcTy, Mask, CostKind) +
+ TTI.getShuffleCost(SK, OldShuffleTy, SrcTy, CostKind, Mask) +
TTI.getCastInstrCost(Instruction::BitCast, DestTy, OldShuffleTy,
TargetTransformInfo::CastContextHint::None,
CostKind);
@@ -1432,7 +1432,7 @@ bool VectorCombine::foldExtractedCmps(Instruction &I) {
SmallVector<int, 32> ShufMask(VecTy->getNumElements(), PoisonMaskElem);
ShufMask[CheapIndex] = ExpensiveIndex;
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, CmpTy,
- CmpTy, ShufMask, CostKind);
+ CmpTy, CostKind, ShufMask);
NewCost += TTI.getArithmeticInstrCost(I.getOpcode(), CmpTy, CostKind);
NewCost += TTI.getVectorInstrCost(*Ext0, CmpTy, CostKind, CheapIndex);
NewCost += Ext0->hasOneUse() ? 0 : Ext0Cost;
@@ -2301,7 +2301,7 @@ bool VectorCombine::foldConcatOfBoolMasks(Instruction &I) {
InstructionCost NewCost = 0;
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, ConcatTy,
- MaskTy, ConcatMask, CostKind);
+ MaskTy, CostKind, ConcatMask);
NewCost += TTI.getCastInstrCost(Instruction::BitCast, ConcatIntTy, ConcatTy,
TTI::CastContextHint::None, CostKind);
if (Ty != ConcatIntTy)
@@ -2406,14 +2406,14 @@ bool VectorCombine::foldPermuteOfBinops(Instruction &I) {
TTI.getArithmeticInstrCost(Opcode, BinOpTy, CostKind);
InstructionCost OldCost =
BinOpCost + TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
- ShuffleDstTy, BinOpTy, OuterMask, CostKind,
+ ShuffleDstTy, BinOpTy, CostKind, OuterMask,
0, nullptr, {BinOp}, &I);
if (!BinOp->hasOneUse())
NewCost += BinOpCost;
if (Match0) {
InstructionCost Shuf0Cost = TTI.getShuffleCost(
- TargetTransformInfo::SK_PermuteTwoSrc, BinOpTy, Op0Ty, Mask0, CostKind,
+ TargetTransformInfo::SK_PermuteTwoSrc, BinOpTy, Op0Ty, CostKind, Mask0,
0, nullptr, {Op00, Op01}, cast<Instruction>(BinOp->getOperand(0)));
OldCost += Shuf0Cost;
if (!BinOp->hasOneUse() || !BinOp->getOperand(0)->hasOneUse())
@@ -2421,7 +2421,7 @@ bool VectorCombine::foldPermuteOfBinops(Instruction &I) {
}
if (Match1) {
InstructionCost Shuf1Cost = TTI.getShuffleCost(
- TargetTransformInfo::SK_PermuteTwoSrc, BinOpTy, Op1Ty, Mask1, CostKind,
+ TargetTransformInfo::SK_PermuteTwoSrc, BinOpTy, Op1Ty, CostKind, Mask1,
0, nullptr, {Op10, Op11}, cast<Instruction>(BinOp->getOperand(1)));
OldCost += Shuf1Cost;
if (!BinOp->hasOneUse() || !BinOp->getOperand(1)->hasOneUse())
@@ -2433,11 +2433,11 @@ bool VectorCombine::foldPermuteOfBinops(Instruction &I) {
if (!IsIdentity0)
NewCost +=
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, ShuffleDstTy,
- Op0Ty, NewMask0, CostKind, 0, nullptr, {Op00, Op01});
+ Op0Ty, CostKind, NewMask0, 0, nullptr, {Op00, Op01});
if (!IsIdentity1)
NewCost +=
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, ShuffleDstTy,
- Op1Ty, NewMask1, CostKind, 0, nullptr, {Op10, Op11});
+ Op1Ty, CostKind, NewMask1, 0, nullptr, {Op10, Op11});
LLVM_DEBUG(dbgs() << "Found a shuffle feeding a shuffled binop: " << I
<< "\n OldCost: " << OldCost << " vs NewCost: " << NewCost
@@ -2540,7 +2540,7 @@ bool VectorCombine::foldShuffleOfBinops(Instruction &I) {
OldCost += RHSCost;
}
OldCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc,
- ShuffleDstTy, BinResTy, OldMask, CostKind, 0,
+ ShuffleDstTy, BinResTy, CostKind, OldMask, 0,
nullptr, {LHS, RHS}, &I);
// Handle shuffle(binop(shuffle(x),y),binop(z,shuffle(w))) style patterns
@@ -2591,10 +2591,10 @@ bool VectorCombine::foldShuffleOfBinops(Instruction &I) {
auto *ShuffleCmpTy =
FixedVectorType::get(BinOpTy->getElementType(), ShuffleDstTy);
InstructionCost NewCost = TTI.getShuffleCost(
- SK0, ShuffleCmpTy, BinOpTy, NewMask0, CostKind, 0, nullptr, {X, Z});
+ SK0, ShuffleCmpTy, BinOpTy, CostKind, NewMask0, 0, nullptr, {X, Z});
if (!SingleSrcBinOp)
- NewCost += TTI.getShuffleCost(SK1, ShuffleCmpTy, BinOpTy, NewMask1,
- CostKind, 0, nullptr, {Y, W});
+ NewCost += TTI.getShuffleCost(SK1, ShuffleCmpTy, BinOpTy, CostKind,
+ NewMask1, 0, nullptr, {Y, W});
if (PredLHS == CmpInst::BAD_ICMP_PREDICATE) {
NewCost += TTI.getArithmeticInstrCost(LHS->getOpcode(), ShuffleDstTy,
@@ -2681,15 +2681,15 @@ bool VectorCombine::foldShuffleOfSelects(Instruction &I) {
InstructionCost OldCost =
CostSel1 + CostSel2 +
- TTI.getShuffleCost(SK, DstVecTy, SrcVecTy, Mask, CostKind, 0, nullptr,
+ TTI.getShuffleCost(SK, DstVecTy, SrcVecTy, CostKind, Mask, 0, nullptr,
{I.getOperand(0), I.getOperand(1)}, &I);
InstructionCost NewCost = TTI.getShuffleCost(
SK, FixedVectorType::get(C1VecTy->getScalarType(), Mask.size()), C1VecTy,
- Mask, CostKind, 0, nullptr, {C1, C2});
- NewCost += TTI.getShuffleCost(SK, DstVecTy, SrcVecTy, Mask, CostKind, 0,
+ CostKind, Mask, 0, nullptr, {C1, C2});
+ NewCost += TTI.getShuffleCost(SK, DstVecTy, SrcVecTy, CostKind, Mask, 0,
nullptr, {T1, T2});
- NewCost += TTI.getShuffleCost(SK, DstVecTy, SrcVecTy, Mask, CostKind, 0,
+ NewCost += TTI.getShuffleCost(SK, DstVecTy, SrcVecTy, CostKind, Mask, 0,
nullptr, {F1, F2});
auto *C1C2ShuffledVecTy = FixedVectorType::get(
Type::getInt1Ty(I.getContext()), DstVecTy->getNumElements());
@@ -2808,11 +2808,11 @@ bool VectorCombine::foldShuffleOfCastops(Instruction &I) {
ShuffleKind = TargetTransformInfo::SK_PermuteSingleSrc;
InstructionCost OldCost = CostC0;
- OldCost += TTI.getShuffleCost(ShuffleKind, ShuffleDstTy, CastDstTy, OldMask,
- CostKind, 0, nullptr, {}, &I);
+ OldCost += TTI.getShuffleCost(ShuffleKind, ShuffleDstTy, CastDstTy, CostKind,
+ OldMask, 0, nullptr, {}, &I);
InstructionCost NewCost = TTI.getShuffleCost(ShuffleKind, NewShuffleDstTy,
- CastSrcTy, NewMask, CostKind);
+ CastSrcTy, CostKind, NewMask);
NewCost += TTI.getCastInstrCost(Opcode, ShuffleDstTy, NewShuffleDstTy,
TTI::CastContextHint::None, CostKind);
if (!C0->hasOneUse())
@@ -2978,7 +2978,7 @@ bool VectorCombine::foldShuffleOfShuffles(Instruction &I) {
IsUnary ? TargetTransformInfo::SK_PermuteSingleSrc
: TargetTransformInfo::SK_PermuteTwoSrc;
InstructionCost NewCost =
- TTI.getShuffleCost(SK, ShuffleDstTy, ShuffleSrcTy, NewMask, CostKind, 0,
+ TTI.getShuffleCost(SK, ShuffleDstTy, ShuffleSrcTy, CostKind, NewMask, 0,
nullptr, {NewX, NewY});
if (!OuterV0->hasOneUse())
NewCost += InnerCost0;
@@ -3137,9 +3137,9 @@ bool VectorCombine::foldShufflesOfLengthChangingShuffles(Instruction &I) {
// step.
InstructionCost LocalNewCost =
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, TrunkType,
- YType, NewYMask, CostKind) +
+ YType, CostKind, NewYMask) +
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, TrunkType,
- TrunkType, NewMask, CostKind);
+ TrunkType, CostKind, NewMask);
if (LocalNewCost >= NewCost && LocalOldCost < LocalNewCost - NewCost)
break;
@@ -3237,7 +3237,7 @@ bool VectorCombine::foldShuffleOfIntrinsics(Instruction &I) {
InstructionCost OldCost =
CostII0 + CostII1 +
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteTwoSrc, ShuffleDstTy,
- II0Ty, OldMask, CostKind, 0, nullptr, {II0, II1}, &I);
+ II0Ty, CostKind, OldMask, 0, nullptr, {II0, II1}, &I);
SmallVector<Type *> NewArgsTy;
InstructionCost NewCost = 0;
@@ -3257,8 +3257,8 @@ bool VectorCombine::foldShuffleOfIntrinsics(Instruction &I) {
continue;
}
NewCost += TTI.getShuffleCost(
- TargetTransformInfo::SK_PermuteTwoSrc, ArgTy, VecTy, OldMask,
- CostKind, 0, nullptr, {II0->getArgOperand(I), II1->getArgOperand(I)});
+ TargetTransformInfo::SK_PermuteTwoSrc, ArgTy, VecTy, CostKind,
+ OldMask, 0, nullptr, {II0->getArgOperand(I), II1->getArgOperand(I)});
}
}
IntrinsicCostAttributes NewAttr(IID, ShuffleDstTy, NewArgsTy);
@@ -3340,7 +3340,7 @@ bool VectorCombine::foldPermuteOfIntrinsic(Instruction &I) {
InstructionCost OldCost =
IntrinsicCost +
TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, ShuffleDstTy,
- IntrinsicSrcTy, Mask, CostKind, 0, nullptr, {V0}, &I);
+ IntrinsicSrcTy, CostKind, Mask, 0, nullptr, {V0}, &I);
SmallVector<Type *> NewArgsTy;
InstructionCost NewCost = 0;
@@ -3353,7 +3353,7 @@ bool VectorCombine::foldPermuteOfIntrinsic(Instruction &I) {
ShuffleDstTy->getNumElements());
NewArgsTy.push_back(ArgTy);
NewCost += TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
- ArgTy, VecTy, Mask, CostKind, 0, nullptr,
+ ArgTy, VecTy, CostKind, Mask, 0, nullptr,
{II0->getArgOperand(I)});
}
}
@@ -3439,7 +3439,7 @@ static bool isFreeConcat(ArrayRef<InstLane> Item, TTI::TargetCostKind CostKind,
std::iota(ConcatMask.begin(), ConcatMask.end(), 0);
if (TTI.getShuffleCost(TTI::SK_PermuteTwoSrc,
FixedVectorType::get(Ty->getScalarType(), NumElts * 2),
- Ty, ConcatMask, CostKind) != 0)
+ Ty, CostKind, ConcatMask) != 0)
return false;
unsigned NumSlices = Item.size() / NumElts;
@@ -3942,10 +3942,10 @@ bool VectorCombine::foldShuffleFromReductions(Instruction &I) {
InstructionCost OldCost = TTI.getShuffleCost(
UsesSecondVec ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc, VecType,
- ShuffleInputType, Shuffle->getShuffleMask(), CostKind);
+ ShuffleInputType, CostKind, Shuffle->getShuffleMask());
InstructionCost NewCost = TTI.getShuffleCost(
UsesSecondVec ? TTI::SK_PermuteTwoSrc : TTI::SK_PermuteSingleSrc, VecType,
- ShuffleInputType, ConcatMask, CostKind);
+ ShuffleInputType, CostKind, ConcatMask);
LLVM_DEBUG(dbgs() << "Found a reduction feeding from a shuffle: " << *Shuffle
<< "\n");
@@ -4220,7 +4220,7 @@ bool VectorCombine::foldShuffleChainsToReduce(Instruction &I) {
auto SK = Cut->Elts.isShiftedMask(SubIdx, SubLen)
? TargetTransformInfo::SK_ExtractSubvector
: TargetTransformInfo::SK_PermuteSingleSrc;
- NewCost += TTI.getShuffleCost(SK, ReduceVecTy, SrcVT, ExtractMask, CostKind,
+ NewCost += TTI.getShuffleCost(SK, ReduceVecTy, SrcVT, CostKind, ExtractMask,
SubIdx, ReduceVecTy);
}
@@ -5447,11 +5447,11 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
return C + TTI.getShuffleCost(isa<UndefValue>(SV->getOperand(1))
? TTI::SK_PermuteSingleSrc
: TTI::SK_PermuteTwoSrc,
- VT, VT, SV->getShuffleMask(), CostKind);
+ VT, VT, CostKind, SV->getShuffleMask());
};
auto AddShuffleMaskCost = [&](InstructionCost C, ArrayRef<int> Mask) {
return C +
- TTI.getShuffleCost(TTI::SK_PermuteTwoSrc, VT, VT, Mask, CostKind);
+ TTI.getShuffleCost(TTI::SK_PermuteTwoSrc, VT, VT, CostKind, Mask);
};
unsigned ElementSize = VT->getElementType()->getPrimitiveSizeInBits();
@@ -5471,7 +5471,7 @@ bool VectorCombine::foldSelectShuffle(Instruction &I, bool FromReduction) {
auto AddShuffleMaskAdjustedCost = [&](InstructionCost C, ArrayRef<int> Mask) {
// Compute the cost for performing the shuffle over the full vector.
auto ShuffleCost =
- TTI.getShuffleCost(TTI::SK_PermuteTwoSrc, VT, VT, Mask, CostKind);
+ TTI.getShuffleCost(TTI::SK_PermuteTwoSrc, VT, VT, CostKind, Mask);
unsigned NumFullVectors = Mask.size() / MaxElementsInVector;
if (NumFullVectors < 2)
return C + ShuffleCost;
@@ -5751,7 +5751,7 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
// Ignore 'free' identity insertion shuffle.
// TODO: getShuffleCost should return TCC_Free for Identity shuffles.
if (!ShuffleVectorInst::isIdentityMask(Mask, NumSrcElts))
- NewCost += TTI.getShuffleCost(SK, DstVecTy, DstVecTy, Mask, CostKind, 0,
+ NewCost += TTI.getShuffleCost(SK, DstVecTy, DstVecTy, CostKind, Mask, 0,
nullptr, {DstVec, SrcVec});
} else {
// When creating a length-changing-vector, always try to keep the relevant
@@ -5761,8 +5761,8 @@ bool VectorCombine::foldInsExtVectorToShuffle(Instruction &I) {
ExtToVecMask[ExtIdx % NumDstElts] = ExtIdx;
// Add cost for expanding or narrowing
NewCost = TTI.getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc,
- DstVecTy, SrcVecTy, ExtToVecMask, CostKind);
- NewCost += TTI.getShuffleCost(SK, DstVecTy, DstVecTy, Mask, CostKind);
+ DstVecTy, SrcVecTy, CostKind, ExtToVecMask);
+ NewCost += TTI.getShuffleCost(SK, DstVecTy, DstVecTy, CostKind, Mask);
}
if (!Ext->hasOneUse())
@@ -6490,10 +6490,10 @@ bool VectorCombine::shrinkLoadForShuffles(Instruction &I) {
// Update costs.
OldCost +=
TTI.getShuffleCost(TTI::SK_PermuteSingleSrc, Shuffle->getType(),
- OldLoadTy, OldMask, CostKind);
+ OldLoadTy, CostKind, OldMask);
NewCost +=
TTI.getShuffleCost(TTI::SK_PermuteSingleSrc, Shuffle->getType(),
- NewLoadTy, OldMask, CostKind);
+ NewLoadTy, CostKind, OldMask);
}
LLVM_DEBUG(
@@ -6590,10 +6590,10 @@ bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
// Calculate costs for worst cases and compare.
auto const Kind = TTI::SK_PermuteSingleSrc;
auto OldCost =
- std::max(TTI.getShuffleCost(Kind, ResultVT, InputVT, Mask0, CostKind),
- TTI.getShuffleCost(Kind, ResultVT, InputVT, Mask1, CostKind));
- auto NewCost = TTI.getShuffleCost(Kind, InputVT, InputVT, NewMask, CostKind) +
- TTI.getShuffleCost(Kind, ResultVT, InputVT, Mask1, CostKind);
+ std::max(TTI.getShuffleCost(Kind, ResultVT, InputVT, CostKind, Mask0),
+ TTI.getShuffleCost(Kind, ResultVT, InputVT, CostKind, Mask1));
+ auto NewCost = TTI.getShuffleCost(Kind, InputVT, InputVT, CostKind, NewMask) +
+ TTI.getShuffleCost(Kind, ResultVT, InputVT, CostKind, Mask1);
LLVM_DEBUG(dbgs() << "Found a phi of mergeable shuffles: " << I
<< "\n OldCost: " << OldCost << " vs NewCost: " << NewCost
More information about the llvm-commits
mailing list