Optimistic and Scalable Global Function Merging
Open Access
- 20 June 2024
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 46-57
Abstract
Function merging is a pivotal technique for reducing code size by combining identical or similar functions into a single function. While prior research has extensively explored this technique, it has not been assessed in conjunction with function outlining and linker’s identical code folding, despite substantial common ground. The traditional approaches necessitate the complete intermediate representation to compare functions. Consequently, none of these approaches offer a scalable solution compatible with separate compilations while achieving global function merging, which is critical for large app development. In this paper, we introduce our global function merger, leveraging global merge information from previous code generation runs to optimistically create merging instances within each module context independently. Notably, our approach remains sound even when intermediate representations change, making it well-suited for distributed build environments. We present a comprehensive code generation framework that can seamlessly operate both the state-of-the-art global function outliner and our global function merger. These components work in harmony with each other. Our assessment shows that this approach can lead to a 3.5% reduction in code size and a 9% decrease in build time.Keywords
This publication has 20 references indexed in Scilit:
- Efficient profile-guided size optimization for native mobile applications2022
- HyFM: function merging for free2021
- An Experience with Code-Size Optimization for Production iOS Mobile Applications2021
- Effective function merging in the SSA form2020
- Function Merging by Sequence Alignment2019
- AutoFDO: automatic feedback-directed optimization for warehouse-scale applications2016
- Exploiting function similarity for code size reductionACM SIGPLAN Notices, 2014
- Practical automatic loop specializationACM SIGARCH Computer Architecture News, 2013
- Compiler techniques for code compactionACM Transactions on Programming Languages and Systems, 2000
- Partial redundancy elimination in SSA formACM Transactions on Programming Languages and Systems, 1999