IT lexicon › Programming › Alias analysis

Alias analysis

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

The compiler's attempt to work out whether two pointers can refer to the same memory — and the answer decides whether almost any memory optimisation is allowed.

If *a and *b might be the same location, a store through a must be assumed to change what was loaded through b, and the value can't stay in a register. Answers come as may-alias, must-alias and no-alias, and the analysis has to err on the safe side. The classic algorithms are Andersen's from 1994 and Steensgaard's faster but coarser one from 1996.

This is why Fortran long outran C at numerics: the language forbids overlapping arguments, so the compiler gets to assume the best. C99 answered with restrict. Rust can mark every &mut as noalias — which exposed so many LLVM miscompilations that the feature was switched on and off several times before it stuck in 2021.

← Back to the lexicon