Peephole optimisation

Basic idea

Slide a small window over the instruction stream and replace short patterns with cheaper equivalents (e.g. mul x, 2shl x, 1; mov a, b; mov b, amov a, b). Cheap, local, and surprisingly effective at the end of the pipeline.

Key facts

Siblings