[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:23 PDT 2024


================
@@ -10336,6 +10335,19 @@ bool LoopVectorizePass::processLoop(Loop *L) {
     } else {
       // If we decided that it is *legal* to vectorize the loop, then do it.
 
+      ElementCount Width = VF.Width;
+      std::optional<VPlan *> VPlanFromVPCost;
+      if (!UseLegacyCostModel) {
+        const auto &[VPWidth, Plan] = LVP.getBestPlan();
+        LLVM_DEBUG(dbgs() << "VF picked by VPlan cost model: " << Width
+                          << "\n");
+        Width = VPWidth;
+        assert(VF.Width == Width &&
----------------
ayalz wrote:

```suggestion
        assert(VF.Width == VPWidth &&
```
A bit confusing to have both VPWidth and VF.Width, perhaps clearer to rename the former VPlanWidth. Width is expected to be equal to both.


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


More information about the llvm-commits mailing list