# Estimating branch probabilities

DevFeed: [Estimating branch probabilities](<https://devfeed.tech/articles/estimating-branch-probabilities-31127.md>)

Original publisher: [Read original article](<https://maskray.me/blog/estimating-branch-probabilities>)

Published: 2026-08-09T07:00:00Z

Content type: article

Language: en

Sources: [MaskRay](<https://devfeed.tech/sources/maskray.md>)

Topics: [LLVM](<https://devfeed.tech/topics/llvm.md>)

Tags: [algorithm](<https://devfeed.tech/tags/algorithm.md>), [analysis](<https://devfeed.tech/tags/analysis.md>), [functions](<https://devfeed.tech/tags/functions.md>), [graph](<https://devfeed.tech/tags/graph.md>), [llvm](<https://devfeed.tech/tags/llvm.md>), [structure](<https://devfeed.tech/tags/structure.md>)

## AI overview

This post explains how LLVM estimates branch probabilities when profile data is unavailable. It examines the heuristic that classifies control-flow blocks and successor paths using unreachable, cold, unwinding, and loop information, and presents a standalone reimplementation.

## Source excerpt

LLVM's BranchProbabilityInfo assigns every multi-successor terminator a probability distribution over its successors. This post describes the estimation used when no profile is available and reimplements it as a standalone program.