[llvm] [LV] Transform to handle exits in the scalar loop (PR #148626)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 01:57:39 PST 2025


================
@@ -561,6 +561,9 @@ void VPlanTransforms::handleEarlyExits(VPlan &Plan,
         handleUncountableEarlyExit(cast<VPBasicBlock>(Pred), EB, Plan,
                                    cast<VPBasicBlock>(HeaderVPB), LatchVPBB);
         HandledUncountableEarlyExit = true;
+        if (Plan.shouldEarlyExitContinueInScalarLoop())
+          for (VPRecipeBase &R : EB->phis())
+            cast<VPIRPhi>(&R)->removeIncomingValueFor(Pred);
----------------
gbossu wrote:

I'd favour that as well, it makes it a bit clearer which phis need to be fixed.

Out of curiosity: we always "disconnect" the exit block, but only conditionally disconnect its phis. Why is that?

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


More information about the llvm-commits mailing list