[llvm] [LV] Provide utility routine to find uncounted exit recipes (PR #152530)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 04:24:56 PDT 2025
================
@@ -141,3 +141,101 @@ 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 either live-ins or the address nodes for the load
+ // used as part of the uncountable exit comparison 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 operands
+ // and a loop invariant base address. This constraint may be relaxed later.
----------------
fhahn wrote:
```suggestion
// and a live-in base address. This constraint may be relaxed later.
```
https://github.com/llvm/llvm-project/pull/152530
More information about the llvm-commits
mailing list