Peephole Optimization
Certain kinds of redundancies in generated code can be corrected by making a linear pass over the output code and transforming patterns seen within a small local area (called the peephole):
STA X
LDA X
JMP L17
L17:
However,
It is more blessed to generate good code in the first place than to generate bad code and then try to fix it.