IT lexicon › Programming › Copy propagation

Copy propagation

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

After x = y, later uses of x are rewritten to use y, leaving the copy dead and deletable.

Humans don't write many pointless copies, but compilers churn them out. Inlining binds arguments to parameters, SSA construction leaves debris behind, and other passes replace expressions with temporaries. Copy propagation is the janitor that tidies up after all of them, which is why pipelines run it again and again in between.

Without SSA the compiler must prove that neither x nor y was overwritten along the way, which takes a data-flow analysis. In SSA form every name has exactly one definition and the job is close to trivial. Its back-end cousin is coalescing: the register allocator tries to give both sides of a copy the same register so the move instruction vanishes altogether.

← Back to the lexicon