paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Efficient Code Causes Inefficiency in Compiler Optimizations

高效的代码导致编译器优化中的低效
ASE Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering2024匹配度 2/10 · 论文关注编译器优化的性能测试与缺陷发现,属于传统编译器测试方向;与用户画像中的静态分析、LLM/Agent、浮点程序分析、贝叶斯程序分析等核心主题没有直接交集。虽然涉及工业编译器且问题驱动,但不在当前研究主线。引用 0 inbox
Hongyu Chen
crossref: 2026-09-12

AI 速览

一句话:从相反角度评估编译器优化:开发者手动优化可能反使GCC/LLVM生成更低效代码并暴露缺陷。

编译器优化本应提升生成代码效率,但既有编译器测试工作很少从开发者手动优化这一实际场景出发检验优化效果。本文提出一种简单评估方法:先通过程序变换将源程序变为与原程序等价或效率更低的版本,再分别编译并比较两版生成代码的性能,从而把原程序视为“优化后”版本。作者用该方法评估工业编译器 GCC 和 LLVM,发现原程序中额外的手动优化不仅可能无益,还可能对编译器优化产生反作用,导致最终生成代码整体更低效。评估中总结并报告了 53 个 LLVM 与 18 个 GCC 缺陷,其中分别有 37 个和 17 个被确认或修复。

问题
研究在开发者手动优化程序后,编译器是否真的能生成更高效的代码,以及额外优化是否会失效甚至产生反效果。
方法
通过程序变换构造等价或更低效版本,比较原版与变换版生成代码的性能;将原程序视作优化版本来评估 GCC/LLVM 的优化效果。
评估
在 GCC 和 LLVM 上评估,发现额外优化可能反而降低生成代码效率,报告了 53 个 LLVM 和 18 个 GCC 缺陷,其中 37 个和 17 个被确认或修复。
原文摘要(Abstract)

Optimizations, a critical element within the compiler pipeline, is responsible for improving the efficiency of generated code. In this paper, we take a different angle to evaluate compiler optimizations than all existing works in compiler testing literature. In particular, we consider a specific scenario in software development, that is, when developers manually optimize a program to improve its performance, do compilers actually generate more efficient code with the help of developers' optimizations? To answer this question, we develop a simple approach which consists of (1) transforming a program into the same or less efficient version of the original program, and then (2) comparing the performance of the generated code from each version of the source code. Consequently, the original program can be treated as an optimized version of the transformed program. We use the approach to evaluate GCC and LLVM, two industry compilers, and observe that the extra optimizations presented in the original programs can be not only unhelpful, but more seriously counterproductive to both GCC and LLVM, resulting in the less efficient code generated overall. Out of our evaluation results, we summarized and reported 53 LLVM and 18 GCC defects, out of which 37 and 17 have been confirmed or fixed.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot8387,
  title = {Efficient Code Causes Inefficiency in Compiler Optimizations},
  author = {Hongyu Chen},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695369}
}