LPO: Discovering Missed Peephole Optimizations with Large Language Models
Zhenyang Xu, Hongxu Xu, Yongqiang Tian, Xintong Zhou, and Chengnian Sun

TL;DR
LPO leverages large language models and formal verification in a closed-loop system to discover previously missed peephole optimizations in LLVM, significantly surpassing existing tools in effectiveness.
Contribution
This paper introduces LPO, a novel framework combining LLMs and formal verification to automatically discover missed peephole optimizations in compiler code.
Findings
LPO identified 22 out of 25 known missed optimizations.
LPO found 62 new missed optimizations over eleven months.
LPO outperformed existing superoptimizers like Souper and Minotaur.
Abstract
Peephole optimization is an essential class of compiler optimizations that targets small, inefficient instruction sequences within programs. By replacing such suboptimal instructions with refined and more optimal sequences, these optimizations not only directly optimize code size and performance, but also enable more transformations in the subsequent optimization pipeline. Despite their importance, discovering new and effective peephole optimizations remains challenging due to the complexity and breadth of instruction sets. Prior approaches either lack scalability or have significant restrictions on the peephole optimizations that they can find. This paper introduces LPO, a novel automated framework to discover missed peephole optimizations. Our key insight is that, Large Language Models (LLMs) are effective at creative exploration but susceptible to hallucinations; conversely, formal…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
