Souper
More info
- Creator
- John Regehr et al. (Google, University of Utah)
- Type
- Superoptimizer
- Source
- github.com/google/souper
A superoptimizer for LLVM's intermediate representation that hunts for simplifications the compiler misses and proves them with an SMT solver.
Souper carves small fragments out of LLVM IR — chains of integer operations ending in a single value — and asks an SMT solver whether a cheaper expression always produces the same result. Sometimes the answer is a constant, sometimes a shorter instruction sequence. The project was written up in Souper: A Synthesizing Superoptimizer in 2017, with John Regehr of the University of Utah and engineers from Google among the authors.
The code Souper finds rarely goes straight into a production compiler. Its value is in the findings: lists of patterns InstCombine ought to recognise, which LLVM developers then wrote in by hand. Peephole optimization, in other words, with a machine asking the questions and a human deciding which answers are worth keeping.