Search papers, labs, and topics across Lattice.
This paper introduces a top-down differential analysis methodology to characterize compiler optimization discrepancies, addressing the persistent issue of performance bugs in generated binaries. By calibrating differences in compiler outputs with detailed microarchitectural metrics, the authors uncover significant performance variations between GCC and Clang for identical source code. Their empirical evaluation not only identifies critical code snippets responsible for these discrepancies but also demonstrates the practical utility of a binary patching framework that rectifies performance issues by leveraging superior code sequences from competing compilers.
Identical source code can yield binaries with performance differences so stark that they reveal systemic flaws in compiler optimizations.
Compiler optimizations are essential for achieving high performance in modern software. However, recent studies highlight the persistence of performance bugs, i.e., subtle defects where the compiler generates functionally correct but computationally inefficient code, leading to significant performance degradation. Existing detection and testing methods typically employ a bottom-up approach, focusing on specific low-level code properties and remaining confined to known optimization rules. Consequently, they struggle to quantify the holistic impact of identified issues and often overlook critical microarchitectural inefficiencies. We observe a key indicator of untapped potential: different compilers often produce binaries with significant performance differences for identical source code. However, the root causes of these discrepancies remain largely unexplored and difficult to pinpoint using current techniques. To bridge this gap, we introduce a top-down differential analysis methodology. This approach calibrates compiler optimization differences with fine-grained, hierarchical microarchitectural metrics, offering a comprehensive view of runtime behavior. Using a sampling-based approach, this method efficiently pinpoints the critical code snippets responsible for performance differences, enabling targeted root cause analysis. Our empirical evaluation uncovers substantial and often surprising performance differences between binaries generated by GCC and Clang. A categorization of root causes reveals systemic challenges in compiler optimizations. To quantitatively validate our findings and demonstrate practical impact, we developed a binary patching framework that fixes identified performance issues by transplanting superior code sequences from competing compilers. This work provides a novel lens for understanding and analyzing optimization defects.