[llvm] [VPlan] Introduce VPNumProcessedElementsPHIRecipe for variable-length stepping (PR #177114)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 04:05:24 PST 2026


================
@@ -3677,28 +3678,31 @@ class VPActiveLaneMaskPHIRecipe : public VPHeaderPHIRecipe {
 };
 
 /// A recipe for generating the phi node for the current index of elements,
-/// adjusted in accordance with EVL value. It starts at the start value of the
-/// canonical induction and gets incremented by EVL in each iteration of the
-/// vector loop.
-class VPEVLBasedIVPHIRecipe : public VPHeaderPHIRecipe {
+/// It starts at the start value of the canonical induction and gets incremented
+/// by the number of elements processed in each iteration of the vector loop.
+class VPNumProcessedElementsPHIRecipe : public VPHeaderPHIRecipe {
 public:
-  VPEVLBasedIVPHIRecipe(VPValue *StartIV, DebugLoc DL)
-      : VPHeaderPHIRecipe(VPDef::VPEVLBasedIVPHISC, nullptr, StartIV, DL) {}
+  VPNumProcessedElementsPHIRecipe(VPValue *StartIV, DebugLoc DL)
+      : VPHeaderPHIRecipe(VPDef::VPNumProcessedElementsPHISC, nullptr, StartIV,
+                          DL) {}
 
-  ~VPEVLBasedIVPHIRecipe() override = default;
+  ~VPNumProcessedElementsPHIRecipe() override = default;
 
-  VPEVLBasedIVPHIRecipe *clone() override {
-    llvm_unreachable("cloning not implemented yet");
+  VPNumProcessedElementsPHIRecipe *clone() override {
+    auto *R =
+        new VPNumProcessedElementsPHIRecipe(getStartValue(), getDebugLoc());
----------------
lukel97 wrote:

Just curious, does the phi get cloned when unrolling with https://github.com/llvm/llvm-project/pull/151300?

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


More information about the llvm-commits mailing list