[llvm] [LV][EVL] Support in-loop reduction using tail folding with EVL. (PR #90184)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 5 10:48:43 PDT 2024


================
@@ -2144,16 +2151,67 @@ class VPReductionRecipe : public VPSingleDefRecipe {
              VPSlotTracker &SlotTracker) const override;
 #endif
 
+  /// Return the recurrence decriptor for the in-loop reduction.
+  const RecurrenceDescriptor &getRecurrenceDescriptor() const {
+    return RdxDesc;
+  }
+  /// Return true if the in-loop reduction is ordered.
+  bool isOrdered() const { return IsOrdered; };
   /// The VPValue of the scalar Chain being accumulated.
   VPValue *getChainOp() const { return getOperand(0); }
   /// The VPValue of the vector value to be reduced.
   VPValue *getVecOp() const { return getOperand(1); }
   /// The VPValue of the condition for the block.
-  VPValue *getCondOp() const {
+  virtual VPValue *getCondOp() const {
----------------
fhahn wrote:

I don't think there's an easy way around the fact that mask is optional, similar to load/store EVL recipes.

`VPReductionRecipe::classof` likely needs a manual implementation so that isa<VPReductionRecipe>() works for VPReductionEVLRecipe (around like 2143, unfortunately GH doesn't allow commenting on unchanged lines)

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


More information about the llvm-commits mailing list