[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)
----------------
ayalz wrote:

There should be a better way to detect if the epilog loop is now the one being vectorized, than checking if ExpandedSCEVs isn't null.
```suggestion
  if (ExpandedSCEVs) {
    assert(IsEpilogueVectorization && "SCEVs expanded expected only when vectorizing the epilog loop");
```


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


More information about the llvm-commits mailing list