Finding Missed Code Size Optimizations in Compilers using LLMs
Not on the map. Why?
Abstract (arXiv)
Compilers are complex, and significant effort has been expended on testing them. Techniques such as random program generation and differential testing have proved highly effective and have uncovered thousands of bugs in production compilers. The majority of effort has been expended on validating that a compiler produces correct code for a given input, while less attention has been paid to ensuring that the compiler produces performant code. In this work we adapt differential testing to the task of identifying missed optimization opportunities in compilers. We develop a novel testing approach which combines large language models (LLMs) with a series of differential testing strategies and use them to find missing code size optimizations in C / C++ compilers. The advantage of our approach is its simplicity. We offload the complex task of generating random code to an off-the-shelf LLM, and use heuristics and analyses to identify anomalous compiler behavior. Our approach requires fewer than 150 lines of code to implement. This simplicity makes it extensible. By simply changing the target compiler and initial LLM prompt we port the approach from C / C++ to Rust and Swift, finding bugs in both. To date we have reported 24 confirmed bugs in production compilers, and conclude that LLM-assisted testing is a promising avenue for detecting optimization bugs in real world compilers.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 4 of its 21 references that are in the map. First posted on arXiv 31 Dec 2024.
Builds on
4 of 21 references.
References · 4
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2023Fuzz4All: Universal Fuzzing with Large Language Modelscited by 88
- 2017Learn&Fuzz: Machine Learning for Input Fuzzingcited by 23
- 2018Compiler Testing: A Systematic Literature Analysiscited by 1
Built on by
Citing papers per year: 2025: 4; 2026: 1.
5 papers.
- 2025AlgoTune: Can Language Models Speed Up General-Purpose Numerical Programs?cited by 24
- 2025Mutation-Guided LLM-based Test Generation at Metacited by 23
- 2025Compiler-R1: Towards Agentic Compiler Auto-tuning with Reinforcement Learningcited by 7
- 2025LLM Program Optimization via Retrieval Augmented Searchcited by 4
- 2026Can Coding Agents Implement Missed Compiler Optimizations? Evaluating LLM Agents on LLVM Peephole Optimizationscited by 0
- 2026Can Coding Agents Implement Missed Compiler Optimizations? Evaluating LLM Agents on LLVM Peephole Optimizations2 Jul 2026
- 2025AlgoTune: Can Language Models Speed Up General-Purpose Numerical Programs?19 Jul 2025
- 2025Compiler-R1: Towards Agentic Compiler Auto-tuning with Reinforcement Learning30 May 2025
- 2025LLM Program Optimization via Retrieval Augmented Search31 Jan 2025
- 2025Mutation-Guided LLM-based Test Generation at Meta22 Jan 2025