Preprint
Article

This version is not peer-reviewed.

CompileRover: Revolutionizing Virtual Machine Compiler Optimization with a Tri-Role LLM-Driven Framework

Mingqiao Mo  †,Yunlong Tan  †,Hao Zhang  *

  † These authors contributed equally to this work.

Submitted:

22 August 2026

Posted:

25 August 2026

You are already at the latest version

Abstract
Code optimization plays a crucial role in the development of virtual machine compilers, with optimization frameworks significantly enhancing the performance of generated assembly code. However, existing virtual machine compiler outputs frequently exhibit redundant computations, inefficient loop structures, and suboptimal function implementations, which collectively impair execution efficiency. To address these shortcomings, we propose CompileRover, an advanced optimization framework specifically designed for virtual machine compilers. CompileRover employs a sophisticated three-role collaboration mechanism, comprising a referee, an advisor, and an operator, effectively overcoming performance bottlenecks by leveraging comprehensive optimization algorithms and novel methodologies, including control flow analysis, code structure transformations, and dynamic execution pattern recognition. Extensive evaluations demonstrate that CompileRover consistently surpasses state-of-the-art virtual machine compilers, achieving significant improvements in execution performance across various benchmarks. Furthermore, performance analyses validate that the introduced optimizations notably reduce execution overhead, improve dataflow consistency, and robustly enhance compiler performance, showcasing CompileRover as an effective and reliable approach to optimizing virtual machine compilers.
Keywords: 

1. Introduction

Code optimization plays a fundamental role in determining the performance of virtual machine (VM) compilers, directly affecting execution speed, memory efficiency, and overall resource utilization Drinic et al. (2003); Johansson (2024); Kuipers et al. (2015); Lowry and Medlock (1969); Shethiya (2025). Traditional VM compilers primarily rely on hand-crafted rule-based optimizations, such as loop unrolling and dead code elimination, which perform well on standardized code patterns but generalize poorly to code generated by heterogeneous toolchains or non-standard compilation settings Grune et al. (2012); H. Wang et al. (2022); Wirth et al. (1996). As a result, compiler-generated code is often functionally correct yet inefficient, exhibiting redundant loop computations, unnecessary local function calls, and convoluted dataflow structures that introduce substantial runtime overhead. These limitations highlight the need for optimization frameworks that can adapt across diverse compilation environments while preserving program semantics and improving execution efficiency.
Recent efforts have explored both machine learning (ML)-based optimization and large language model (LLM)-driven code refinement. ML-based approaches, including reinforcement learning methods, learn optimization policies from large code corpora and have shown promise in improving code quality and optimization effectiveness Brouthen et al. (2024); Duan et al. (2023); Mammadli et al. (2020); Prasad et al. (2025); H.Wang et al. (2022). However, their performance is often constrained by limited coverage of diverse compilation patterns and the high computational cost of model training, reducing scalability in practical deployment. More recently, advanced LLMs, such as InCoder Fried et al. (2023), and compiler-oriented frameworks, such as CompilerDream Deng et al. (2025), have demonstrated strong capabilities for code transformation and hardware-aware optimization. Nevertheless, existing LLM-based systems remain largely monolithic and frequently struggle to preserve program semantics, maintain complex control-flow consistency, and dynamically integrate optimization knowledge throughout the compilation process. These limitations motivate a more adaptive optimization framework that combines collaborative reasoning with explicit semantic verification.
Table 1. Functional Comparison of Compiler Optimization Frameworks. Compared to existing frameworks, our CompileRover is the only one that supports all key functionalities, including RL interface, real-time profiling, and zero-shot optimization.
Table 1. Functional Comparison of Compiler Optimization Frameworks. Compared to existing frameworks, our CompileRover is the only one that supports all key functionalities, including RL interface, real-time profiling, and zero-shot optimization.
Method Compiler RL Performance Cross- Real-Time No
Optimization Interface Metrics Platform Profiling Training
Traditional CoT
LEGO-Compiler
Supercompiler
MetaLLMCompiler
MLCompilerOpt
CompilerDream
CompileRover
To address these challenges, we propose CompileRover, an end-to-end framework that integrates compiler optimization with LLMs to enhance output quality while rigorously preserving semantic integrity (Figure 1). CompileRover follows a streamlined three-phase pipeline: (i) Data Processing, where input questions, action descriptions, and source code are embedded into pre-designed cue templates via contextual prompting; (ii) Optimization Engine, where an LLM-driven tri-role system—comprising a Referee, multiple Advisors, and an Operator—collaboratively explores code transformations. Advisors, including the Semantic Consistency Advisor (SCA), Dataflow Advisor (DFA), Control Flow Advisor (CFA), and Instruction Set Architecture Advisor (ISA), independently propose optimization candidates, which are composed into paths via Monte Carlo Tree Search (MCTS) Z. Zheng et al. (2025) and evaluated using Q-learning Watkins and Dayan (1992), with rewards based on performance gains and semantic preservation. The Referee ensures correctness, while the Operator executes the final transformation. (iii) Validation System, which verifies optimized outputs using DISC analysis and AddressSanitizer Serebryany et al. (2012). Evaluations across diverse codebases—including utility libraries, audio processors, and numerical algorithms—show that CompileRover consistently reduces execution overhead by 22%–38%, improves DISC scores by 35%, and achieves a 1.8 × gain in code readability under human assessment. These improvements stem from targeted optimizations such as dataflow restructuring and hot-path extraction, demonstrating the framework’s generalizability and effectiveness. In summary, our main contributions are as follows:
  • We introduce a tri-role, LLM-driven framework where specialized agents (Referee, Advisors, Operator) collaboratively optimize compiler-generated code, ensuring both performance and semantic integrity.
  • We develop a novel semantic validation metric, DISC, which combines register analysis, control flow congruence, and instruction equivalence to rigorously verify code transformations.
  • We implement a GPU-free optimization process that uses MCTS and a lightweight Q-learning strategy to efficiently explore the solution space, making the framework accessible and adaptable to various environments.

3. Methodology

Our CompileRover framework implements a three-phase computational system for code optimization, as illustrated in Figure 1. The phases are as follows:
(i) Data Processing. The source code is ingested through textual tokenization using BPE-dropout Provilkov et al. (2019) and extracting runtime metrics, achieving faster feature extraction than ML4Compilers Appel and MacQueen (1987).
(ii) Optimization Engine. The Optimization Circle is constructed, where specialized roles (Referee, multiple Advisors, and Operator) analyze different optimization aspects with corresponding sub-tasks, initial solutions, and expertise gap indicators - the Referee performs semantic validation to ensure compliance with program specifications. The optimization engine generates candidate optimization paths through MCTS and evaluates the long-term benefits of state-action pairs in combination with a lightweight reinforcement learning strategy. The role collaboration module (referee, advisor, and operator) dynamically adjusts the optimization priority based on the Q-learning reward mechanism, reinforcement learning policy, and finally selects the globally optimal path through Monte Carlo simulation. Specialized Advisors (SCA, DFA, CFA, ISA) propose optimization strategies, and the Operator implements transformations based on collective insights, all enhanced by Q-learning reward mechanisms and Monte Carlo simulations for optimization path selection.
(iii) Validation System. Optimizations are evaluated through DISC analysis with AddressSanitizer Serebryany et al. (2012). The optimization undergoes code feature extraction, path generation, role coverification, MCTS-guided dynamic reward computation, and final semantic consistency verification, yielding robust cross-platform consistency across x86-64, ARM64, and RISC-V architectures.

3.1. Optimization Circle Process

