🤖 AI Summary
This work addresses the challenge of missed optimization opportunities in compilers, where existing agent-generated patches often exhibit limited generalization and misalignment with developer intent. The study presents the first systematic evaluation of large language model (LLM) agents in repairing missing LLVM optimizations, introducing a realistic benchmark derived from actual compiler deficiencies. To enhance patch quality, the authors propose a retrieval-augmented approach that incorporates historical compiler knowledge through distillation. Experimental results demonstrate that most agent-generated patches either overfit to narrow scenarios or overgeneralize, failing to capture nuanced optimization requirements. In contrast, integrating historical knowledge significantly improves both alignment with developer expectations and the effectiveness of generated patches on real-world LLVM IR optimizations.
📝 Abstract
Compiler missed optimizations refer to cases in which compilers failed to optimize certain code. It takes many compiler developers' efforts to implement or patch such missed optimizations. In this paper, we present a systematic study of how well agents patch compiler missed optimizations. We identify a significant challenge that patching a missed optimization requires more than just fixing the reported case, and instead requires generalizing to similar cases. We construct a benchmark of real-world LLVM missed optimization issues and compare agent-generated patches with patches from developers in terms of optimization scope. Our results show that coding agents often optimize the given examples, but many generated patches either cover only part of the developer-intended scope or partially overlap with it; in some cases, they further generalize beyond the reference patch. We further introduce historical-knowledge augmentation techniques that leverage prior LLVM optimization pull requests through retrieval and distillation, showing that they improve developer-aligned generalization and yield practical benefits when applied to real-world IR.