[llvm] [VPlan] Introduce recipes for VP loads and stores. (PR #87816)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 08:04:16 PDT 2024


================
@@ -1203,43 +1203,48 @@ static VPActiveLaneMaskPHIRecipe *addVPLaneMaskPhiAndUpdateExitBranch(
   return LaneMaskPhi;
 }
 
-/// Replaces (ICMP_ULE, WideCanonicalIV, backedge-taken-count) pattern using
-/// the given \p Idiom.
-static void
-replaceHeaderPredicateWith(VPlan &Plan, VPValue &Idiom,
-                           function_ref<bool(VPUser &, unsigned)> Cond = {}) {
+/// Apply \p Fn to all VPInstructions matching the header mask (ICMP_ULE,
+/// WideCanonicalIV, backedge-taken-count) pattern
+static void forAllHeaderPredicates(VPlan &Plan,
+                                   function_ref<void(VPInstruction &)> Fn) {
+  SmallVector<VPValue *> WideCanonicalIVs;
   auto *FoundWidenCanonicalIVUser =
       find_if(Plan.getCanonicalIV()->users(),
----------------
fhahn wrote:

> Only a at-most one WidenCanonicalIVRecipe user expected (worth asserting?), or simply iterate over all users possibly pushing multiple candidates into the worklist, as with widen int or fp induction recipes below?

Yes, added an assert.

> Instead of a pattern matching search for header masks, introduce an abstract HeaderMask recipe, which is later (i.e., here) lowered into an ICMP_ULE, ActiveLaneMask, EVL, whatnot?

Sounds good, OK as follow-up? Added a TODO for now?

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


More information about the llvm-commits mailing list