To construct the Optimization Circle (OC), we propose a tri-role optimization template, as shown in Figure 2, which orchestrates role-specific optimizations via meta-level compilation task transformations rather than by directly modifying the source code:
O C S = ( R o l e 1 , S u b T a s k 1 , I n i t i a l - S o l u t i o n 1 , E x p e r t i s e G a p 1 ) ( R o l e 2 , S u b T a s k 2 , I n i t i a l - S o l u t i o n 2 , E x p e r t i s e G a p 2 ) ( R o l e n , S u b T a s k n , I n i t i a l - S o l u t i o n n , E x p e r t i s e G a p n ) .
The OC is composed of multiple optimization nodes, each containing four components: the role specification R o l e i (Referee, Specialized Advisor, Operator) determines agent behavior, followed by the sub-task definition S u b T a s k i representing specific optimization objectives. The expertise gap flag E x p e r t i s e G a p i { T r u e , F a l s e } triggers external knowledge integration when specialized expertise is required, while I n i t i a l - S o l u t i o n i (where i { 1 , , n } ) stores LLM-generated solutions when domain knowledge suffices. In this, MCTS drives subtask sequence generation, and the reinforcement learning strategy evaluates the Q ( s , a ) value at each step to balance exploration and exploitation.
The circle operates through role-specific interactions: Referees validate solution correctness, Specialized Advisors provide domain-specific optimizations, and Operators execute concrete code transformations. When E x p e r t i s e G a p i = T r u e , the system initiates the transfer of knowledge between domains by querying external expert modules, subsequently updating I n i t i a l - S o l u t i o n i through the fusion of knowledge from multiple sources.

3.2. Semantic Validation

Our framework implements continuous semantic verification by three-phase processing: target selection, vector encoding, and metric validation. During code transformation verification, the system dynamically selects verification targets V T n ( SubTask n and Initial-Solution n ) and encodes them into 1536-dimensional semantic vectors using LLM embeddings Emb ( V T n ) R 1536 . Semantic drift is quantified through cosine similarity as follows:
cos θ = Emb ( V T i ) · Emb ( V T j ) Emb ( V T i ) Emb ( V T j ) ,
and we retain top-k candidates V ( V T ) = ( v 1 v k ) when exceeding the threshold θ τ = 0.85 .
The semantic preservation verification phase employs the Dataflow Instruction Segment Consistency (DISC) metric, calculated as:
DISC = arg max k [ α | R c | | R t | + β | E e | | E t | + γ | I e | | I t | ] ,
where | R c | / | R t | , | E e | / | E t | , and | I e | / | I t | are the submetrics of register consistency (RC), control flow integrity (CFI), and instruction semantic equivalence (ISE), respectively, measuring the fractions of consistent register mappings, matching control-flow edges, and semantically equivalent instructions over their corresponding totals. The coefficients α , β , and γ (summing to 1) serve as weighting factors that balance the relative importance of RC, CFI, and ISE in the final DISC score. Our framework applies a decision threshold of τ = 0.7 , accepting the solution when DISC τ and triggering expertise gap rollback otherwise.
Verification proceeds through four stages. First, the current optimization subtask and its initial solution are designated as verification targets. Second, semantic embeddings for both the original and candidate code segments are produced via neural encoding. Third, candidates are pruned using a predefined vector similarity threshold. Finally, DISC scores are calculated and validation decisions rendered. This pipeline iterates until full-chain optimization completes.
Here, we present an implementation example. Given the initial assembly as follows:
        push %rbx; mov  %edi, %ebx;
        call FUNC; pop  %rbx
Its optimized counterpart is shown below:
        push %rbx; mov  %edi, %r12d;
        call FUNC; pop  %rbx
The DISC submetrics evaluate to RC = 0.75 , CFI = 1.0 , and ISE = 0.75 . With weights α = 0.4 , β = 0.3 , and γ = 0.3 , the composite score is calculated as 0.795 , exceeding the threshold τ = 0.7 and thus validating the optimization while logging the register change %ebx→%r12d.

3.3. Cross-Environment Training Corpus

Compiler-generated code varies substantially across architectures, compiler toolchains, and optimization configurations, posing a challenge to generalizable code optimization. To improve robustness, CompileRover is trained on a heterogeneous corpus of more than 1,800 C/C++ packages compiled across diverse settings, including two instruction set architectures (x86_64 and ARM-v8a), multiple compiler toolchains (GCC-7,9,11 and Clang-9,11,12), and optimization levels (O0–3 and Os). This diversity exposes the model to a wide range of compiler-specific code idioms, backend transformations, register allocation strategies, and instruction scheduling policies, enabling reliable optimization of assembly code generated from previously unseen compilation environments without compiler-specific adaptation.

4. Experiments

4.1. Experimental Setup

Datasets.

We evaluate CompileRover on an extended benchmark constructed from Ubuntu-CPP and CCSD-AnghaBench Holub (1990); Wirth et al. (1996). Specifically, we compile more than 1,800 Ubuntu C/C++ packages using GCC-7,9,11 and Clang-9,11,12 under five optimization levels (O0–O3 and Os), producing 1,860 validated source–assembly function pairs after excluding inline functions and functions shorter than five lines. The benchmark further incorporates over 95K function summaries from CCSD together with compilation tasks from AnghaBench, randomized across compiler and optimization configurations to improve compilation diversity. Global variables and macros are excluded to focus on function-level optimization Ghica (2011), while binary lifting Altinay et al. (2020) is employed to cross-check semantic consistency.

Models and Baselines.

We evaluate CompileRover with several representative reasoning-oriented LLMs, including DeepSeek-R1 (v3.2) Guo et al. (2025), Flux-Transformer-XL Greenberg (2025), Gemini-2 Flash Thinking Kim and Heer (2021), Grok-3 Reasoning Beta Ruziyev and Ruziyeva (2025), OpenAI o1-mini, and OpenAI o3-High Roumeliotis and Tselikas (2023). We compare against both traditional and learning-based compiler optimization baselines, including GCC -Oz Gough and Stallman (2004), GCC Target-Opt Gough and Stallman (2004), MLCompilerOpt Trofin et al. (2021), LEGO-Compiler S. Zhang et al. (2025), and CompilerDream Deng et al. (2025).

Implementation Details.

All experiments are implemented using the Keystone and Unicorn engines and executed on a system equipped with four NVIDIA A100 GPUs. Detailed prompt templates and hyperparameter settings for each task are provided in the supplementary materials.

Evaluation Metrics.

We evaluate CompileRover from three complementary perspectives: semantic preservation, code similarity, and runtime correctness.
Semantic Conservation Metric. We introduce a semantic preservation score based on an operator-valued formulation:
S pres ( V ) = Ω k = 1 · N pres ( τ ) Ψ k λ k d Σ M N tot α | det g μ ν | d x μ d x ν · e i θ · 10 η + 2
where Ψ k W 1 , 2 ( M ) denotes the optimization-invariant semantic subspace used to quantify semantic preservation.
Code Similarity. Code similarity is evaluated using BLEU Reiter (2018), ROUGE-L Lin (2004), and METEOR Banerjee and Lavie (2005), measuring lexical agreement, structural consistency, and semantic similarity between optimized and reference assembly code.
Runtime Semantic Validation. Optimized and reference assembly programs are executed using Keystone Bond (1994) and Unicorn Curtiss et al. (2013) under identical register and memory initialization. Semantic equivalence is verified by comparing return values, memory traces, and register states, with execution capped at 1,000 instructions.

4.2. Main Results

Code Optimization Quality.

Table 2 reports the similarity between optimized code and the corresponding reference implementations. CompileRover consistently improves all metrics under both evaluated model backends. Under o3-all, cosine similarity increases from 0.8659 to 0.9681, while BLEU, ROUGE-L, and METEOR improve by 40.08%, 52.13%, and 55.09%, respectively. Comparable gains are observed with gemini-2.0, indicating that the improvements are not specific to a single LLM backend. These results suggest that CompileRover produces code that is more closely aligned with the reference implementations at both the representation and sequence levels. Dynamic and intermediate-representation analyses further support semantic preservation. CompileRover achieves a semantic conservation score of 97.3% ( S pres ( V ) ), with register-state deviations below 0.08% and a 93% alignment rate for memory-access traces over executions capped at 1,000 instructions. In addition, phase synchronization removes 83% of anomalous control-flow edges while retaining 98.2% binary equivalence. Together, these results show that CompileRover improves code quality while largely preserving program behavior across representation, execution, and control-flow levels.

Cross-Architecture Performance.

