[llvm] [LV] Vectorize early exit loops with multiple exits. (PR #174864)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 12 01:20:37 PST 2026


================
@@ -903,33 +903,27 @@ void VPlanTransforms::handleEarlyExits(VPlan &Plan,
   auto *LatchVPBB = cast<VPBasicBlock>(MiddleVPBB->getSinglePredecessor());
   VPBlockBase *HeaderVPB = cast<VPBasicBlock>(LatchVPBB->getSuccessors()[1]);
 
-  // Disconnect all early exits from the loop leaving it with a single exit from
-  // the latch. Early exits that are countable are left for a scalar epilog. The
-  // condition of uncountable early exits (currently at most one is supported)
-  // is fused into the latch exit, and used to branch from middle block to the
-  // early exit destination.
-  [[maybe_unused]] bool HandledUncountableEarlyExit = false;
+  if (HasUncountableEarlyExit) {
----------------
lukel97 wrote:

Nit, we should probably just split handleEarlyExits into handleUncountableEarlyExits and handleCountableEarlyExits so we don't need to pass in the bool?

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


More information about the llvm-commits mailing list