r/Compilers • • Oct 29 '26

Could source-level formal verification enable better IR optimizations?

Recent advances in LLM-assisted proof construction seem to make formal verification increasingly practical.

This got me wondering whether the results of formal verification could also benefit compiler optimizations.

For example, a compiler frontend or a separate tool could formally verify annotated source code, then propagate verified properties, such as constraints, invariants, and preconditions, into the IR for subsequent optimization passes.

Could this enable optimization opportunities that conventional static analysis might otherwise miss?

5 Upvotes

13 comments sorted by

View all comments

2

u/rantingpug Oct 29 '26

this is basically dependent types and refinement types. I think we're highly due for a usable language with either (or both).

Shameless plug: I'm trying my best with my lang :p