[llvm] [VPlan] Introduce ComputeReductionResult VPInstruction opcode. (PR #70253)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 09:24:00 PST 2024


================
@@ -397,6 +398,84 @@ Value *VPInstruction::generateInstruction(VPTransformState &State,
     Builder.GetInsertBlock()->getTerminator()->eraseFromParent();
     return CondBr;
   }
+  case VPInstruction::ComputeReductionResult: {
+    if (Part != 0)
+      return State.get(this, 0);
+
+    // FIXME: The cross-recipe dependency on VPReductionPHIRecipe is temporary
+    // and will be removed by breaking up the recipe further.
+    auto *PhiR = cast<VPReductionPHIRecipe>(getOperand(0));
----------------
ayalz wrote:

LoopExitingDef should arguably be the only Operand of ComputeReductionResult, as it (only) truly feeds it with its values. PhiR is "used" only to access information it holds, and could potentially be retrieved as a user of LoopExitingDef(?)
This information includes: RdxDesc, Type of underlying PHINode, isOrdered, inInLoop, which could be held directly inside a ComputeReductionResult Recipe as an alternative (rather than VPInstruction).
PHINode could be set as the underlying Value of ComputeReductionResult, but doing so seems awkward.

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


More information about the llvm-commits mailing list