[llvm] [VPlan] Model FOR extract of exit value in VPlan. (PR #93395)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 14:16:30 PDT 2024


================
@@ -558,6 +560,27 @@ Value *VPInstruction::generatePerPart(VPTransformState &State, unsigned Part) {
 
     return ReducedPartRdx;
   }
+  case VPInstruction::ExtractRecurrenceResult: {
+    if (Part != 0)
+      return State.get(this, 0, /*IsScalar*/ true);
+
+    // Extract the second last element in the middle block for users outside the
+    // loop.
+    Value *Res;
+    if (State.VF.isVector()) {
+      Res = State.get(
+          getOperand(0),
+          VPIteration(State.UF - 1, VPLane::getLastLaneForVF(State.VF, 2)));
----------------
ayalz wrote:

Operator- would naturally return an ElementCount. Perhaps operator[] e.g., VF[0], VF[-1], VF[-2] to obtain first, last and penultimate VPlanes, respectively (and possibly VF[1] for 2nd if useful), although admittedly first is computes regardless of VF.

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


More information about the llvm-commits mailing list