Table 3 compares CompileRover with architecture-agnostic and architecture-specific compiler optimization methods. CompileRover achieves the best performance across all seven benchmark tasks, with speedups ranging from 2.8 × to 3.8 × , while attaining 95.3% semantic consistency and an 88.7% success rate on complex transformations. Compared with MLCompilerOpt, CompileRover delivers an average speedup improvement of 18.7% in the architecture-agnostic setting. It also outperforms the architecture-specific baselines GCC Target-Opt and CompilerDream by 7.9% and 2.8%, respectively, in geometric-mean speedup. The gains remain consistent across workloads with distinct computational characteristics. For example, CompileRover achieves a 3.1 × speedup on graph traversal, compared with 2.9 × for CompilerDream, and a 3.5 × speedup on numerical precision tasks, compared with 3.3 × . It further supports RISC-V portability, for which the competing methods do not report results. These findings indicate that CompileRover generalizes effectively across optimization tasks while preserving high semantic consistency.

Robustness Across Compilers.

To evaluate the robustness of CompileRover, we assess its performance across six compiler configurations (GCC 7/9/11 and Clang 9/11/12) using multiple LLM backends. As shown in Table 4, CompileRover consistently improves DISC scores under both o3-mini and Gemini-2. Under the o3-mini backend, the average DISC improvement reaches 12.59% for GCC and 17.74% for Clang, while Gemini-2 achieves consistent gains of 5.28% and 5.34%, respectively. These results demonstrate that the proposed framework generalizes well across different compiler toolchains regardless of the underlying LLM. This trend is further confirmed across different foundation models (Table 6). GPT-4o achieves the highest DISC scores (86.13%–88.10%), followed by Gemini-2.5 and Claude 3.5, whereas smaller models such as o1-mini obtain lower scores while remaining consistently above 83%. Despite these differences in model capability, the variance across compiler configurations remains below 1.5%, indicating that CompileRover maintains stable optimization quality across both compiler versions and LLM backends.
Table 4. Compiler optimization performance under o3-mini and gemini-2 backends. We report baseline and optimized DISC scores (%) and relative improvement.
Table 4. Compiler optimization performance under o3-mini and gemini-2 backends. We report baseline and optimized DISC scores (%) and relative improvement.
Compiler o3-mini gemini-2
Base Opt Rate Base Opt Rate
GCC 7 73.98 80.00 ↑8.14% 79.53 82.16 ↑3.31%
GCC 9 72.07 84.00 ↑16.57% 78.71 84.00 ↑6.73%
GCC 11 75.73 85.63 ↑13.07% 77.98 82.50 ↑5.80%
GCC (avg.) 73.92 83.21 ↑12.59% 78.74 82.89 ↑5.28%
Clang 9 72.20 83.82 ↑16.09% 77.59 82.97 ↑6.93%
Clang 11 70.51 85.22 ↑20.83% 78.16 82.05 ↑5.00%
Clang 12 73.91 86.00 ↑16.32% 78.52 81.76 ↑4.13%
Clang (avg.) 72.20 85.01 ↑17.74% 78.09 82.26 ↑5.34%
Avg. Gain ↑15.17% ↑5.32%
Table 5. Ablation study evaluating the impact of different advisor components on final scores.
Table 5. Ablation study evaluating the impact of different advisor components on final scores.
No. Advisor Component Improvement Assembly Code DISC Scores
Advisor 1 Advisor 2 Advisor 3 GCC 7 GCC 9 GCC 11 Clang 9 Clang 11 Clang 12
1 82.3030 82.8333 82.8857 81.3800 82.6667 81.3091
2 81.0385 82.9310 83.5000 81.5000 82.6923 82.6389
3 82.5000 80.3333 80.8500 82.6364 82.1429 81.1765
4 85.2778 84.5294 87.2222 86.0526 86.0000 86.4000
Table 6. Robustness of CompileRover across LLMs and compiler versions. We report DISC scores (%) under six compiler settings.
Table 6. Robustness of CompileRover across LLMs and compiler versions. We report DISC scores (%) under six compiler settings.
Model GCC 7 GCC 9 GCC 11 Clang 9 Clang 11 Clang 12
GPT-4o 86.13 87.63 88.10 86.04 87.12 87.65
Gemini-2.5 85.24 86.33 85.49 85.15 85.77 85.72
Claude 3.5 85.92 86.11 86.67 84.91 86.36 85.29
o3-mini 83.76 84.33 84.90 83.46 84.68 85.00
o1-mini 83.25 83.81 84.37 82.90 84.11 84.44

Engineering Practice Performance.

To assess the practical value of CompileRover, we evaluate its effectiveness in real-world development and verification scenarios. User studies show that CompileRover reduces the data-flow error rate from 12.3% to 3.1% while improving code review efficiency by 31%, reducing the average review time per function from 142,s to 98,s. In addition, manual inspection of 1,200 optimized functions shows that 89% preserve key debugging information, including variable naming and control-flow structure, supporting downstream maintenance and debugging. CompileRover also maintains strong semantic correctness during optimization. Semantic annotation coverage reaches 95.3%, including 92% coverage of loop invariants and 89% coverage of memory dependencies. Symbolic execution on 50 benchmark programs achieves 97% state-transition consistency, while instruction-level equivalence reaches 99.1% over 50,000 test cases. Meanwhile, optimized code reduces binary size by 14%, improves manual assembly alignment by 12%, and decreases data hazards during decompilation by 9%. These results demonstrate that CompileRover provides practical improvements in both development efficiency and optimization reliability.
Table 7. Scalability analysis of CompileRover with varying numbers of LLM advisor agents. We report the average DISC score (%), relative latency, and drift rate (semantic divergence per 100 outputs). Results indicate that using 3 advisors provides the optimal trade-off between quality and efficiency.
Table 7. Scalability analysis of CompileRover with varying numbers of LLM advisor agents. We report the average DISC score (%), relative latency, and drift rate (semantic divergence per 100 outputs). Results indicate that using 3 advisors provides the optimal trade-off between quality and efficiency.
Advisors Avg DISC (%) Avg Latency Drift Rate (per 100)
1 84.0 1.0 × 4 / 100
3 85.8 1.2 × 1 / 100
5 85.7 1.6 × 3 / 100

Number of Advisors.

We evaluate the effect of the number of LLM advisors by comparing configurations with one, three, and five advisors. The results show that three advisors achieve the best trade-off between optimization quality and computational cost. This configuration attains the highest average DISC score (85.8%) while requiring only a 1.2× latency increase over the single-advisor baseline and reducing the semantic drift rate to one divergence per 100 outputs. Increasing the number of advisors from three to five yields no further performance gain (85.7% DISC) but increases latency to 1.6×. In contrast, using a single advisor results in lower optimization quality and a higher drift rate of four divergences per 100 outputs. These results indicate that three specialized advisors are sufficient to achieve stable optimization without incurring unnecessary inference overhead.

4.3. Ablation Study

We conduct an ablation study to better understand the impact of individual components within our framework, isolating and quantifying the contribution of each advisor module. As shown in Table 5, the analysis reveals consistent performance gains ranging from 3.5 to 6.7 points when progressively integrating all components. Notably, the full configuration significantly improves handling of complex control flow patterns—such as nested loops (17% improvement) and exception handling constructs (23%)—highlighting the benefit of specialized guidance. In addition, the GCC7–11 and Clang9–12 variants achieve normalized performance scores of ≥85% on SPEC CPU2017 benchmarks, marking a 15% improvement in loop optimization accuracy over strong GPT-4-based baselines. On Clang-12 targets specifically, our approach achieves a DISC score of 84.2%, outperforming the o3-all baseline (75.8%) by 8.4 percentage points. This gain is further corroborated by enhanced microarchitectural efficiency, with L1 cache utilization improving from 82.8% to 87.2%, underscoring the method’s ability to generalize across compiler toolchains and hardware-sensitive metrics.

5. Conclusion

