Great overview of LLVM passes, their design, and the pitfalls of phase ordering: https://llvm.org/devmtg/2014-04/PDFs/Talks/Passes.pdf