[llvm] [VPlan] Use ResumePhi to create reduction resume phis. (PR #110004)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 03:07:46 PDT 2024


================
@@ -7645,11 +7627,12 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
   // 2.5 Collect reduction resume values.
   auto *ExitVPBB =
       cast<VPBasicBlock>(BestVPlan.getVectorLoopRegion()->getSingleSuccessor());
-  for (VPRecipeBase &R : *ExitVPBB) {
-    createAndCollectMergePhiForReduction(
-        dyn_cast<VPInstruction>(&R), State, OrigLoop,
-        State.CFG.VPBB2IRBB[ExitVPBB], ExpandedSCEVs);
-  }
+  if (IsEpilogueVectorization && ExpandedSCEVs)
+    for (VPRecipeBase &R : *ExitVPBB) {
+      updateMergePhiForReductionForEpilogueVectorization(
+          dyn_cast<VPInstruction>(&R), State, OrigLoop,
----------------
ayalz wrote:

nit, simpler to pass R and have the caller match it, as we're unsure it's the relevant VPInstruction here anyway:
```suggestion
          R, State, OrigLoop,
```


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


More information about the llvm-commits mailing list