paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Compiler Optimization Testing Based on Optimization-Guided Equivalence Transformations

基于优化引导的等价变换的编译器优化测试
FSE Proceedings of the 33rd ACM International Conference on the Foundations of Software Engineering2025匹配度 2/10 · 该论文研究编译器优化测试与蜕变测试,属于软件测试/编译器工程方向,与用户关注的静态分析、LLM/Agent 与程序分析交叉、浮点程序分析及贝叶斯程序分析均无直接关联。虽然涉及编译器优化正确性,但未涉及用户当前追的核心问题。引用 3 inbox
Jingwen Wu, Jiajing Zheng, Zhenyu Yang, Zhongxing Yu
crossref: 2026-09-12

AI 速览

一句话:提出用优化引导的等价变换构造蜕变测试,摆脱编译器优化测试对差分测试的依赖并发现错误优化缺陷。

编译器优化实现复杂,其正确性测试至关重要。现有测试方法大多依赖差分测试,需要跨多个编译器比较输出,因而带来两项根本限制:被测试的优化功能必须在所有编译器中一致实现,且多个编译器共有的缺陷无法被发现,这会导致误报并需要大量人工排查。本文提出一种受编译器优化启发的蜕变测试方法,核心在于如何最大化优化机会并有效判定优化正确性:首先采用定制的代码构造策略生成能够满足特定优化条件的输入程序,然后对同一程序施加多种编译器优化变换,得到语义等价的测试程序,通过比较变换前后程序的输出差异来识别错误的优化行为。作者在 GCC 与 LLVM 上进行了初步评估,截至论文写作时已成功检测到五个错误的优化缺陷,表明该方法有效且具有潜力。

问题
现有编译器优化测试方法依赖差分测试,要求被测优化功能在各编译器中实现一致,且无法发现多个编译器共享的缺陷,从而产生误报与大量人工开销。
方法
提出蜕变测试方法:用定制代码构造策略生成满足优化条件的输入程序,再施加多种编译器优化变换得到语义等价的测试程序,通过比较变换前后输出判定优化是否正确。
评估
在 GCC 和 LLVM 上进行初步评估,截至写作时成功检测到五个错误的优化缺陷,验证了方法的有效性与潜力。
原文摘要(Abstract)

Compiler optimization techniques are inherently complex, and rigorous testing of compiler optimization implementation is critical. Recent years have witnessed the emergence of testing approaches for uncovering incorrect optimization bugs, but these approaches rely heavily on the differential testing mechanism, which requires comparing outputs across multiple compilers. This dependency gives rise to important limitations, including that (1) the tested functionality must be consistently implemented across all compilers and (2) shared bugs remain undetected. Thus, false alarms can be produced and significant manual efforts will be required. To overcome the limitations, we propose a metamorphic testing approach inspired by compiler optimizations. The approach is driven by how to maximize compiler optimization opportunities while effectively judging optimization correctness. Specifically, our approach first employs tailored code construction strategies to generate input programs that satisfy optimization conditions, and then applies various compiler optimization transformations to create semantically equivalent test programs. By comparing the outputs of pre- and post-transformation programs, this approach effectively identifies incorrect optimization bugs. We conducted a preliminary evaluation of this approach on GCC and LLVM, and we have successfully detected five incorrect optimization bugs at the time of writing. This result demonstrates the effectiveness and potential of our approach.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot9161,
  title = {Compiler Optimization Testing Based on Optimization-Guided Equivalence Transformations},
  author = {Jingwen Wu and Jiajing Zheng and Zhenyu Yang and Zhongxing Yu},
  booktitle = {FSE},
  year = {2025},
  doi = {10.1145/3696630.3728528}
}