[PATCH] D154644: [LV] Split off code to create initial VPlan (NFC).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 12:27:22 PDT 2023


fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: artagnon, StephenFan, tschuett, psnobl, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: wangpc, vkmr.
Herald added a project: LLVM.

Split up tryToBuildVPlanWithVPRecipes into intial plan creation and
optimizations.

Depends on D154640 <https://reviews.llvm.org/D154640>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154644

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp


Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8888,7 +8888,7 @@
   }
 }
 
-std::optional<VPlanPtr> LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
+VPlanPtr LoopVectorizationPlanner::buildInitialVPlanWithVPRecipes(
     VFRange &Range, SmallPtrSetImpl<Instruction *> &DeadInstructions) {
 
   SmallPtrSet<const InterleaveGroup<Instruction> *, 1> InterleaveGroups;
@@ -9112,7 +9112,16 @@
   for (ElementCount VF : Range)
     Plan->addVF(VF);
   Plan->setName("Initial VPlan");
+  return Plan;
+}
+
+std::optional<VPlanPtr> LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
+    VFRange &Range, SmallPtrSetImpl<Instruction *> &DeadInstructions) {
 
+  VPlanPtr Plan = buildInitialVPlanWithVPRecipes(Range, DeadInstructions);
+
+  // Now optimize the initial VPlan.
+  //
   // Replace VPValues for known constant strides guaranteed by predicate scalar
   // evolution.
   for (auto [_, Stride] : Legal->getLAI()->getSymbolicStrides()) {
Index: llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -380,6 +380,9 @@
   std::optional<VPlanPtr> tryToBuildVPlanWithVPRecipes(
       VFRange &Range, SmallPtrSetImpl<Instruction *> &DeadInstructions);
 
+  VPlanPtr buildInitialVPlanWithVPRecipes(
+      VFRange &Range, SmallPtrSetImpl<Instruction *> &DeadInstructions);
+
   /// Build VPlans for power-of-2 VF's between \p MinVF and \p MaxVF inclusive,
   /// according to the information gathered by Legal when it checked if it is
   /// legal to vectorize the loop. This method creates VPlans using VPRecipes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154644.537832.patch
Type: text/x-patch
Size: 1902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230706/7ef23be6/attachment.bin>


More information about the llvm-commits mailing list