Truths about compiler optimization for state-of-the-art (SOTA) C/C++ compilers
Esam El-Araby
Drew Davidson
Tamzidul Hoque
Jiang Yunfeng
Compiler optimizations are critical for performance and have been extensively studied, especially for C/C++ language compilers. Our overall goal in this thesis is to investigate and compare the properties and behavior of optimization passes across multiple contemporary, state-of-the-art (SOTA) C/C++ compilers to understand if they adopt similar optimization implementation and orchestration strategies. Given the maturity of pre-existing knowledge in the field, it seems conceivable that different compiler teams will adopt consistent optimization passes, pipeline and application techniques. However, our preliminary results indicate that such expectation may be misguided. If so, then we will attempt to understand the differences, and study and quantify their impact on the performance of generated code.
In our first work, we study and compare the behavior of profile-guided optimizations (PGO) in two popular SOTA C/C++ compilers, GCC and Clang. This study reveals many interesting, and several counter-intuitive, properties about PGOs in C/C++ compilers. The behavior and benefits of PGOs also vary significantly across our selected compilers. We present our observations, along with plans to further explore these inconsistencies in this report. Likewise, we have also measured noticeable differences in the performance delivered by optimizations across our compilers. We propose to explore and understand these differences in this work. We present further details regarding our proposed directions and planned experiments in this report. We hope that this work will show and suggest opportunities for compilers to learn from each other and motivate researchers to find mechanisms to combine the benefits of multiple compilers to deliver higher overall program performance.