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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 27 13:09:16 PDT 2024


================
@@ -9511,6 +9497,22 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
         });
     FinalReductionResult->insertBefore(*MiddleVPBB, IP);
 
+    VPBasicBlock *ScalarPHVPBB = nullptr;
+    if (MiddleVPBB->getNumSuccessors() == 2) {
+      // Order is strict: first is the exit block, second is the scalar
+      // preheader.
+      ScalarPHVPBB = cast<VPBasicBlock>(MiddleVPBB->getSuccessors()[1]);
+    } else {
+      ScalarPHVPBB = cast<VPBasicBlock>(MiddleVPBB->getSingleSuccessor());
+    }
----------------
fhahn wrote:

Yes, once both plans (or at least the skeletons) are included in the VPlan

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


More information about the llvm-commits mailing list