[PATCH] D142885: [VPlan] Allow building a VPlan to may fail.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 3 00:54:24 PST 2023


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h:352
   /// Build a VPlan using VPRecipes according to the information gather by
   /// Legal. This method is only used for the legacy inner loop vectorizer.
+  std::optional<VPlanPtr>
----------------
Ayal wrote:
> Ayal wrote:
> > What can be said about Range.End if this returns empty handed? As explained above, Range.End is possibly decreased according to the relevant VF's if this returns a VPlanPtr.
> Range.End must be greater than Range.Start in order to make forward progress even if a VPlan cannot be built for Range.Start. Suffice to say that if a VPlan cannot be built for Range.Start then Range.End must be set such that a VPlan cannot be built for any VF between Range.Start (inclusive) and Range.End (exclusive), where Range.End must be greater than Range.Start?
I updated the comment to try to make things clearer. If no VPlan can be built for a given range, the largest VF included in Range will be set to the maximum VF for which no plan could be built. 


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7530
       buildVPlansWithVPRecipes(UserVF, UserVF);
       LLVM_DEBUG(printPlans(dbgs()));
+      if (!hasPlanWithVF(UserVF))
----------------
Ayal wrote:
> Ayal wrote:
> > Worth printing/reporting something if no plan was built?
> Above LLVM_DEBUG() probably prints nothing and no report is issued for ignoring UserVF if no plan was built?
Updated to print if no plan could be built.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7563
 
   LLVM_DEBUG(printPlans(dbgs()));
   if (!MaxFactors.hasVector())
----------------
Ayal wrote:
> ditto?
Thanks, added a debug print below.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142885/new/

https://reviews.llvm.org/D142885



More information about the llvm-commits mailing list