Finding Missed Code Size Optimizations in Compilers using Large Language Models
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 \emph{correct} code for a given input, while less attention has been paid to ensuring that the compiler produces \emph{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 used 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 uncovered and reported 24 bugs in production compilers, and conclude that LLM-assisted testing is a promising avenue for detecting optimization bugs in real world compilers.
Sat 1 MarDisplayed time zone: Pacific Time (US & Canada) change
14:00 - 15:30 | |||
14:00 30mTalk | DFA-Net: A Compiler-Specific Neural Architecture for Robust Generalization in Data Flow Analyses Main Conference Alexander Brauckmann University of Edinburgh, Anderson Faustino da Silva State University of Maringá, Jeronimo Castrillon TU Dresden, Germany, Hugh Leather Meta AI Research | ||
14:30 30mTalk | Finding Missed Code Size Optimizations in Compilers using Large Language Models Main Conference | ||
15:00 30mTalk | LLM Compiler: Foundation Language Models for Compiler Optimization Main Conference Chris Cummins Meta, Volker Seeker Meta AI Research, Dejan Grubisic Meta, Baptiste Rozière Meta, Jonas Gehring Meta, Gabriel Synnaeve Meta, Hugh Leather Meta AI Research |