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

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 24 13:35:08 PST 2023


================
@@ -404,6 +405,138 @@ Value *VPInstruction::generateInstruction(VPTransformState &State,
     Builder.GetInsertBlock()->getTerminator()->eraseFromParent();
     return CondBr;
   }
+  case VPInstruction::ComputeReductionResult: {
+    if (Part != 0)
+      return State.get(
+          this, VPIteration(State.UF - 1, VPLane::getLastLaneForVF(State.VF)));
----------------
ayalz wrote:

 VPLiveOut::fixPhi() indeed looks for the last Part, but it does check if to look for the first or last Lane, according to `vputils::isUniformAfterVectorization(ExitValue)`?

It's somewhat confusing to set a value for the last Part, when operating upon the first Part. Perhaps more consistent for now to store a value for all parts, as do, e.g., VPExpandSCEVRecipe::execute() and VPCanonicalIVPHIRecipe::execute()?

BTW, VPFirstOrderRecurrencePHIRecipe::execute() sets only the first Part, perhaps it should do so under an if Part == 0? (Same for VPWidenPHIRecipe::execute(), but that applies only to native, i.e., to UF=1)

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


More information about the llvm-commits mailing list