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.
Funding Information
  • MIIT Program (ZC25T320057/98)

This publication has 13 references indexed in Scilit: