一句话:揭示编译器在获得更精确信息(死代码、值域)后反而生成更差代码,并自动化测试发现此类问题。
论文系统研究编译器优化中“更多信息导致更差输出”的反直觉现象。作者关注两类信息:死代码(程序点是否不可达)与值范围(变量在特定程序点的可能取值)。方法是对种子程序进行信息精化,比较精化前后生成代码的质量,从而检测优化退化。作者实现全自动测试方法,并在 GCC 与 LLVM 上大规模评估,量化该问题的存在与普遍程度。共报告 59 个案例,其中 55 个已被确认或修复。该工作揭示编译器组件交互与阶段排序问题,为理解和改进编译器开辟新方向。
To optimize a program, a compiler needs precise information about it. Significant effort is dedicated to improving the ability of compilers to analyze programs, with the expectation that more information results in better optimization. But this assumption does not always hold: due to unexpected interactions between compiler components and phase ordering issues, sometimes more information leads to worse optimization. This can lead to wasted research and engineering effort whenever compilers cannot efficiently leverage additional information. In this work, we systematically examine the extent to which additional information can be detrimental to compilers. We consider two types of information: dead code, i.e ., whether a program location is unreachable, and value ranges, i.e ., the possible values a variable can take at a specific program location. Given a seed program, we refine it with additional information and check whether this degrades the output. Based on this approach, we develop a fully automated and effective testing method for identifying such issues, and through an extensive evaluation and analysis, we quantify their existence and prevalence in widely used compilers. In particular, we have reported 59 cases in GCC and LLVM, of which 55 have been confirmed or fixed so far, highlighting the practical relevance and value of our findings. This work’s fresh perspective opens up a new direction in understanding and improving compilers.
@article{TheodoridisS24,
title = {Refined Input, Degraded Output: The Counterintuitive World of Compiler Behavior},
author = {Theodoros Theodoridis and Zhendong Su},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {PLDI},
year = {2024},
doi = {10.1145/3656404}
}