IT lexicon › Programming › Lengauer–Tarjan algorithm

Lengauer–Tarjan algorithm

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

The near-linear algorithm for computing dominators in a control-flow graph, and the compiler standard for four decades.

Thomas Lengauer and Robert Tarjan published it in 1979. It numbers the blocks in depth-first order, then computes each block's semidominator, an approximation that can be worked out locally. The real dominators fall out of the semidominators in a second pass. The simple version runs in O(m log n); the sophisticated one, with balanced link-eval trees, reaches O(m·α(m, n)), where α is the inverse Ackermann function and a constant for all practical purposes.

The sophisticated variant was rarely worth the bother. Cooper, Harvey and Kennedy showed in 2001 that a plain iterative method keeps up on real programs, and LLVM switched in 2017 to Semi-NCA, a relative that is easier to update incrementally when the graph changes. GCC still computes its dominators with Lengauer–Tarjan.

← Back to the lexicon