Compiler code optimizations help improve the performance of generated machine code in three ways:
1) Local optimizations improve individual basic blocks without considering control or data flow between blocks. This includes constant folding, propagation, and dead code elimination.
2) Global optimizations analyze control and data flow across basic blocks through techniques like common subexpression elimination.
3) Peephole optimizations make small, machine-specific improvements by examining one or two instructions at a time, such as replacing redundant loads and stores or using architectural idioms.