[llvm] [LV] Provide utility routine to find uncounted exit recipes (PR #152530)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 05:54:15 PDT 2025


================
@@ -141,3 +141,100 @@ VPBasicBlock *vputils::getFirstLoopHeader(VPlan &Plan, VPDominatorTree &VPDT) {
   });
   return I == DepthFirst.end() ? nullptr : cast<VPBasicBlock>(*I);
 }
+
+std::optional<VPValue *>
+vputils::getRecipesForUncountableExit(VPlan &Plan,
+                                      SmallVectorImpl<VPRecipeBase *> &Recipes,
+                                      SmallVectorImpl<VPRecipeBase *> &GEPs) {
+  using namespace llvm::VPlanPatternMatch;
+  // Given a VPlan like the following (just including the recipes contributing
+  // to loop control exiting here, not the actual work), we're looking to match
+  // the recipes contributing to the uncountable exit condition comparison
+  // (here, vp<%4>) back to the canonical induction for the vector body so that
+  // we can copy them to a preheader and rotate the address in the loop to the
+  // next vector iteration.
+  //
+  // Currently, the address of the load is restricted to a GEP with 2 terms and
----------------
huntergr-arm wrote:

Done.

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


More information about the llvm-commits mailing list