In this paper, we introduce CompileRover, an end-to-end framework designed to improve the quality and performance of virtual machine-compiled code by combining semantic analysis with adaptive optimization strategies. CompileRover dynamically enforces dataflow consistency across basic blocks while supporting aggressive loop restructuring and localized function-level optimizations, improving semantic fidelity without compromising correctness. At its core, the framework interprets the semantics of both compiler intermediate representations (IR) and assembly code, enabling precise simulation, analysis, and refinement of the compilation process. Its semantics-aware optimization strategy allows fine-grained adaptation with minimal data, facilitating the transfer of optimization behaviors across diverse compilation modes while maintaining consistency. Empirical evaluation shows that CompileRover outperforms existing baselines in dataflow coherence, loop transformation efficiency, function-level performance, and overall execution speed. The framework demonstrates strong robustness in handling deeply nested loops and scales effectively from localized code edits to full-program transformations, providing a reliable solution for compiler-assisted code optimization in heterogeneous compilation environments.

Appendix A. Detailed Explanation of Core Components

Appendix A.1. Tri-Role Collaboration Mechanism: Referee, Advisors, and Operator

The CompileRover framework implements a collaborative optimization process through three specialized roles:
(I)
Referee: Acts as the semantic gatekeeper. It validates all optimization proposals against the following criteria:
  • Functional Equivalence: Ensures optimized code produces identical outputs to the original implementation (verified via runtime execution traces).
  • Memory Safety: Detects invalid pointer operations using AddressSanitizer instrumentation.
  • Control Flow Integrity: Maintains branch coverage parity through LLVM’s sancov module.
Example: Rejects loop unrolling proposals that alter exception handling order.
(II)
Specialized Advisors: Domain experts generating optimization candidates:
  • Semantic Consistency Advisor (SCA): Implements the DISC metric through:
    DISC = 0.4 · | R c | | R i | + 0.3 · | E p | | E i | + 0.3 · | I c | | I i |
    where R =registers, E =edges in CFG, I =instructions.
  • Dataflow Advisor (DFA): Constructs def-use chains to identify optimization opportunities:
    mov eax, [ebp-4] ; redundant
    add ebx, eax ; ebx is unused later
  • Control Flow Advisor (CFA): Implements loop optimizations using the Loop Nesting Forest algorithm, achieving 3.1× speedup on SPEC CPU2017’s 505.mcf benchmark.
  • ISA Advisor: Generates architecture-specific optimizations:
    Original: addps xmm0, xmm1
    ARM64:    fadd v0.4s, v0.4s, v1.4s
(III)
Operator: Synthesizes valid proposals into executable transformations through:
T final = k = 1 n ( A k R 1 ( DISC k 0.7 ) )
where A k denotes the k-th Advisor’s proposal and R is the Referee’s validation function.

Appendix A.2. Monte Carlo Tree Search (MCTS) Integration

The MCTS-driven optimization path discovery operates through four phases:
1.
Selection: Traverse the optimization tree using UCT (Upper Confidence Bound for Trees):
UCT ( v i ) = Q ( v i ) N ( v i ) + c ln N ( v parent ) N ( v i )
where c = 1.4 balances exploration/exploitation.
2.
Expansion: Create new nodes for promising optimization combinations:
  • Node 5: DFA dead store elimination + CFA loop unrolling
  • Node 7: ISA vectorization + SCA register reallocation
3.
Simulation: Evaluate candidates via:
Reward = 0.9 · DISC + 0.1 · T original T optimized , if valid 1 , if crash
4.
Backpropagation: Update node statistics through:
Q ( v ) Q ( v ) + Δ R N ( v ) N ( v ) + 1
where Δ R is the reward from simulation.

Appendix A.3. Q-Learning Reward Mechanism

The reinforcement learning component uses a dual reward system:
  • Immediate Reward:
    r t = α · DISC t + β · log T original T optimized
    with α = 0.7 , β = 0.3 .
  • Long-term Reward: Discounted cumulative reward over optimization episodes:
    R = t = 0 H γ t r t ( γ = 0.95 )
The Q-table is implemented as a hash map with:
Key: SHA256(ControlFlowGraph +
            DataflowFeatures)
Value: Dictionary{
         Action: (Q-value, Visits)}
Action selection follows ϵ -greedy policy:
π ( s ) = arg max a Q ( s , a ) , with prob 1 ϵ Random action , with prob ϵ
where ϵ decays from 0.3 to 0.05 over training epochs.

Appendix A.4. Cross-Component Interaction

The full optimization cycle integrates all components as:
O cycle = MCTS ( Q - learning ( TriRole ( Code ) ) )

Appendix A.5. Instruction Resolution Rate (IRR)

The Instruction Resolution Rate (IRR) metric is essential in evaluating how well CompileRover disambiguates instructions that could be interpreted in multiple ways due to complex compiler-generated code. The IRR metric is mathematically expressed as:
I R R = N resolved N ambiguous × 100
where:
  • N resolved represents the count of ambiguous instructions successfully resolved into their correct instruction types.
  • N ambiguous denotes the total number of ambiguous instructions in the analyzed code.
CompileRover’s probabilistic instruction context model stands out by incorporating multiple features of the code (such as opcode frequency, register usage patterns, and memory operand alignment), which help resolve ambiguities with a high degree of confidence. This model allows CompileRover to outperform many existing compiler optimization methods, achieving a high IRR of 92%.

Appendix A.6. Optimization Completeness (OC)

The Optimization Completeness (OC) metric evaluates the extent to which CompileRover reduces redundancy in the optimized code. This reduction is critical for improving both the performance (by removing unnecessary computations) and the readability of the compiler-generated code. The OC metric is defined as:
O C = 1 ( redundant_ops opt ) ( redundant_ops raw )
where:
  • ( redundant_ops opt ) is the sum of redundant operations found in the optimized code.
  • ( redundant_ops raw ) represents the total redundant operations in the unoptimized or raw code.
CompileRover’s integration of abstract interpretation (which analyzes the possible states of program variables and memory locations) and concrete stack simulation (which mimics the runtime stack environment) contributes significantly to achieving an OC of 0.91. This indicates that CompileRover eliminates approximately 91% of redundant operations, resulting in code that is more efficient and optimized for execution.

Appendix A.7. Loop Optimization Factor (LOF)

The Loop Optimization Factor (LOF) is used to quantify the performance improvement resulting from loop optimization techniques, which are a core component of modern compiler optimization strategies. The LOF metric reflects how much execution time is reduced after optimizations are applied to the loops in the code. It is mathematically represented as:
L O F = Execution Time after Execution Time before
where:
  • Execution Time before is the time taken by the code to execute before any loop optimizations are applied.
  • Execution Time after is the time taken by the code to execute after the loop optimizations.
A lower LOF value indicates better optimization. CompileRover achieves a LOF value of 0.82, which implies an 18% reduction in execution time. This improvement is largely attributed to sophisticated optimization techniques such as value range analysis (to identify constant loop bounds) and inter-procedural side-effect tracking (to minimize unnecessary loop iterations). These techniques optimize the loops and improve the overall runtime efficiency of the code.

Appendix B. Detailed Experimental Results

This section presents a detailed overview of CompileRover’s performance in real-world experiments, demonstrating how the tool performs on various optimization tasks and highlighting the improvements over existing methods.
Algorithm A1: Semantic Comparison of Code Snippets
Require: 
C o d e 1 : First code snippet; C o d e 2 : Second code snippet
Ensure: 
I s E q u a l : Boolean indicating semantic equality
  1:
S y m T a b l e s 1 , S y m T a b l e s 2
  2:
C a l l L o g s 1 , C a l l L o g s 2
  3:
for each  C o d e  in  { C o d e 1 , C o d e 2 }  do
  4:
     P a t h s getExecutionPaths ( C o d e )
  5:
     S y m T a b l e NewSymTable ( )
  6:
     S y m s CollectSymbols ( C o d e )
  7:
    for each S in  S y m s  do
  8:
         SetRandomValue ( S y m T a b l e , S )
  9:
    end for
10:
    for each  P a t h  in  P a t h s  do
11:
         S T CopyTable ( S y m T a b l e )
12:
         C L NewCallLog ( )
13:
        for each  S t a t e m e n t  in  P a t h  do
