IT lexicon › Programming › Control-flow graph (CFG)

Control-flow graph (CFG)

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

A directed graph whose nodes are basic blocks and whose edges are the jumps that can happen between them.

Frances Allen at IBM formalized the idea in her 1970 paper "Control Flow Analysis", and it still carries nearly all optimization. Loops show up as back edges, unreachable code as nodes with no path from the entry, and an if as a node with two outgoing edges that meet again further down. In 2006 Allen became the first woman to receive the Turing Award.

The graph is an approximation. It shows which paths are possible, not which ones are taken, so most analyses are conservative and answer "maybe" whenever the real answer depends on input. A recurring nuisance is the critical edge, running from a block with several successors to one with several predecessors. Many compilers split it with an empty block, simply to have somewhere to put code.

← Back to the lexicon