[llvm] [LV] Add scalar load/stores to VPReplicateRecipe::computeCost (PR #153218)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 00:24:58 PDT 2025


================
@@ -5205,6 +5205,8 @@ LoopVectorizationCostModel::getConsecutiveMemOpCost(Instruction *I,
     Cost += TTI.getMaskedMemoryOpCost(I->getOpcode(), VectorTy, Alignment, AS,
                                       CostKind);
   } else {
+    // TODO: Is this right? Operand 0 has a different meaning for loads and
+    // stores.
----------------
fhahn wrote:

It is indeed confusing and the argument isn't documented, but it looks like in RISCV TTI and X86 TTI (https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/X86/X86TargetTransformInfo.cpp#L5241) the argument is used as it is passed here: stored value for stores, address for loads. AArch64 and ARM TTIs don't use it.

So it seems it is used as expected, even though the documentation of the interface could be improved

https://github.com/llvm/llvm-project/pull/153218


More information about the llvm-commits mailing list