[llvm] [LV][VPlan] Not adding shuffle cost when store loop invariant value. (PR #109644)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 04:58:42 PDT 2024


================
@@ -2253,7 +2253,9 @@ InstructionCost VPWidenMemoryRecipe::computeCost(ElementCount VF,
     Cost += Ctx.TTI.getMemoryOpCost(Ingredient.getOpcode(), Ty, Alignment, AS,
                                     CostKind, OpInfo, &Ingredient);
   }
-  if (!Reverse)
+  // If the store value is a live-in scalar value which is uniform, we don't
+  // need to calculate the reverse cost.
----------------
fhahn wrote:

At the moment, the revers will be done by to store recipe, which is why it is included here.

Could you elaborate how this fixes a difference in legacy and VPlan-based cost model?  AFAICT the patch also extends the legacy cost model to include logic to skip shuffle costs for invariant store operands.

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


More information about the llvm-commits mailing list