Skip to content

Commit

Permalink
[TTI] getCommonMaskedMemoryOpCost - add AddressSpace argument
Browse files Browse the repository at this point in the history
Still defaults to AddressSpace = 0, but will allow us to hook up getMaskedMemoryOpCost calls once we have test coverage.
  • Loading branch information
RKSimon committed Apr 5, 2024
1 parent 5419623 commit 3c3e0e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions llvm/include/llvm/CodeGen/BasicTTIImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
Align Alignment,
bool VariableMask,
bool IsGatherScatter,
TTI::TargetCostKind CostKind) {
TTI::TargetCostKind CostKind,
unsigned AddressSpace = 0) {
// We cannot scalarize scalable vectors, so return Invalid.
if (isa<ScalableVectorType>(DataTy))
return InstructionCost::getInvalid();
Expand All @@ -230,8 +231,9 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
CostKind, -1, nullptr, nullptr)
: 0;
InstructionCost LoadCost =
VF * (AddrExtractCost + getMemoryOpCost(Opcode, VT->getElementType(),
Alignment, 0, CostKind));
VF *
(AddrExtractCost + getMemoryOpCost(Opcode, VT->getElementType(),
Alignment, AddressSpace, CostKind));

// Next, compute the cost of packing the result in a vector.
InstructionCost PackingCost =
Expand Down Expand Up @@ -1369,6 +1371,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *DataTy,
Align Alignment, unsigned AddressSpace,
TTI::TargetCostKind CostKind) {
// TODO: Pass on AddressSpace when we have test coverage.
return getCommonMaskedMemoryOpCost(Opcode, DataTy, Alignment, true, false,
CostKind);
}
Expand Down

0 comments on commit 3c3e0e5

Please sign in to comment.