IT lexicon › Programming › Value range propagation (VRP)

Value range propagation (VRP)

Programming På svenska → Updated: 2026-11-05

The compiler tracks the interval each variable can fall in, and uses it to delete conditions that can only ever go one way.

Constant propagation asks whether a value is known exactly. Range analysis settles for less: after if (i < 10) it knows i is below ten on that branch, and after x & 0xff that the result fits in a byte. That's enough to drop bounds checks, overflow checks and a good number of branches the programmer added just in case.

Jason Patterson showed in 1995 that the same analysis makes for good static branch prediction. GCC got an SSA-based VRP pass in 2005, and from version 11 the new Ranger framework took over, computing ranges on demand rather than in one big sweep. LLVM's equivalent is LazyValueInfo. The analysis is never exact — it assumes the worst — but even coarse ranges go a long way.

← Back to the lexicon