[llvm] 3c3e0e5 - [TTI] getCommonMaskedMemoryOpCost - add AddressSpace argument

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 07:07:52 PDT 2024


Author: Simon Pilgrim
Date: 2024-04-05T15:04:13+01:00
New Revision: 3c3e0e556fd768897d003fffa9e2308de982d4ae

URL: https://github.com/llvm/llvm-project/commit/3c3e0e556fd768897d003fffa9e2308de982d4ae
DIFF: https://github.com/llvm/llvm-project/commit/3c3e0e556fd768897d003fffa9e2308de982d4ae.diff

LOG: [TTI] getCommonMaskedMemoryOpCost - add AddressSpace argument

Still defaults to AddressSpace = 0, but will allow us to hook up getMaskedMemoryOpCost calls once we have test coverage.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/BasicTTIImpl.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 241529e22538a7..42d8f74fd427fb 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -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();
@@ -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 =
@@ -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);
   }


        


More information about the llvm-commits mailing list