[llvm] [VPlan] Dispatch to multiple exit blocks via middle blocks. (PR #112138)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 03:59:55 PDT 2024


================
@@ -7692,12 +7697,15 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
   BestVPlan.execute(&State);
 
   // 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);
+  VPBasicBlock *ExitVPBB = nullptr;
+  if (BestVPlan.getVectorLoopRegion()->getSingleSuccessor()) {
----------------
david-arm wrote:

Could rewrite this as:

```
if (auto *LoopSucc = BestVPlan.getVectorLoopRegion()->getSingleSuccessor()) {
  ExitVPBB = cast<VPBasicBlock>(LoopSucc);
  ...
```

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


More information about the llvm-commits mailing list