Modern compilers optimize programs through a sequence of modular passes over intermediate representations (IR). While this pass-by-pass paradigm offers engineering benefits, it suffers from a pass coordination problem: locally beneficial transformations may block more profitable optimizations in later stages. This limitation stems from the lack of an explicit notion of optimization intent, defined as a holistic strategy for coordinating multiple transformations toward a global performance objective. Recent LLM-based approaches formulate IR optimization as an end-to-end generation task, thereby avoiding the traditional pass-by-pass structure. However, optimization intent remains implicit in these methods, forcing models to jointly infer optimization strategy and generate low-level transformations, which limits both correctness and performance. We propose IntOpt, the first intent-driven IR optimizer that explicitly separates high-level optimization intent from low-level analysis and transformation. IntOpt organizes IR optimization into three stages: intent formulation, intent refinement, and intent realization, enabling globally coordinated transformations. Experiments show that IntOpt achieves 90.5% verified correctness and 2.660x average speedup on 200-program test set, outperforming state-of-the-art LLM-based optimizers in both correctness and performance, and surpassing modern compiler with the -O3 option on 37 benchmarks with speedups of up to 272.60x.
Figures & tables
Figure 1: Comparison between existing IR optimization approaches and our IntOpt .
Figure 2: Overview of IntOpt .
Method
Correctness
Performance
Alive2
Alive2+Diff. Test.
Avg. Speedup
Speedup >1.1×
Speedup >1.5×
Speedup >2.0×
GPT-5
73.0% (146)
83.5% (167)
1.057 ×
26.0% (52)
10.5% (21)
6.5% (13)
Claude Haiku 4.5
54.0% (108)
61.0% (122)
0.721 ×
15.5% (31)
5.0% (10)
2.5% (5)
DeepSeek-V3.2
51.0% (102)
59.0% (118)
0.719 ×
14.5% (29)
6.5% (13)
3.5% (7)
LLM Compiler FTD 7B
57.0% (114)
60.5% (121)
0.702 ×
13.0% (26)
6.0% (12)
2.5% (5)
LLM Compiler FTD 13B
61.5% (123)
64.5% (129)
0.757 ×
12.0% (24)
4.0% (8)
2.5% (5)
Table 1: Comparison of correctness and performance of six LLM-based IR optimization methods. Correctness is evaluated using Alive2 combined with differential testing, while performance is measured as speedup over the input unoptimized IR.
Figure 3: Per-program speedup comparison between IntOpt and representative end-to-end LLM-based IR optimizers. Speedup differences within ± 2% are considered equal to account for runtime variability.
Figure 4: Performance comparison between IntOpt and LLVM -O3 . Speedup is defined as RunTime(LLVM -O3)/RunTime(opt) , with [0.98,1.02] treated as equal. IntOpt matches LLVM -O3 on 105 programs and outperforms it on 37 (max 272.60× ); among 58 underperforming cases, most are slight slowdowns (27 in [0.90,0.98] ), and 19 are incorrect.
Figure 5: Case study illustrating how IntOpt explores optimization opportunities beyond the traditional pass-by-pass compiler paradigm.
Method
Correctness
Performance
Alive2
Alive2+Diff. Test.
Avg. Speedup
Speedup >1.1×
Speedup >1.5×
Speedup >2.0×
IntOpt
71.0% (142)
90.5% (181)
2.660 ×
37.5% (75)
17.5% (35)
10.0% (20)
w/o Intent Refinement
71.5% (143)
87.0% (174)
1.122 ×
30.0% (60)
15.0% (30)
7.5% (15)
w/o Analysis
65.0% (130)
77.0% (154)
2.415 ×
29.0% (58)
13.0% (26)
6.5% (13)
Table 2: Ablation study of IntOpt ’s design. Impact of intent refinement and compiler analysis on correctness and performance, where performance is measured as speedup over the input unoptimized IR.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Total Token
Average Token
Median Token
Min Token
Max Token
INTtrain
Unoptimized IR
8,219,999
2,055.0
2,047.0
579
4,304
Optimized IR
5,531,194
1,382.8
1,370.5
359
3,373
Optimization Intent
3,753,392
938.6
933.0
331
1,719
INTval
Unoptimized IR
1,017,905
2,035.8
2016.0
685
4,035
Optimized IR
691,180
1,382.4
1,359.5
425
3,220
Optimization Intent
473,842
947.7
941.5
321
1,692
Appendix
Table 3: Data statistics about the number and token of INTtrain , INTval , and INTtest .
GCC and LLVM underpin much of modern software infrastructure, relying on distinct Intermediate Representations (IRs) to drive optimizations and code generation. However, the semantic and structural differences between these IRs create significant barriers for cross-toolchain interaction, limiting the reuse of compiler frontends, backends, and optimization pipelines across programming languages and compilation ecosystems. Traditional rule-based translators have attempted to bridge this gap, but their complexity and maintenance cost have hindered practical adoption. In this context, Large Language Models (LLMs) appear to be an emerging technology that offers a data-driven alternative, capable of learning complex mappings between heterogeneous compiler IRs directly from sufficiently representative examples. To explore this approach, this paper presents IRIS-14B, a 14-billion-parameter transformer model fine-tuned to translate GIMPLE (as emitted by GCC) to LLVM IR (as emitted by LLVM). The model is trained on paired IRs extracted from C sources and evaluated on the GIMPLE-to-LLVM IR transformation applied to IRs derived from real-world C code and competitive programming problems. To the best of our knowledge, IRIS-14B is the first model trained explicitly for IR-to-IR translation. It outperforms the accuracy of widely used models, including the largest state-of-the-art open models available today, ranging from 13 to 1,000 billion parameters, by up to 44 percentage points. The proposed transformation supports the integration of LLMs as complementary components within hybrid neuro-symbolic compiler architectures, where models such as IRIS-14B act as interoperability layers enabling cross-toolchain workflows without modifying existing compiler passes, while traditional compiler infrastructure continues to perform deterministic compilation and optimization.
Andrea Valenzuela Ramirez, Cristian Gutierrez-Gomez, Marta Barroso +2
Barcelona Supercomputing Center, Universitat Politècnica de Catalunya · Barcelona Supercomputing Center
Recent advances in Large Language Models (LLMs) have opened opportunities to apply high-level code transformations to the field of code optimization, and it has since emerged as one of the most fundamental tasks for LLMs to perform; however, at present, LLMs struggle to apply wide-ranging code optimization tasks due to both the complexity of the code and the inability to independently verify the correctness of the transformations. In this paper, we present the Trusted LLM (T-LLM) Compiler, which proposes an advancement in compiler technology through a collaborative effort involving high-level LLM code transformations, traditional compilers, and verification tools. Experimental results reveal that it can significantly improve code correctness when tested on a set of PolyBench/C benchmarks. Our approach facilitates iterative code optimization efforts with verification strategies that enable corrective actions. Through this approach, T-LLM Compiler achieves code optimization accuracy of up to 83.3% and a speedup of up to 16.1% on the PolyBench/C benchmarks, with the transformed code reaching an average of 26.7% speedup wrt standard baselines. Additionally, we release the project's source code to the open-source community.
Zahra Fazel, Sunanda Gamage, Shayan Shirahmad Gale Bagi +5
Existing evaluations of LLM-based code optimization primarily measure end-to-end speedup, obscuring whether a model actually performs the intended optimization. For compiled languages, this is especially problematic: observed gains may reflect transformations already recoverable by modern optimizing compilers rather than optimization behavior attributable to the model itself. We present PatternBench, a benchmark for studying compiler-transcendent optimization, i.e., performance improvements that remain after aggressive compiler optimization. PatternBench targets residual optimization opportunities across seven classes of transformations and pairs runtime evaluation with an AST-based optimization faithfulness analysis that verifies whether the intended optimization is realized in the generated program. Experiments with frontier, open-weight, and fine-tuned models show that runtime speedup alone provides an incomplete account of optimization capability. Optimization faithfulness is strongly associated with realized speedup, and fine-tuning improves both faithfulness and optimization effectiveness. These results suggest that evaluation of LLM-based code optimization should measure not only performance outcomes, but also whether the target transformation was successfully executed.
Wesley Lu, Runzhou Liu, Hongru Du +1
Georgia Institute of Technology · University of Virginia