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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 06:02:22 PDT 2025


================
@@ -598,15 +597,13 @@ Value *VPInstruction::generate(VPTransformState &State) {
     Value *Cond = Builder.CreateICmpEQ(IV, TC);
 
     // Now create the branch.
-    auto *Plan = getParent()->getPlan();
-    VPRegionBlock *TopRegion = Plan->getVectorLoopRegion();
-    VPBasicBlock *Header = TopRegion->getEntry()->getEntryBasicBlock();
+    VPBasicBlock *Header = cast<VPBasicBlock>(getParent()->getSuccessors()[1]);
 
     // Replace the temporary unreachable terminator with a new conditional
-    // branch, hooking it up to backward destination (the header) now and to the
-    // forward destination (the exit/middle block) later when it is created.
-    // Note that CreateCondBr expects a valid BB as first argument, so we need
-    // to set it to nullptr later.
+    // branch, hooking it up to backward destination (the header) for latch
+    // blocks now, and to forward destination (the exit/middle block) later when
+    // it is created. Note that CreateCondBr expects a valid BB as first
+    // argument, so we need to set it to nullptr later.
----------------
fhahn wrote:

Should be adjusted in the unified version, thanks

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


More information about the llvm-commits mailing list