[llvm] [VPlan] Update getBestPlan to return VF, use also for epilogue vec. (PR #98821)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 06:45:25 PDT 2024


================
@@ -365,8 +365,9 @@ class LoopVectorizationPlanner {
   /// Return the best VPlan for \p VF.
   VPlan &getBestPlanFor(ElementCount VF) const;
 
-  /// Return the most profitable plan and fix its VF to the most profitable one.
-  VPlan &getBestPlan() const;
+  /// Return the most profitable vectorization factor together with the most
+  /// profitable plan containing that vectorization factor.
+  std::pair<ElementCount, VPlan &> getBestPlan() const;
----------------
ayalz wrote:

There is an underlying assumption that, at-least at this stage, there is at most a single VPlan per VF.

Perhaps it would be clearer to have `getBestVF()` complement `getPlanFor(VF)` - rather than `getBestPlan()` and `getBestPlanFor(VF)`, which is more aligned with LVP's `plan()`? This would require two calls instead of a single getBestPlan() with two return values, but getPlanFor(VF) could be a simple map retrieval.

The VPlan per scalar VF deserves perhaps to be held separately, corresponding to the original scalar loop, w/ or w/o undergoing unrolling(?)

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


More information about the llvm-commits mailing list