[llvm] [VPlan] Consider address computation cost in VPInterleaveRecipe. (PR #148808)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 04:57:55 PDT 2025


================
@@ -3666,6 +3666,9 @@ InstructionCost VPInterleaveRecipe::computeCost(ElementCount VF,
       InsertPos->getOpcode(), WideVecTy, IG->getFactor(), Indices,
       IG->getAlign(), AS, Ctx.CostKind, getMask(), NeedsMaskForGaps);
 
+  // Add the address computation cost.
+  Cost += Ctx.TTI.getAddressComputationCost(WideVecTy);
----------------
rj-jesus wrote:

> There is no extra address computations that needs to be done by interleave groups usually, unless there are gaps. We use the address from the first member, for which we will have a GEP recipe, which should already account for the cost of the GEP.

Shouldn't the same logic apply to scalar loads/stores then, where we seem to take the cost of the address computation (unless I'm misreading the code) https://github.com/llvm/llvm-project/blob/a2b31109458a10197e038959c1ccbcf9a84284a8/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp#L5514?

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


More information about the llvm-commits mailing list