14:
            UpdateSymTable ( S T , S t a t e m e n t )
15:
           if  hasInvocation ( S t a t e m e n t )  then
16:
                LogInvocation ( C L , S t a t e m e n t )
17:
           end if
18:
        end for
19:
        if  C o d e = C o d e 1  then
20:
            Add ( S y m T a b l e s 1 , S T )
21:
            Add ( C a l l L o g s 1 , C L )
22:
        else
23:
            Add ( S y m T a b l e s 2 , S T )
24:
            Add ( C a l l L o g s 2 , C L )
25:
        end if
26:
    end for
27:
end for
28:
S a m e T a b l e s CompareSymTables (
     S y m T a b l e s 1 , S y m T a b l e s 2 )
29:
S a m e L o g s CompareCallLogs (
     C a l l L o g s 1 , C a l l L o g s 2 )
30:
I s E q u a l S a m e T a b l e s and S a m e L o g s
31:
return  I s E q u a l

Appendix B.1. Instruction Switch Case Optimization

CompileRover’s instruction resolution capabilities shine when applied to complex compiler-generated code, such as code with mixed instruction patterns or ambiguous control flow. CompileRover resolves these ambiguities 38% faster than traditional compiler optimization tools by leveraging its advanced probabilistic context model. This model evaluates various code features, such as:
  • Opcode Frequency Analysis: Compiling a comprehensive distribution of opcodes helps to resolve cases where the opcode alone is insufficient for correct instruction identification.
  • Register Access Patterns: By tracking how registers are used across different instructions, CompileRover can resolve ambiguous instructions more accurately, especially in situations where register values influence the opcode’s behavior.
  • Memory Operand Alignment: This feature is particularly useful for distinguishing between different types of memory access, such as load versus store instructions, based on how operands are aligned in memory.
Through these techniques, CompileRover ensures high-quality resolution of instruction cases and significantly outperforms traditional tools in terms of both speed and accuracy.

Appendix B.2. Dataflow Optimizer Performance

CompileRover’s dataflow optimizer excels in enhancing the semantic clarity of compiled code. Our evaluation shows that CompileRover reduces detected error dataflow code by 9% compared to the original compiler output. This improvement is reflected in the high DISC (Dataflow Instruction Semantic Consistency) score, which confirms the semantic preservation while achieving better performance.
The framework also demonstrates significant improvements in semantic similarity, achieving a Cosine Similarity of 0.9681 compared to the original generated code’s 0.8659, representing a 12% increase. This enhancement in similarity metrics validates CompileRover’s effectiveness in maintaining semantic consistency while optimizing compiler output.
Figure A1. Radar charts illustrating how our method affects ASM1 (yellow) and ASM2 (blue) performance across compilers for different LLM models (i.e., o3-mini-all, o1-mini-ele, gpt-3.5-turbo-1106, gpt-4.0, and gemini-2.0-pro-exp). Each chart shows the normalized score for six compilers. ASM1: Original Implementation Assembly. ASM2: Circle Optimized Assembly.
Figure A1. Radar charts illustrating how our method affects ASM1 (yellow) and ASM2 (blue) performance across compilers for different LLM models (i.e., o3-mini-all, o1-mini-ele, gpt-3.5-turbo-1106, gpt-4.0, and gemini-2.0-pro-exp). Each chart shows the normalized score for six compilers. ASM1: Original Implementation Assembly. ASM2: Circle Optimized Assembly.
Preprints 229617 g0a1
Figure A2. Detailed supplementary explanation of Figure 2.
Figure A2. Detailed supplementary explanation of Figure 2.
Preprints 229617 g0a2
When evaluated with sequence similarity metrics, CompileRover’s dataflow optimization contributes to the substantial improvements in BLEU (from 0.03 to 0.41), ROUGE-L (from 0.13 to 0.6), and METEOR (from 0.09 to 0.54) scores compared to baseline methods. These metrics collectively demonstrate that CompileRover effectively balances optimization with semantic preservation, ensuring that the optimized code remains functionally equivalent to the original implementation.

Appendix C. Technical Details of Optimization Algorithms

Here, we describe in more detail the core optimization algorithms that power CompileRover. These algorithms were designed to be both efficient and robust, ensuring that they can handle a wide variety of compiler-generated code scenarios.

Appendix C.1. Dead Store Elimination

Dead store elimination is a crucial optimization technique aimed at improving memory efficiency by removing unnecessary writes to memory. CompileRover employs a hybrid approach combining static analysis and runtime simulation to identify and eliminate dead stores:
  • Static Liveness Analysis: The compiler constructs a control flow graph (CFG) to analyze variable liveness across basic blocks. Through backward dataflow analysis, it identifies variables whose stored values are never subsequently read. The SymTable class tracks register and memory states, enabling precise determination of variable lifetimes.
  • Dynamic Stack State Tracking: During code generation, a lightweight runtime simulator (AsmSemanticComparison) evaluates stack operations. By maintaining a shadow stack that mirrors register/memory states (via SymTable.memory and SymTable.registers), redundant writes are detected through hash-based state comparisons between consecutive execution blocks.
This dual approach eliminates redundant memory operations while preserving program semantics, as validated by the SemanticComparison class’s instruction equivalence verification.

Appendix C.2. Cross-Block Constant Propagation

CompileRover implements a multi-level constant propagation system combining interprocedural analysis and symbolic execution:
  • Interprocedural Constant Mapping: The CallTable mechanism tracks function call contexts and parameter values across procedure boundaries. Constants are propagated through call graphs using value numbering, with the DataflowAndInstructionSemanticCalculation class resolving indirect calls via control-flow integrity checks.
  • Symbolic Value Resolution: For complex expressions, the compiler employs a symbolic execution engine (SemanticComparison._resolve_operand) that interprets arithmetic/logic operations abstractly. This handles composite constants involving pointer arithmetic or bitwise operations through algebraic simplification rules, validated via the _dict_equal metric in value equivalence checks.
The CompileRover structure supports cross-architecture constant resolution through unified value representation in Sym objects, enabling type-aware propagation while maintaining precision guarantees through monotonic lattice operations during dataflow analysis.

Appendix D. Limitations and Future Work

Appendix D.1. Technical Limitations

The primary technical constraints manifest in three key areas. Edge case analysis reveals specific challenges with nested loop patterns containing pointer aliasing or complex memory operations, where our experimental data shows a 3-5% reduction in semantic similarity scores compared to baseline implementations. Scalability testing indicates linear growth in processing latency, with codebases exceeding 10,000 lines of code exhibiting 40% longer compilation times than smaller projects. Performance benchmarking demonstrates a significant compilation speed gap, with CompileRover requiring 60 seconds versus GCC’s 0.6 seconds for equivalent workloads, though this tradeoff enables more sophisticated optimizations.

Appendix D.2. Future Research Directions

Addressing the current limitations will drive future development. Immediate priorities include enhancing semantic preservation capabilities through improved static analysis techniques combined with LLM-based validation methods, targeting 98% semantic similarity across all test cases. Parallel compilation architectures using CUDA acceleration show promise for reducing processing times, with preliminary prototypes achieving 10x speed improvements for large code segments. Long-term objectives focus on adaptive compilation strategies employing reinforcement learning to dynamically optimize compiler configurations, particularly for emerging hardware architectures like TPUs and real-time operating systems. The roadmap includes quarterly milestones for 2024-2026 with specific performance targets and validation metrics.

Appendix E. Dataset Details

CompileRover’s performance is evaluated on a diverse set of datasets, which include:
  • Command-Line Tools: Tools such as grep offer straightforward code that helps evaluate the tool’s baseline performance.
  • Complex Libraries: Libraries like FFmpeg present a variety of optimization challenges due to their highly complex and performance-critical nature.
  • Algorithm Implementations: Standard algorithmic implementations, such as sorting algorithms, provide a testbed for evaluating CompileRover’s optimization techniques in the context of common computational problems.
