As another learning resource, check out my Compiler Adventures blog series where we implement an optimizing compiler from scratch in Rust. Every episode in the series describes and implements a new optimization, like no-op elimination (ep. 1), constant propagation (ep. 2), value numbering (ep. 3), value range analysis (ep. 4, coming out in early January), etc.
https://predr.ag/blog/compiler-adventures-part1-no-op-instru...