Live range (source code)

= Live range

A <live range> is the portion of a program during which a computed value must remain available for a possible future use. It connects a definition with uses reached before that value is replaced. The concept concerns a particular value's lifetime, which need not occupy the whole textual scope of its source <program variable>.<The LLVM Target-Independent Code Generator>[Live Intervals and Live Variable Analysis]{ref}

In `a = read(); b = a + 1; return b;`, the value assigned to `a` must survive until the addition reads it. After that read it can be discarded, while `b` must survive until the return. <Register allocation> can reuse storage for values whose <live ranges> do not overlap. Branches and loops can make a <live range> span several regions of a <control-flow graph>, rather than one uninterrupted interval of source lines.