Skip to content

Commit 8ad0f2b

Browse files
committed
Use constructor explicitly
1 parent b609779 commit 8ad0f2b

File tree

4 files changed

+34
-21
lines changed

4 files changed

+34
-21
lines changed

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,9 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
16061606
unsigned IID = Opcode == Instruction::Load ? Intrinsic::masked_gather
16071607
: Intrinsic::masked_scatter;
16081608
return thisT()->getGatherScatterOpCost(
1609-
{IID, DataTy, Ptr, VariableMask, Alignment, I}, CostKind);
1609+
MemIntrinsicCostAttributes(IID, DataTy, Ptr, VariableMask, Alignment,
1610+
I),
1611+
CostKind);
16101612
}
16111613

16121614
InstructionCost getInterleavedMemoryOpCost(
@@ -1833,8 +1835,9 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
18331835
Alignment = VPI->getPointerAlignment().valueOrOne();
18341836
bool VarMask = isa<Constant>(ICA.getArgs()[2]);
18351837
return thisT()->getGatherScatterOpCost(
1836-
{ICA.getID(), ICA.getArgTypes()[0], ICA.getArgs()[1], VarMask,
1837-
Alignment, nullptr},
1838+
MemIntrinsicCostAttributes(ICA.getID(), ICA.getArgTypes()[0],
1839+
ICA.getArgs()[1], VarMask, Alignment,
1840+
nullptr),
18381841
CostKind);
18391842
}
18401843
if (ICA.getID() == Intrinsic::vp_gather) {
@@ -1850,8 +1853,9 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
18501853
Alignment = VPI->getPointerAlignment().valueOrOne();
18511854
bool VarMask = isa<Constant>(ICA.getArgs()[1]);
18521855
return thisT()->getGatherScatterOpCost(
1853-
{ICA.getID(), ICA.getReturnType(), ICA.getArgs()[0], VarMask,
1854-
Alignment, nullptr},
1856+
MemIntrinsicCostAttributes(ICA.getID(), ICA.getReturnType(),
1857+
ICA.getArgs()[0], VarMask, Alignment,
1858+
nullptr),
18551859
CostKind);
18561860
}
18571861

@@ -1958,15 +1962,18 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
19581962
bool VarMask = !isa<Constant>(Mask);
19591963
Align Alignment = I->getParamAlign(1).valueOrOne();
19601964
return thisT()->getGatherScatterOpCost(
1961-
{IID, ICA.getArgTypes()[0], Args[1], VarMask, Alignment, I},
1965+
MemIntrinsicCostAttributes(IID, ICA.getArgTypes()[0], Args[1],
1966+
VarMask, Alignment, I),
19621967
CostKind);
19631968
}
19641969
case Intrinsic::masked_gather: {
19651970
const Value *Mask = Args[1];
19661971
bool VarMask = !isa<Constant>(Mask);
19671972
Align Alignment = I->getParamAlign(0).valueOrOne();
19681973
return thisT()->getGatherScatterOpCost(
1969-
{IID, RetTy, Args[0], VarMask, Alignment, I}, CostKind);
1974+
MemIntrinsicCostAttributes(IID, RetTy, Args[0], VarMask, Alignment,
1975+
I),
1976+
CostKind);
19701977
}
19711978
case Intrinsic::masked_compressstore: {
19721979
const Value *Data = Args[0];

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5318,7 +5318,8 @@ LoopVectorizationCostModel::getGatherScatterCost(Instruction *I,
53185318
: Intrinsic::masked_scatter;
53195319
return TTI.getAddressComputationCost(PtrTy, nullptr, nullptr, CostKind) +
53205320
TTI.getGatherScatterOpCost(
5321-
{IID, VectorTy, Ptr, Legal->isMaskRequired(I), Alignment, I},
5321+
MemIntrinsicCostAttributes(IID, VectorTy, Ptr,
5322+
Legal->isMaskRequired(I), Alignment, I),
53225323
CostKind);
53235324
}
53245325

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7189,10 +7189,11 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
71897189
ScalarGEPCost;
71907190
// The cost of masked gather.
71917191
InstructionCost MaskedGatherCost =
7192-
TTI.getGatherScatterOpCost({Intrinsic::masked_gather, VecTy,
7193-
cast<LoadInst>(VL0)->getPointerOperand(),
7194-
/*VariableMask=*/false, CommonAlignment},
7195-
CostKind) +
7192+
TTI.getGatherScatterOpCost(
7193+
MemIntrinsicCostAttributes(Intrinsic::masked_gather, VecTy,
7194+
cast<LoadInst>(VL0)->getPointerOperand(),
7195+
/*VariableMask=*/false, CommonAlignment),
7196+
CostKind) +
71967197
(ProfitableGatherPointers ? 0 : VectorGEPCost);
71977198
InstructionCost GatherCost =
71987199
getScalarizationOverhead(TTI, ScalarTy, VecTy, DemandedElts,
@@ -7315,12 +7316,13 @@ BoUpSLP::LoadsState BoUpSLP::canVectorizeLoads(
73157316
{}, CostKind);
73167317
break;
73177318
case LoadsState::ScatterVectorize:
7318-
VecLdCost +=
7319-
TTI.getGatherScatterOpCost(
7320-
{Intrinsic::masked_gather, SubVecTy, LI0->getPointerOperand(),
7321-
/*VariableMask=*/false, CommonAlignment},
7322-
CostKind) +
7323-
VectorGEPCost;
7319+
VecLdCost += TTI.getGatherScatterOpCost(
7320+
MemIntrinsicCostAttributes(
7321+
Intrinsic::masked_gather, SubVecTy,
7322+
LI0->getPointerOperand(),
7323+
/*VariableMask=*/false, CommonAlignment),
7324+
CostKind) +
7325+
VectorGEPCost;
73247326
break;
73257327
case LoadsState::Gather:
73267328
// Gathers are already calculated - ignore.
@@ -15126,8 +15128,9 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
1512615128
Align CommonAlignment =
1512715129
computeCommonAlignment<LoadInst>(UniqueValues.getArrayRef());
1512815130
VecLdCost = TTI->getGatherScatterOpCost(
15129-
{Intrinsic::masked_gather, VecTy, LI0->getPointerOperand(),
15130-
/*VariableMask=*/false, CommonAlignment},
15131+
MemIntrinsicCostAttributes(Intrinsic::masked_gather, VecTy,
15132+
LI0->getPointerOperand(),
15133+
/*VariableMask=*/false, CommonAlignment),
1513115134
CostKind);
1513215135
break;
1513315136
}

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3591,7 +3591,9 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
35913591
return Ctx.TTI.getAddressComputationCost(PtrTy, nullptr, nullptr,
35923592
Ctx.CostKind) +
35933593
Ctx.TTI.getGatherScatterOpCost(
3594-
{IID, Ty, Ptr, IsMasked, Alignment, &Ingredient}, Ctx.CostKind);
3594+
MemIntrinsicCostAttributes(IID, Ty, Ptr, IsMasked, Alignment,
3595+
&Ingredient),
3596+
Ctx.CostKind);
35953597
}
35963598

35973599
InstructionCost Cost = 0;

0 commit comments

Comments
 (0)