[clang] [llvm] [LV] Mask off possibly aliasing vector lanes (PR #100579)

Florian Hahn via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 07:09:24 PDT 2024


================
@@ -8520,7 +8561,29 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
   // When not folding the tail, we know that the induction increment will not
   // overflow.
   bool HasNUW = Style == TailFoldingStyle::None;
-  addCanonicalIVRecipes(*Plan, Legal->getWidestInductionType(), HasNUW, DL);
+
+  VPValue *AliasMask = nullptr;
----------------
fhahn wrote:

If possible to do so in a separate transform, that would preferable IMO as now the general VPlan construction has a bunch of added complexity for something that is quite specific.

A similar approach was taken for adding various options to control tail-folding (`addActiveLaneMask`, `tryAddExplicitVectorLength`). This also has the advantage of keeping the code responsible to generate the new construct at a single place, rather than spreading it across multiple places?

Having it as a separate transform also allows to generate VPlans with different strategies (e.g. with and without this new mask) and pick the best option based on cost.

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


More information about the cfe-commits mailing list