IT lexicon › Programming › Data-flow analysis

Data-flow analysis

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

The framework a compiler uses to work out what is provably true at each point in a program before it dares to change anything.

The questions look like this: which assignments can reach this line, which variables will be read again later, which expressions have already been computed? Answers are computed over the control-flow graph. Each basic block gets a transfer function, facts flow forwards or backwards along the edges, and where paths meet they are merged — as a union if something may hold, as an intersection if it must. Iterate until nothing changes.

Frances Allen and John Cocke at IBM laid the groundwork around 1970, and in 1973 Gary Kildall — later the man behind CP/M — gave it the lattice-based formulation that guarantees the iteration terminates. Liveness analysis, constant propagation and PRE are all instances. One algorithm solving all of them is a large part of why optimizing compilers are writable at all.

← Back to the lexicon