[llvm] [VPlan] Replace VPRegionBlock with explicit CFG before execute (NFCI). (PR #117506)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 07:31:29 PST 2024


================
@@ -1032,51 +1047,55 @@ void VPlan::execute(VPTransformState *State) {
   for (VPBlockBase *Block : vp_depth_first_shallow(Entry))
     Block->execute(State);
 
-  VPBasicBlock *LatchVPBB = getVectorLoopRegion()->getExitingBasicBlock();
-  BasicBlock *VectorLatchBB = State->CFG.VPBB2IRBB[LatchVPBB];
-
   // Fix the latch value of canonical, reduction and first-order recurrences
   // phis in the vector loop.
-  VPBasicBlock *Header = getVectorLoopRegion()->getEntryBasicBlock();
-  for (VPRecipeBase &R : Header->phis()) {
-    // Skip phi-like recipes that generate their backedege values themselves.
-    if (isa<VPWidenPHIRecipe>(&R))
+  for (VPBasicBlock *Header :
+       VPBlockUtils::blocksOnly<VPBasicBlock>(vp_depth_first_shallow(Entry))) {
+    if (!Header->isHeader())
       continue;
+    for (VPRecipeBase &R : Header->phis()) {
+      VPBasicBlock *LatchVPBB =
+          cast<VPBasicBlock>(Header->getPredecessors()[1]);
----------------
alexey-bataev wrote:

```suggestion
      auto *LatchVPBB =
          cast<VPBasicBlock>(Header->getPredecessors()[1]);
```


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


More information about the llvm-commits mailing list