[llvm] [VPlan] Introduce ExitPhi VPInstruction, use to create phi for FOR. (PR #94760)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 08:15:04 PDT 2024


================
@@ -593,13 +601,35 @@ Value *VPInstruction::generatePerPart(VPTransformState &State, unsigned Part) {
     Value *Addend = State.get(getOperand(1), Part, /* IsScalar */ true);
     return Builder.CreatePtrAdd(Ptr, Addend, Name);
   }
+  case VPInstruction::ResumePhi: {
+    if (Part != 0)
+      return State.get(this, 0, /*IsScalar*/ true);
+    Value *IncomingFromVPlanPred =
+        State.get(getOperand(0), Part, /* IsScalar */ true);
+    Value *IncomingFromOtherPreds =
+        State.get(getOperand(1), Part, /* IsScalar */ true);
----------------
fhahn wrote:

Yes that should be possible, but it should be handled correctly (generating a phi with a single incoming value from the VPlan predecessor)

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


More information about the llvm-commits mailing list