π€ AI Summary
This work addresses the limitation of current optimizing compilers, which often miss profitable optimizations due to the absence of critical semantic information in program representations. To recover such overlooked semantics from heterogeneous C/C++ contexts and generate optimization code that preserves semantic contracts, the authors propose leveraging large language models (LLMs). They introduce SeGaBench, the first executable benchmark for semantics-driven compiler optimization, comprising 120 representative cases, and establish a novel paradigm wherein an LLM acts as a speculative semantic proposer, complemented by a semantic validator and a performance evaluation protocol. Experimental results demonstrate that the best-performing model produces semantically correct outputs in 94.8% of cases, achieves speedups of at least 1.05Γ in 83.3% of cases, and yields performance gains in 93.3% of the benchmark suite.
π Abstract
Optimizing compilers miss profitable transformations when their enabling semantics are absent from the analyzed program representation. We ask whether large language models (LLMs) can recover such semantics from heterogeneous C/C++ context and realize them as validated, contract-preserving artifacts. We introduce SeGaBench, an executable benchmark containing 100 synthetic and 20 source-backed cases spanning low-level assumptions, data-structure invariants, and high-level semantic lifting. Each case includes hidden enabling semantics, an oracle artifact, correctness and semantic validators, and a reproducible performance protocol. We evaluate five LLMs using five independent responses per case. The strongest model produces correct artifacts in 94.8% of responses, achieves at least 1.05x speedup in 83.3%, and obtains a performance success on 93.3% of cases. Nevertheless, correct artifacts often close only part of the oracle gap. These results show that LLMs can complement compiler analysis as speculative semantic proposers, provided that their artifacts are validated and evaluated.