Beyond a Joke: Dead Code Elimination Can Delete Live Code
Open Access
- 14 April 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 32-36
Abstract
Dead Code Elimination (DCE) is a fundamental compiler optimization technique that removes dead code (e.g., unreachable or reachable but whose results are unused) in the program to produce smaller or faster executables. However, since compiler optimizations are typically aggressively performed and there are complex relationships/interplay among a vast number of compiler optimizations (including DCE), it is not known whether DCE is indeed correctly performed and will only delete dead code in practice. In this study, we open a new research problem to investigate: can DCE happen to erroneously delete live code? To tackle this problem, we design a new approach named Xdead, which leverages differential testing, static binary analysis, and dynamic symbolic execution techniques, to detect miscompilation bugs caused by the erroneously deleted live code. Preliminary evaluation shows that Xdead can identify many divergent portions indicating erroneously deleted live code and finally detect two such miscompilation bugs in LLVM compilers. Our findings call for more attention to the potential issues in existing DCE implementations and more conservative strategies when designing new DCE-related compiler optimizations.Keywords
This publication has 21 references indexed in Scilit:
- Finding missed optimizations through the lens of dead code elimination2022
- Detecting Compiler Warning Defects Via Diversity-Guided Program MutationIEEE Transactions on Software Engineering, 2021
- BinDiffNN
: Learning Distributed Representation of Assembly for Robust Binary Diffing Against Semantic DifferencesIEEE Transactions on Software Engineering, 2021
- CTOS: Compiler Testing for Optimization Sequences of LLVMIEEE Transactions on Software Engineering, 2021
- Random testing for C and C++ compilers with YARPGenProceedings of the ACM on Programming Languages, 2020
- History-Guided Configuration Diversification for Compiler Test-Program Generation2019
- αDiff: cross-version binary code similarity detection with DNN2018
- Compiler validation via equivalence modulo inputs2014
- Test-case reduction for C compiler bugs2012
- BinHunt: Automatically Finding Semantic Differences in Binary Programs2008