IT lexicon › Programming › Scalar evolution (SCEV)

Scalar evolution (SCEV)

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

LLVM's analysis that describes how a value changes across a loop as a recurrence, so the optimizer can reason about the loop instead of simulating it.

Where other analyses see a sequence of instructions, SCEV sees algebra. The counter of an ordinary for loop is written {0,+,1}<%loop>: start at zero, add one per iteration. An address like base + 4*i becomes {base,+,4}, and multi-step expressions nest into polynomials. The notation comes from chains of recurrences, which Olaf Bachmann, Paul Wang and Eugene Zima described in 1994 as a way to speed up evaluating functions over a range.

From this the compiler can compute a loop's trip count, decide whether two memory accesses in different iterations can overlap, and rewrite multiplications as additions. The loop vectorizer, strength reduction and unrolling all ask SCEV first. GCC has its own analysis under the same name. It is also where you see why undefined signed overflow is the compiler's friend: without it, many recurrences could not be proven at all.

← Back to the lexicon