Compiler-ASR: Bridging the IR-to-Assembly Gap for Compiler Optimization via Architecture-Specific Reward
Open Access
- 5 July 2026
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 50-54
Abstract
Compiler pass sequence optimization using large language models has shown promise for code size reduction. However, existing methods optimize at the IR level and ignore architecture-specific effects. This creates a gap: sequences that reduce IR instruction counts may fail to improve, or even degrade, the final assembly code. We propose Compiler-ASR, a framework that introduces assembly-aware rewards into reinforcement learning training. The reward function combines IR-level and assembly-level signals, penalizing cases where IR improves but assembly regresses. We further expose assembly metrics during chain-of-thought reasoning, enabling the model to incorporate backend feedback before committing to a pass sequence. On x86-64, our method achieves 4.95% and 9.39% code size reduction over -Oz and -O2 on CompilerGym benchmarks, and 4.91% on SPEC CPU 2017.Keywords
Funding Information
- MIIT Program (ZC25T320057/98)
This publication has 13 references indexed in Scilit:
- TOWARDS AUTONOMOUS CODE OPTIMIZATION: A REINFORCEMENT LEARNING FRAMEWORK FOR COMPILER DESIGNInternational Journal of Applied Mathematics, 2025
- CuAsmRL: Optimizing GPU SASS Schedules via Deep Reinforcement Learning2025
- Using machine learning to predict the code size impact of duplication heuristics in a dynamic compiler2021
- ANGHABENCH: A Suite with One Million Compilable C Benchmarks for Code-Size Reduction2021
- FlexTensor2020
- PIR-DSP: An FPGA DSP Block Architecture for Multi-precision Deep Neural Networks2019
- OpenTuner2014
- Deconstructing iterative optimizationACM Transactions on Architecture and Code Optimization, 2012
- LLVM: A compilation framework for lifelong program analysis & transformation2004
- Optimizing for reduced code space using genetic algorithms1999