[llvm] [VPlan] Add transform to fold early-exit branches into loops (PR #148404)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 14 01:18:38 PDT 2025


================
@@ -7242,6 +7246,10 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
   // Regions are dissolved after optimizing for VF and UF, which completely
   // removes unneeded loop regions first.
   VPlanTransforms::dissolveLoopRegions(BestVPlan);
+
+  if (FoldEarlyExitBranchIntoLoop)
----------------
fhahn wrote:

Yep, the question is whether this needs to be done in LV or may be better doing later (perhaps by the backend) where we have better target-specific information to decide what form is most profitable for the target.

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


More information about the llvm-commits mailing list