Leveraging Large Language Models for Generalizing Peephole Optimizations
Chunhao Liao, Hongxu Xu, Xintong Zhou, Zhenyang Xu, Chengnian Sun

TL;DR
This paper introduces LPG, a framework that leverages large language models to automate and improve the generalization of peephole optimizations in compilers, achieving higher success rates than existing methods.
Contribution
LPG integrates LLMs with formal validation to effectively generalize peephole optimizations, reducing manual effort and surpassing prior automation approaches like Hydra.
Findings
LPG successfully generalizes 90 out of 102 optimizations from LLVM.
LPG outperforms Hydra, generalizing 74 out of 81 optimizations compared to 35.
The framework combines semantic abstraction with formal validation for reliable optimization generalization.
Abstract
Peephole optimizations are a core component of modern optimizing compilers. It rewrites specific instruction into semantically equivalent but more efficient forms. In practice, creating a new peephole optimization often starts from a concrete optimization instance and requires lifting it into a more general rewrite rule that matches a wider range of instruction patterns. This generalization step is critical to optimization effectiveness, but it is also difficult: producing rules that are both correct and sufficiently general typically demands substantial manual effort and domain expertise. Existing approaches such as Hydra attempt to automate this task with program synthesis, but their generalization capability is often limited by search-space explosion, under-generalization, and restricted support for diverse instruction domains. We present LPG, large language model aided peephole…
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.
Taxonomy
TopicsLogic, programming, and type systems · Parallel Computing and Optimization Techniques · Constraint Satisfaction and Optimization
