[llvm] [VPlan] Add transform to fold early-exit branches into loops (PR #148404)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 13 23:43:46 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:
Do you have any performance data you could share? I think it would be preferable to not require an option for that, we should do it if profitable.
>From the description
> This enables optimization opportunities on CPUs with advanced branch prediction by creating simpler, more predictable branch patterns.
This seems slightly counter-intuitive to me, wouldn't more advanced branch predictors be better able to handle slightly more complex branching patterns than less advanced ones?
https://github.com/llvm/llvm-project/pull/148404
More information about the llvm-commits
mailing list