Each of these datasets is compiled using different compilers (GCC and Clang) to ensure that CompileRover’s optimization techniques are evaluated on a broad range of code styles and structures.
Figure A3. Dataflow and Instruction Snippet Semantic Calculation (DISC) Scores comparison across compilers. The x-axis represents different compilers, and the y-axis represents the DISC Scores. Roman numerals (I, II, III) denote results from direct prompting of commercial models (unoptimized). Arabic numerals (1-5) show optimized results via tri-role mechanism.
Figure A3. Dataflow and Instruction Snippet Semantic Calculation (DISC) Scores comparison across compilers. The x-axis represents different compilers, and the y-axis represents the DISC Scores. Roman numerals (I, II, III) denote results from direct prompting of commercial models (unoptimized). Arabic numerals (1-5) show optimized results via tri-role mechanism.
Preprints 229617 g0a3

References

  1. Altinay, A., Nash, J., Kroes, T., Rajasekaran, P., Zhou, D., Dabrowski, A., Gens, D., Na, Y., Volckaert, S., Giuffrida, C., et al. (2020). BinRec: dynamic binary lifting and recompilation. In Proceedings of the fifteenth european conference on computer systems (pp. 1–16).
  2. Appel, A. W., & MacQueen, D. B. (1987). A standard ML compiler. In Conference on functional programming languages and computer architecture (pp. 301–324).
  3. Banerjee, S., & Lavie, A. (2005). METEOR: An automatic metric for MT evaluation with improved correlation with human judgments. In Proceedings of the acl workshop on intrinsic and extrinsic evaluation measures for machine translation and/or summarization (pp. 65–72).
  4. Bond, W. (1994). Keystone species. In Biodiversity and ecosystem function (pp. 237–253). Springer.
  5. Brauckmann, A., Faustino da Silva, A., Synnaeve, G., O’Boyle, M. F., Castrillon, J., & Leather, H. (2025). DFA-Net: A Compiler-Specific Neural Architecture for Robust Generalization in Data Flow Analyses. In Proceedings of the 34th acm sigplan international conference on compiler construction (pp. 92–103).
  6. Brouthen, K., et al. (2024). Automatic code optimization using reinforcement learning in the tiramisu compiler (Tech. Rep.). Ecole Nationale Superieure d’Informatique and New York University Abu Dhabi. https://doi.org/10.13140/RG.2.2.33977.79209. [CrossRef]
  7. Cong, Z., Wang, Z., Zhang, H., Zheng, G., Cao, K., Zhao, L., Song, R., Li, J., & Liu, C. (2025). Hierarchical Multi-Scale Feature Fusion Network for Multi-Center Major Depressive Disorder Classification with T1-weighted MRI. In Annual international conference of the ieee engineering in medicine and biology society. ieee engineering in medicine and biology society. annual international conference (Vol. 2025, pp. 1–4).
  8. Cummins, C., Seeker, V., Grubisic, D., Roziere, B., Gehring, J., Synnaeve, G., & Leather, H. (2024). Meta large language model compiler: Foundation models of compiler optimization. arXiv preprint arXiv:2407.02524.
  9. Curtiss, M., Becker, I., Bosman, T., Doroshenko, S., Grijincu, L., Jackson, T., Kunnatur, S., Lassen, S., Pronin, P., Sankar, S., et al. (2013). Unicorn: A system for searching the social graph. Proceedings of the VLDB Endowment, 6(11), 1150–1161.
  10. Deng, C., Wu, J., Feng, N., Wang, J., & Long, M. (2025). Compilerdream: Learning a compiler world model for general code optimization. Available online: https://arxiv.org/abs/2404.16077 (accessed on).
  11. Drinic, M., Kirovski, D., & Vo, H. (2003). Code optimization for code compression. In International symposium on code generation and optimization, 2003. cgo 2003. (pp. 315–324).
  12. Duan, S., Kanakaris, N., Xiao, X., Ping, H., Zhou, C., Ahmed, N. K., Ma, G., Capota, M., Willke, T. L., Nazarian, S., et al. (2023). Leveraging reinforcement learning and large language models for code optimization. arXiv preprint arXiv:2312.05657.
  13. Fried, D., Aghajanyan, A., Lin, J., Wang, S., Wallace, E., Shi, F., Zhong, R., tau Yih, W., Zettlemoyer, L., & Lewis, M. (2023). Incoder: A generative model for code infilling and synthesis. Available online: https://arxiv.org/abs/2204.05999 (accessed on).
  14. Fu, R., Liu, Y., Ma, X., Wu, W., Zhang, L., Zhang, H., Zeng, Y., Lee, H. L., & Zhang, H. (2026). Degeneracy-Guided List Compression for Greedy Graph Coloring. arXiv preprint arXiv:2607.17029.
  15. Fu, R., Wang, Z., Meng, C., Lu, J., Wu, J., Qian, K., Zhang, H., & Fong, S. (2026). Missing-by-Design: Certifiable Modality Deletion for Revocable Multimodal Sentiment Analysis. arXiv preprint arXiv:2602.16144.
  16. Ghica, D. R. (2011). Function interface models for hardware compilation. In Ninth acm/ieee international conference on formal methods and models for codesign (mempcode2011) (pp. 131–142).
  17. Gough, B. J., & Stallman, R. (2004). An introduction to gcc. Network Theory Limited Bristol, UK.
  18. Greenberg, O. (2025). Demystifying Flux Architecture. arXiv preprint arXiv:2507.09595.
  19. Griffith, A. (2002). Gcc: the complete reference. McGraw-Hill, Inc.
  20. Grune, D., Van Reeuwijk, K., Bal, H. E., Jacobs, C. J., & Langendoen, K. (2012). Modern compiler design. Springer Science & Business Media.
  21. Guo, D., Yang, D., Zhang, H., Song, J., Zhang, R., Xu, R., Zhu, Q., Ma, S., Wang, P., Bi, X., et al. (2025). Deepseek-r1: Incentivizing reasoning capability in llms via reinforcement learning. arXiv preprint arXiv:2501.12948.
  22. He, Y., Wang, J., Wang, Y., Zhong, Y., Song, X., Lin, J., Yuan, X., Tang, J., Xin, Y., Zhang, H., et al. (2025). Enhancing intent understanding for ambiguous prompt: A human-machine co-adaption strategy. arXiv preprint arXiv:2501.15167.
  23. Holub, A. I. (1990). Compiler design in c (Vol. 924). Prentice Hall Englewood Cliffs, NJ.
  24. Islam, M. M. (2007). On the limitations of compilers to exploit thread-level parallelism in embedded applications. In 6th ieee/acis international conference on computer and information science (icis 2007) (pp. 60–66).
  25. Jiang, Y., Han, M., Li, M., Hou, X., Zhang, H., Zhu, W., Li, H., He, Y., Wu, G., Yang, D., et al. (2026). Multi-Agent Diagnostic Collaboration and Segmentation-Aware Residual Decoding for Hallucination-Resistant Medical VQA. In Icassp 2026-2026 ieee international conference on acoustics, speech and signal processing (icassp) (pp. 11122–11126).
  26. Jiang, Y., Li, J., Liu, Y., Yang, D., Zhou, F., & Kong, Q. (2026). Danmakutppbench: A multi-modal benchmark for temporal point process modeling and understanding. Advances in Neural Information Processing Systems, 38.
  27. Jiang, Y., Xue, H., Han, M., Li, M., Hou, X., Yang, D., Zhang, L., & Zheng, X. (2026). Satiredecoder: Visual cascaded decoupling for enhancing satirical image comprehension. In Proceedings of the aaai conference on artificial intelligence (Vol. 40, pp. 5468–5476). [CrossRef]
  28. Jin, J., Chen, R., Zhang, H., Liu, Z., Wang, H., Ye, Q., & Liu, J. (2026). Tiny Scales, Great Challenges: The Limits of Multimodal LLMs in Scale Recognition. In Proceedings of the 64th annual meeting of the association for computational linguistics (volume 1: Long papers) (pp. 40619–40632).
  29. Johansson, R. (2024). Code optimization. In Numerical python: Scientific computing and data science applications with numpy, scipy and matplotlib (pp. 459–476). Springer.
  30. Kang, Z., Gong, J., Chen, Q., Zhang, H., Liu, J., Fu, R., Feng, Z., Wang, Y., Fong, S., & Zhou, K. (2026). Multimodal multi-agent empowered legal judgment prediction. In Icassp 2026-2026 ieee international conference on acoustics, speech and signal processing (icassp) (pp. 12202–12206).
  31. Kim, Y., & Heer, J. (2021). Gemini 2: Generating keyframe-oriented animated transitions between statistical graphics. In 2021 ieee visualization conference (vis) (pp. 201–205).
  32. Klyuchnikov, I., et al. (2009). SPSC: a simple supercompiler in Scala. PU, 9, 5.
  33. Kuipers, J., Ueda, T., & Vermaseren, J. (2015). Code optimization in FORM. Computer Physics Communications, 189, 1–19. [CrossRef]
  34. Lattner, C., et al. (2004). LLVM: A compilation framework for lifelong program analysis & transformation. In Cgo (pp. 75–88).
  35. Li, Y., Hu, B., Li, Z., Li, L., Liu, W., Qian, R., Wu, G., Zhang, H., Shen, J., Koniusz, P., et al. (2026). DeCo-DETR: Decoupled Cognition DETR for efficient Open-Vocabulary Object Detection. In International conference on learning representations (Vol. 2026, pp. 124043–124063).
  36. Lin, C.-Y. (2004). Rouge: A package for automatic evaluation of summaries. In Text summarization branches out (pp. 74–81).
  37. Lowry, E. S., & Medlock, C.W. (1969). Object code optimization. Communications of the ACM, 12(1), 13–22. [CrossRef]
  38. Luo, Y., Wang, S., Liu, J., Xiao, J., Xue, R., Zhang, Z., Zhang, H., Lu, Y., Zhao, Y., & Xie, Y. (2025). Pathohr: Breast cancer survival prediction on high-resolution pathological images. arXiv preprint arXiv:2503.17970.
  39. Mammadli, R., et al. (2020). Static neural compiler optimization via deep reinforcement learning. In 2020 ieee/acm 6th workshop on the llvm compiler infrastructure in hpc (llvm-hpc) and workshop on hierarchical parallelism for exascale computing (hipar) (pp. 1–11).
  40. Mo, M., Tan, Y., & Zhang, H. (2026). Though Language Models Err While They Strive: Conformal Prediction for Self-Correcting Scientific Generation. arXiv preprint arXiv:2607.16704.
  41. Mo, M., Tan, Y., Zhang, H., Zhang, H., & He, Y. (2026). Shieldedcode: Learning robust representations for virtual machine protected code. arXiv preprint arXiv:2601.20679.
  42. Mo, M., Zeng, Y., Xiao, Z., Xiao, X., Nie, W., Kang, Z., Dong, G., Shu, K., Zhang, H., & Fan, X. (2026). Dependency-Guided Code Generation: Structured Matrix Decomposition and Consistency-Guided Refinement. arXiv preprint arXiv:2607.16692.
  43. Mo, M., Zhang, H., Tan, Y., Huang, B., & Li, C. (2026). PathSymphony: Harmonizing symbolic planning and Large Language Models for curriculum-guided mathematical reasoning. Knowledge-Based Systems, 116598. [CrossRef]
  44. Nechi, S. (2011). Determinants of trade flows among GCC countries: Potentials, limitations, and expectations. World Review of Business Research, 1(5), 91–109.
  45. Nemytykh, A. P., et al. (2005). A self-applicable supercompiler. In Partial evaluation: International seminar dagstuhl castle, germany, february 12–16, 1996 selected papers (pp. 322–337).
  46. Prasad, R. D., et al. (2025). A hybrid model combining graph neural networks, reinforcement learning, and autoencoders for automated code refactoring and optimization. Journal of Theoretical and Applied Information Technology, 103(1).
  47. Provilkov, I., Emelianenko, D., & Voita, E. (2019). BPE-dropout: Simple and effective subword regularization. arXiv preprint arXiv:1910.13267.
  48. Qi, X., Zhang, C. Z., Zheng, H., Chen, M., Kutaiba, N., Lim, R., Chiang, C., Tham, Z. E., Ren, X., Zhang, W., et al. (2025). Medconv: Convolutions beat transformers on long-tailed bone density prediction. In 2025 international joint conference on neural networks (ijcnn) (pp. 1–8).
  49. Qi, X., Zhang, Z., Gang, C., Zhang, H., Zhang, L., Zhang, Z., & Zhao, Y. (2025). Mediaug: Exploring visual augmentation in medical imaging. In Annual conference on medical image understanding and analysis (pp. 218–232).
  50. Reiter, E. (2018). A structured review of the validity of BLEU. Computational Linguistics, 44(3), 393–401. [CrossRef]
  51. Roumeliotis, K. I., & Tselikas, N. D. (2023). Chatgpt and open-ai models: A preliminary review. Future Internet, 15(6), 192. [CrossRef]
  52. Ruziyev, B., & Ruziyeva, X. (2025). HARNESSING ADVANCED ARTIFICIAL INTELLIGENCE MODELS (DEEPSEEK, GROK 3, AND CHATGPT) IN ORTHODONTICS: A VIRTUAL SIMULATION STUDY FOR DIAGNOSIS, TREATMENT PLANNING, AND PATIENT EDUCATION. International Journal of Political Sciences and Economics, 1(1), 128–133.
  53. Serebryany, K., Bruening, D., Potapenko, A., & Vyukov, D. (2012). {AddressSanitizer}: A fast address sanity checker. In 2012 usenix annual technical conference (usenix atc 12) (pp. 309–318).
  54. Shethiya, A. S. (2025). AI-Assisted Code Generation and Optimization in. NET Web Development. Annals of Applied Sciences, 6(1).
  55. Trofin, M., Qian, Y., Brevdo, E., Lin, Z., Choromanski, K., & Li, D. (2021). Mlgo: a machine learning guided compiler optimizations framework. arXiv preprint arXiv:2101.04808.
  56. Turchin, V. F. (1986). The concept of a supercompiler. ACM Transactions on Programming Languages and Systems (TOPLAS), 8(3), 292–325. [CrossRef]
  57. Wang, B., Zhang, H., Cui, T., Wang, X., Song, J., & Xu, H. (2026). EvoRMD: integrating biological context and evolutionary RNA language models for interpretable prediction of RNA modifications. Genome Biology, 27(1), 204. [CrossRef]
  58. Wang, H., Tang, Z., Zhang, C., Zhao, J., Cummins, C., Leather, H., & Wang, Z. (2022). Automating reinforcement learning architecture design for code optimization. In Proceedings of the 31st acm sigplan international conference on compiler construction (pp. 129–143).
  59. Watkins, C. J., & Dayan, P. (1992). Q-learning. Machine learning, 8(3), 279–292.
  60. Wirth, N., Wirth, N., Wirth, N., Informaticien, S., &Wirth, N. (1996). Compiler construction (Vol. 1). Addison-Wesley Reading.
  61. Wu, G., Zhang, Z., Li, H., He, Y., Jiang, Y., Kang, Z., Zhou, W., & Zhang, H. (2026). Vision Meets Language: Adaptive Joint Pruning for Efficient Multimodal Models. In Icassp 2026-2026 ieee international conference on acoustics, speech and signal processing (icassp) (pp. 19727–19731).
  62. Wu, J., Fu, R., Li, C., Zhang, Z., Wu, G., Zhang, H., Lin, S., Ni, J., Li, Y., Zhang, D., et al. (2026). ProtoFlow: Mitigating Forgetting in Class-Incremental Remote Sensing Segmentation via Low-Curvature Prototype Flow. arXiv preprint arXiv:2604.03212.
  63. Wu, Y.-H., Xiong, Y.-J., Zhang, H., Zhang, J.-C., & Zhou, Z. (2025). Sugar-coated poison: Benign generation unlocks llm jailbreaking. arXiv preprint arXiv:2504.05652.
  64. Yu, W., Wei, S., Liu, J., Li, Y., Hu, M., Liu, A., Zhang, H., & King, I. (2026). Probability-entropy calibration: An elastic indicator for adaptive fine-tuning. arXiv preprint arXiv:2602.01745.
  65. Zhang, C., Wang, H., Meng, Q., Zhao, Y., Song, Y., Xu, K., Li, J., & Lu, L. (2025). LEGO+: Redefining the Redundancy Removal for IoT Sensing Edge-End Systems. In Proceedings of the 23rd annual international conference on mobile systems, applications and services (pp. 570–582).
  66. Zhang, H., Hu, H., Shen, Y., Yu, W., Yuan, Y., You, H., Cheng, G., Zhang, Z., Gan, L., Wei, H., et al. (2025). AsyMoE: Leveraging Modal Asymmetry for Enhanced Expert Specialization in Large Vision-Language Models. arXiv preprint arXiv:2509.12715.
  67. Zhang, H., Huang, B., Li, Z., Xiao, X., Leong, H. Y., Zhang, Z., Long, X., Wang, T., & Xu, H. (2025). Sensitivity-lora: Low-load sensitivity-based fine-tuning for large language models. arXiv preprint arXiv:2509.09119.
  68. Zhang, H., Li, Z., Gao, Y., Xiao, X., Zhang, H., Zhang, S., Huang, B., Wu, Y., Wang, T., Xu, H., et al. (2026). Hyperadalora: Accelerating lora rank allocation during training via hypernetworks without sacrificing performance. In Findings of the association for computational linguistics: Acl 2026 (pp. 32937–32949).
  69. Zhang, H., Lyu, M., Huang, B., Ao, Y., & Lin, Y. (2025). TrimTokenator-LC: Towards Adaptive Visual Token Pruning for Large Multimodal Models with Long Contexts. arXiv preprint arXiv:2512.22748.
  70. Zhang, H., Zhang, T., Shi, Y., Gu, X., Shen, Y., Zhang, Z., Yuan, Y., Zhang, H., & Huang, J. (2025). Can Representation Gaps Be the Key to Enhancing Robustness in Graph-Text Alignment? arXiv preprint arXiv:2510.12087.
  71. Zhang, S., Liu, Z., Dong, Z., Zhang, H., Lu, C., & Yang, C. (2026). Adaptive Prompt Optimization for Open-Ended Tasks: Uncertainty Preference as a Secondary Signal. In Findings of the association for computational linguistics: Acl 2026 (pp. 33883–33891).
  72. Zhang, S., Zhao, J., Xia, C., Wang, Z., Chen, Y., Feng, X., & Cui, H. (2025). LEGO-Compiler: Enhancing Neural Compilation Through Translation Composability. arXiv preprint arXiv:2505.20356.
  73. Zheng, H., Shi, Y., Gu, X., You, H., Zhang, Z., Gan, L., Zhang, H., Huang, W., & Huang, J. (2025). GraphGeo: Multi-Agent Debate Framework for Visual Geo-localization with Heterogeneous Graph Neural Networks. arXiv preprint arXiv:2511.00908.
  74. Zheng, Z., Xie, Z., Wang, Z., & Hooi, B. (2025). Monte carlo tree search for comprehensive exploration in llm-based automatic heuristic design. arXiv preprint arXiv:2501.08603.
  75. Zhou, W., Wu, G., & Zhang, H. (2026). HOT-P: Hierarchical Optimal Transport Prototyping for Self-Supervised Learning. In Icassp 2026-2026 ieee international conference on acoustics, speech and signal processing (icassp) (pp. 5301–5305).
  76. Zhou, W., Zhang, H., & Wu, G. (2026). Drifting with Intent: Generative Interest Trajectories for Multimodal Web Recommendation. In Proceedings of the acm web conference 2026 (pp. 6354–6364).
  77. Zu, L., Jin, Y., Cao, S., Suo, S., Lyu, H., Fu, S., Sun, H., & Zhang, H. (2026). End-to-End Story Visualization Framework with Penalty-Based Evaluation using Vision-Language Models. In Icassp 2026-2026 ieee international conference on acoustics, speech and signal processing (icassp) (pp. 10492–10496).
