[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 07:51:07 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:

Thanks for elaborating 

IIUC the issue is that the legacy cost model doesn't know about EVL at all, but at the VPlan level we may not need a mask due to using EVL instead.

To match the legacy behavior, wouldn't it be better to implement computeCost for the EVL memory recipes and always include the mask cost. With a TODO to make this more accurate once the legacy cost model is retired?

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


More information about the llvm-commits mailing list