[llvm] [VPlan] Use BlockFrequencyInfo in getPredBlockCostDivisor (PR #158690)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 25 04:49:19 PST 2025


================
@@ -105,7 +105,7 @@ loop.header:
   %gep.src = getelementptr inbounds i64, ptr %src, i64 %iv
   %l = load i64, ptr %gep.src, align 1
   %t = trunc i64 %l to i1
-  br i1 %t, label %exit.0, label %loop.latch
+  br i1 %t, label %exit.0, label %loop.latch, !prof !0
----------------
lukel97 wrote:

Oh it looks like it's because this is branching to the loop exit, and BPI scales the weight down of the exiting branch by the trip count as a heuristic, which I guess makes sense:

https://github.com/llvm/llvm-project/blob/07ad928d92eac995e8d2fc48b0aafde511e9f3a0/llvm/lib/Analysis/BranchProbabilityInfo.cpp#L895-L903

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


More information about the llvm-commits mailing list