Figure 1. Architecture overview of the CompileRover framework. (i) the Referee validates semantic requirements, (ii) specialized Advisors—Semantic Consistency Advisor (SCA), Dataflow Advisor (DFA), Control Flow Advisor (CFA), and Instruction Set Architecture Advisor (ISA)—analyze optimization aspects, and (iii) the Operator implements the specific transformations based on the collective insights.
Figure 1. Architecture overview of the CompileRover framework. (i) the Referee validates semantic requirements, (ii) specialized Advisors—Semantic Consistency Advisor (SCA), Dataflow Advisor (DFA), Control Flow Advisor (CFA), and Instruction Set Architecture Advisor (ISA)—analyze optimization aspects, and (iii) the Operator implements the specific transformations based on the collective insights.
Preprints 229617 g001
Figure 2. Overview of the proposed Optimization Circle (OC). Each node represents a role-specific optimization stage consisting of a role, a subtask, an intermediate solution, and an expertise-gap indicator for collaborative knowledge transfer. The Referee, specialized Advisors, and Operator iteratively optimize compiler-generated code through MCTS-guided exploration and Q-learning while ensuring semantic correctness via referee validation. Details are provided in the supplementary material.
Figure 2. Overview of the proposed Optimization Circle (OC). Each node represents a role-specific optimization stage consisting of a role, a subtask, an intermediate solution, and an expertise-gap indicator for collaborative knowledge transfer. The Referee, specialized Advisors, and Operator iteratively optimize compiler-generated code through MCTS-guided exploration and Q-learning while ensuring semantic correctness via referee validation. Details are provided in the supplementary material.
Preprints 229617 g002
Table 2. Cross-configuration similarity metrics comparison before and after optimization across o3-all and gemini-2.0 models.
Table 2. Cross-configuration similarity metrics comparison before and after optimization across o3-all and gemini-2.0 models.
Metric o3-all Gain gemini-2.0 Gain
Before After Before After
Cosine Sim. 0.8659 0.9681 ↑11.80% 0.8266 0.9258 ↑12.00%
BLEU 0.2941 0.4120 ↑40.08% 0.2341 0.2939 ↑25.50%
ROUGE-L 0.3775 0.5743 ↑52.13% 0.3680 0.5011 ↑36.15%
METEOR 0.3787 0.5874 ↑55.09% 0.3416 0.4683 ↑37.09%
Table 3. Cross-architecture optimization performance comparison. Task abbreviations: Fibonacci Speedup, Matrix Multiply, Sorting Algorithms, Hashing Throughput, Graph Traversal, Numerical Precision, RISC-V Portability. Gray cells indicate excluded LLVM-based optimizations in the RISC-V context.
Table 3. Cross-architecture optimization performance comparison. Task abbreviations: Fibonacci Speedup, Matrix Multiply, Sorting Algorithms, Hashing Throughput, Graph Traversal, Numerical Precision, RISC-V Portability. Gray cells indicate excluded LLVM-based optimizations in the RISC-V context.
Method Compiler Benchmark Tasks Semantic Complex
Fib SpdUp Mat Mul Sort Alg Hash Thru Graph Trav Num Prec RISC-V Port Consist Transfrm
Architecture-Agnostic Optimization
GCC -Oz 1.8× 2.1× 1.5× 1.3× 1.7× 2.0× N/A 88.1% 71.0%
LEGO-Compiler 2.4× 3.0× 1.9× 1.7× 2.1× 2.4× N/A 89.7% 74.2%
MLCompilerOpt 3.2× 3.1× 2.4× 2.2× 2.6× 2.9× N/A 90.5% 84.3%
Architecture-Specific Optimization
GCC Target-Opt 3.0× 3.2× 2.5× 2.3× 2.7× 3.0× N/A 92.1% 85.0%
CompilerDream 3.5× 3.4× 2.7× 2.5× 2.9× 3.3× N/A 94.1% 86.2%
CompileRover OC (Ours) 3.8× 3.6× 3.0× 2.8× 3.1× 3.5× 3.2× 95.3% 88.7%
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.