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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 04:03:17 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);
----------------
david-arm wrote:

I think by itself the idea of this patch seems reasonable, but it's worth pointing out that even if we make better vectorisation choices the outcome is still very fragile. That's because the address computation cost is only 1. Really, if the performance of the loop drops 50% then the cost model is also off by 50%, so it feels like something more fundamental is broken here and there is a high risk of the same regression reappearing.

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


More information about the llvm-commits mailing list