[llvm] [Analysis] Improve documentation for getMemoryOpCost (PR #156875)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 05:47:22 PDT 2025


https://github.com/david-arm created https://github.com/llvm/llvm-project/pull/156875

The operand info argument appears to refer to different things depending upon whether it's a load or a store, so I've clarified this in the documentation.

>From 273e75e466f706de60865dedd665fe3122a6156f Mon Sep 17 00:00:00 2001
From: David Sherwood <david.sherwood at arm.com>
Date: Thu, 4 Sep 2025 12:46:04 +0000
Subject: [PATCH] [Analysis] Improve documentation for getMemoryOpCost

The operand info argument appears to refer to different things
depending upon whether it's a load or a store, so I've clarified
this in the documentation.
---
 llvm/include/llvm/Analysis/TargetTransformInfo.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index af78e0c1e4799..103e5f949bcc1 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -1533,7 +1533,9 @@ class TargetTransformInfo {
       Type *EltTy, int ReplicationFactor, int VF, const APInt &DemandedDstElts,
       TTI::TargetCostKind CostKind) const;
 
-  /// \return The cost of Load and Store instructions.
+  /// \return The cost of Load and Store instructions. The operand info
+  /// \p OpdInfo should refer to the stored value for stores and the address
+  /// for loads.
   LLVM_ABI InstructionCost getMemoryOpCost(
       unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace,
       TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,



More information about the llvm-commits mailing list