paperbot · PL 论文追踪

全部论文 待读 收藏

P2 BackSmith: A Systematic Approach to Testing Compiler Backends

BackSmith:一种系统化的编译器后端测试方法
OOPSLA 10(OOPSLA2)2026匹配度 4/10 · 该论文聚焦编译器后端测试,与用户核心方向(静态分析、LLM/Agent 改进程序分析、浮点/贝叶斯程序分析)无直接交集,但同属 PL 领域且问题驱动、工业落地特征明显。引用 0 inbox
Hongyu Chen, Yu Wang, Jianhua Zhao, Ke Wang
crossref: 2026-10-02

AI 速览

一句话:提出黑盒编译器后端测试方法 BackSmith,通过生成后端导向、抗优化和稀有汇编程序,在 GCC/LLVM 后端发现 104 个新缺陷。

编译器后端负责将高层代码翻译为高效机器指令,但其测试相对不足。有效测试需要能暴露指令选择、寄存器分配等底层行为的程序,然而这类程序难以生成,并常被中端优化消除。BackSmith 是一种跨编译器和架构的黑盒测试方法,它生成同时具备后端导向特征与抗优化特征的代码片段,以压力测试后端机制并保持程序多样性;还专门生成编译后汇编在随机生成中罕见的片段,并将三类特征整合进种子程序。作者在 16 个成熟的 GCC 和 LLVM 后端上评估,经过五个月测试发现 104 个此前未知的后端缺陷,其中 88 个已确认或修复,表明该方法能系统性地暴露后端缺陷。

问题
编译器后端测试相对薄弱:现有方法生成的程序难以触发底层后端行为,且相关特征常被中端优化消除,导致后端缺陷不易被发现。
方法
BackSmith 采用黑盒方式生成种子程序,融合后端导向特征、抗优化特征以及随机生成中少见的稀有汇编片段,以跨编译器、跨架构地压力测试后端。
评估
在 16 个成熟的 GCC 和 LLVM 后端上进行了五个月测试,共发现 104 个此前未知的后端缺陷,其中 88 个已确认或修复。
原文摘要(Abstract)

Compiler backends are critical for translating high-level code into efficient machine instructions, yet they remain relatively underexplored in compiler testing. Effective backend testing requires programs that expose low-level backend behaviors, but such features are difficult to generate and are frequently eliminated by earlier optimization passes. As a result, existing testing approaches often fail to adequately exercise backend behaviors and are therefore less effective at uncovering backend defects. We present BackSmith, a black-box approach for testing compiler backends across compilers and architectures. BackSmith generates code snippets with two complementary properties: backend-oriented features that directly stress backend mechanisms such as instruction selection and register allocation, and optimization-resistant features that preserve program diversity by resisting excessive middle-end canonicalization. To further increase coverage of rare but critical backend behaviors, BackSmith also generates code snippets whose compiled assembly rarely arises during random generation. It then integrates all three kinds of features into seed programs for backend testing. We evaluated BackSmith on 16 mature GCC and LLVM backends. Over five months of testing, BackSmith uncovered 104 previously unknown backend bugs, 88 of which have been confirmed or fixed, demonstrating the effectiveness of our approach in systematically exposing backend defects.

链接与引用

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

BibTeX
@article{paperbot12128,
  title = {BackSmith: A Systematic Approach to Testing Compiler Backends},
  author = {Hongyu Chen and Yu Wang and Jianhua Zhao and Ke Wang},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {10},
  number = {OOPSLA2},
  year = {2026},
  doi = {10.1145/3839529}
}