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

Elvis Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 07:56:37 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.
----------------
ElvisWang123 wrote:

Thanks, that is a good idea!

I will implement the computeCost for Load/Store EVL recipes and always calculate the mask cost.
This implementation can fix the difference between the legacy cost model and the vplan-based cost model.

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


More information about the llvm-commits mailing list