[llvm] 273f736 - [RISCV] Add FIXME comment about expensive vector mem op costs

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 08:46:35 PDT 2023


Author: Luke Lau
Date: 2023-04-04T16:45:54+01:00
New Revision: 273f736fccb3a57db56f8b6b48c52afda328d862

URL: https://github.com/llvm/llvm-project/commit/273f736fccb3a57db56f8b6b48c52afda328d862
DIFF: https://github.com/llvm/llvm-project/commit/273f736fccb3a57db56f8b6b48c52afda328d862.diff

LOG: [RISCV] Add FIXME comment about expensive vector mem op costs

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index e90d5d8f873e..0196a0b9c3bb 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -436,7 +436,7 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
       getMemoryOpCost(Opcode, VecTy, Alignment, AddressSpace, CostKind);
   unsigned VF = FVTy->getNumElements() / Factor;
 
-  // Then interleaved memory access pass with lower interleaved memory ops (i.e
+  // The interleaved memory access pass will lower interleaved memory ops (i.e
   // a load and store followed by a specific shuffle) to vlseg/vsseg
   // intrinsics. In those cases then we can treat it as if it's just one (legal)
   // memory op
@@ -447,6 +447,10 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
     if (LT.second.isFixedLengthVector()) {
       auto *LegalFVTy = FixedVectorType::get(FVTy->getElementType(),
                                              LT.second.getVectorNumElements());
+      // FIXME: We use the memory op cost of the *legalized* type here, becuase
+      // it's getMemoryOpCost returns a really expensive cost for types like
+      // <6 x i8>, which show up when doing interleaves of Factor=3 etc.
+      // Should the memory op cost of these be cheaper?
       if (TLI->isLegalInterleavedAccessType(LegalFVTy, Factor, DL)) {
         InstructionCost LegalMemCost = getMemoryOpCost(
             Opcode, LegalFVTy, Alignment, AddressSpace, CostKind);


        


More information about the llvm-commits mailing list