This episode examines "Verifying Peephole Rewriting In SSA Compiler IRs," which uses the Lean proof assistant to give MLIR-style compilers a push-button workflow for proving small rewrites correct, without the cost of a fully verified compiler. It explains peephole rewrites and why SSA def-use chains let a matcher catch patterns that straight-line matching misses. It then compares the approach with Alive and Alive2, which rely on SMT solvers, and with CompCert-style end-to-end verification, which takes years of expert effort and is tied to one IR. The discussion covers MLIR dialects and regions, and why a ring-aware prover helps for domains like fully homomorphic encryption, where an algebraically trivial rewrite becomes a heroic proof at the LLVM level. It also covers refinement semantics with poison and undefined behavior. The episode adds a caveat from Csmith's results: proving local rewrites correct does not cover bugs in parsing, lowering, or pass ordering. Listeners get a clear picture of where formal compiler verification can reach into new domain-specific IRs and where it stops.
Sources:
1. Verifying Peephole Rewriting In SSA Compiler IRs — Siddharth Bhat, Alex Keizer, Chris Hughes, Andrés Goens, Tobias Grosser, 2024
http://arxiv.org/abs/2407.03685
2. Peephole Optimization — William M. McKeeman, 1965
https://scholar.google.com/scholar?q=Peephole+Optimization
3. Provably Correct Peephole Optimizations with Alive — Nuno P. Lopes, David Menendez, Santosh Nagarakatte, John Regehr, 2015
https://scholar.google.com/scholar?q=Provably+Correct+Peephole+Optimizations+with+Alive
4. Alive2: Bounded Translation Validation for LLVM — Nuno P. Lopes, Juneyoung Lee, Chung-Kil Hur, Zhengyang Liu, John Regehr, 2021
https://scholar.google.com/scholar?q=Alive2%3A+Bounded+Translation+Validation+for+LLVM
5. Verified Peephole Optimizations for CompCert — Eric Mullen, Daryl Zuniga, Zachary Tatlock, Dan Grossman, 2016
https://scholar.google.com/scholar?q=Verified+Peephole+Optimizations+for+CompCert
6. MLIR: Scaling Compiler Infrastructure for Domain Specific Computation — Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasilache, Oleksandr Zinenko, 2021
https://scholar.google.com/scholar?q=MLIR%3A+Scaling+Compiler+Infrastructure+for+Domain+Specific+Computation
7. Static Single Assignment Form and the Control Dependence Graph — Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, F. Kenneth Zadeck, 1991
https://scholar.google.com/scholar?q=Static+Single+Assignment+Form+and+the+Control+Dependence+Graph
8. Compiling Lean programs with MLIR / LEAN to MLIR (lz and lean-mlir) — Siddharth Bhat, Tobias Grosser and collaborators, 2022
https://scholar.google.com/scholar?q=Compiling+Lean+programs+with+MLIR+%2F+LEAN+to+MLIR+%28lz+and+lean-mlir%29
9. Verifying Peephole Rewriting In SSA Compiler IRs — Siddharth Bhat, Alex Keizer, Chris Hughes, Andrés Goens, Tobias Grosser, 2024
https://scholar.google.com/scholar?q=Verifying+Peephole+Rewriting+In+SSA+Compiler+IRs
10. Formal Verification of a Realistic Compiler — Xavier Leroy, 2009
https://scholar.google.com/scholar?q=Formal+Verification+of+a+Realistic+Compiler
11. Finding and Understanding Bugs in C Compilers — Xuejun Yang, Yang Chen, Eric Eide, John Regehr, 2011
https://scholar.google.com/scholar?q=Finding+and+Understanding+Bugs+in+C+Compilers
12. CakeML: A Verified Implementation of ML — Ramana Kumar, Magnus O. Myreen, Michael Norrish, Scott Owens, 2014
https://scholar.google.com/scholar?q=CakeML%3A+A+Verified+Implementation+of+ML
13. Formalizing the LLVM Intermediate Representation for Verified Program Transformations (Vellvm) — Jianzhou Zhao, Santosh Nagarakatte, Milo M. K. Martin, Steve Zdancewic, 2012
https://scholar.google.com/scholar?q=Formalizing+the+LLVM+Intermediate+Representation+for+Verified+Program+Transformations+%28Vellvm%29
14. Taming Undefined Behavior in LLVM — Juneyoung Lee, Yoonseung Kim, Youngju Song, Chung-Kil Hur, Sanjoy Das, David Majnemer, John Regehr, Nuno P. Lopes, 2017
https://scholar.google.com/scholar?q=Taming+Undefined+Behavior+in+LLVM
15. Bringing the WebAssembly Standard up to Speed with SpecTec / Mechanising and Verifying the WebAssembly Specification — Conrad Watt (and collaborators including Andreas Rossberg), 2018
https://scholar.google.com/scholar?q=Bringing+the+WebAssembly+Standard+up+to+Speed+with+SpecTec+%2F+Mechanising+and+Verifying+the+WebAssembly+Specification
16. Finding and Understanding Bugs in C Compilers (Csmith) — Xuejun Yang, Yang Chen, Eric Eide, John Regehr, 2011
https://scholar.google.com/scholar?q=Finding+and+Understanding+Bugs+in+C+Compilers+%28Csmith%29
17. Formal Verification of a Realistic Compiler (CompCert) — Xavier Leroy, 2009
https://scholar.google.com/scholar?q=Formal+Verification+of+a+Realistic+Compiler+%28CompCert%29
18. Vellvm: Formalizing the LLVM Intermediate Representation for Verified Program Transformations — Jianzhou Zhao, Santosh Nagarakatte, Milo M. K. Martin, Steve Zdancewic, 2012
https://scholar.google.com/scholar?q=Vellvm%3A+Formalizing+the+LLVM+Intermediate+Representation+for+Verified+Program+Transformations
19. Interaction Trees: Representing Recursive and Impure Programs in Coq — Li-yao Xia, Yannick Zakowski, Paul He, Chung-Kil Hur, Gregory Malecha, Benjamin C. Pierce, Steve Zdancewic, 2020
https://scholar.google.com/scholar?q=Interaction+Trees%3A+Representing+Recursive+and+Impure+Programs+in+Coq
20. Souper: A Synthesizing Superoptimizer — Raimondas Sasnauskas, Yang Chen, Peter Collingbourne, Jeroen Ketema, Gratian Lup, Jubi Taneja, John Regehr, 2017
https://scholar.google.com/scholar?q=Souper%3A+A+Synthesizing+Superoptimizer
21. TASO: Optimizing Deep Learning Computation with Automatic Generation of Graph Substitutions — Zhihao Jia, Oded Padon, James Thomas, Todd Warszawski, Matei Zaharia, Alex Aiken, 2019
https://scholar.google.com/scholar?q=TASO%3A+Optimizing+Deep+Learning+Computation+with+Automatic+Generation+of+Graph+Substitutions
22. PET: Optimizing Tensor Programs with Partially Equivalent Transformations and Automated Corrections — Haojie Wang, Jidong Zhai, Mingyu Gao, Zixuan Ma, et al., 2021
https://scholar.google.com/scholar?q=PET%3A+Optimizing+Tensor+Programs+with+Partially+Equivalent+Transformations+and+Automated+Corrections
23. egg: Fast and Extensible Equality Saturation — Max Willsey, Chandrakana Nandi, Yisu Remy Wang, Oliver Flatt, Zachary Tatlock, Pavel Panchekha, 2021
https://scholar.google.com/scholar?q=egg%3A+Fast+and+Extensible+Equality+Saturation
24. Verified Compilation of Neural Network / Tensor Programs (Alive-tv for MLIR) — Seongwon Bang, Seunghyeon Nam, Inwhan Chun, Ho Young Jhoo, Juneyoung Lee, 2022
https://scholar.google.com/scholar?q=Verified+Compilation+of+Neural+Network+%2F+Tensor+Programs+%28Alive-tv+for+MLIR%29
25. Learning to Superoptimize Programs / LLM-guided compiler optimization (e.g., Meta LLM Compiler) — Rudy Bunel et al.; Chris Cummins et al., 2016 / 2024
https://scholar.google.com/scholar?q=Learning+to+Superoptimize+Programs+%2F+LLM-guided+compiler+optimization+%28e.g.%2C+Meta+LLM+Compiler%29
Interactive Visualization: Verifying Peephole Rewrites in SSA Compiler IRs with Lean