Return
Synchronized Behavior Checking: A Method for Finding Missed Compiler Optimizations
DOI:10.1145/3763105.png)
Abstract
En 中文
Compilers are among the most foundational software ever developed. A critical component of a compiler is its optimization phase, which enhances the efficiency of the generated code. Given the sheer size and complexity of modern compilers, automated techniques for improving their optimization component have been a major area of research. This paper focuses on a specific category of issues, namely missed optimizations, where compilers fail to apply an optimization that could have made the generated code more efficient. To detect missed optimizations, we propose Synchronized Behavior Checking (SBC), a novel approach that cross-validates multiple optimizations by leveraging their coordinated behaviors. The key insight behind SBC is that the outcome of one optimization can validate whether the conditions required for another optimization were met. For a practical implementation of SBC, we cross-validate two optimizations at once based on two kinds of relationships - co-occurring and complementary. In the co-occurring relationship, if an optimization is applied based on a specific semantic constraint (i.e., optimization condition) from an input program, another optimization, which depends on the same semantic constraint, should be applied as well. Second, when two optimizations are enabled by complementary semantic constraints, exactly one of the two optimizations should be applied. When an optimization should have been applied (according to either relationship) but was not applied, we regard it as a missed optimization. We conduct an extensive evaluation of SBC on two state-of-the-art industry compilers LLVM and GCC. SBC successfully detects a large number of missed optimizations in both compilers, in particular, they are caused by a wide range of compiler analyses. Based on our evaluation results, we reported 101 issues to LLVM and GCC, out of which 84 have been confirmed, and 39 have been fixed or assigned (for planned fixes). SBC opens up a new, exciting direction for finding missed compiler optimizations.
Keywords:
Compiler
Missed optimizations
Testing
Journal
P
IF:
2.8
Papers:
308
Citations:
4.7K

