Effective function merging in the SSA form
Rodrigo C. O. Rocha, Pavlos Petoumenos, Zheng Wang, Murray Cole, Hugh Leather
Abstract
Function merging is an important optimization for reducing code size. This technique eliminates redundant code across functions by merging them into a single function. While initially limited to identical or trivially similar functions, the most recent approach can identify all merging opportunities in arbitrary pairs of functions. However, this approach has a serious limitation which prevents it from reaching its full potential. Because it cannot handle phi-nodes, the state-of-the-art applies register demotion to eliminate them before applying its core algorithm. While a superficially minor workaround, this has a three-fold negative effect: by artificially lengthening the instruction sequences to be aligned, it hinders the identification of mergeable instruction; it prevents a vast number of functions from being profitably merged; it increases compilation overheads, both in terms of compile-time and memory usage.
We present SalSSA, a novel approach that fully supports the SSA form, removing any need for register demotion. By doing so, we notably increase the number of profitably merged functions. We implement SalSSA in LLVM and apply it to the SPEC 2006 and 2017 suites. Experimental results show that our approach delivers on average, 7.9% to 9.7% reduction on the final size of the compiled code. This translates to around 2× more code size reduction over the state-of-theart. Moreover, as a result of aligning shorter sequences of instructions and reducing the number of wasteful merge operations, our new approach incurs an average compile-time overhead of only 5%, 3× less than the state-of-the-art, while also reducing memory usage by over 2×.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext e9a168e9-ceae-4985-884b-d0c7afc97a4cCited by top-tier papers3
- Lasagne: a static binary translator for weak memory model architecturesRodrigo C. O. Rocha, Dennis Sprokholt, Martin Fink, Redha Gouicem et al.PLDI 2022 · 21 citations
- Wax: Optimizing Data Center Applications With Stale ProfileTawhid Bhuiyan, Sumya Hoque, Angelica Aparecida Moreira, Tanvir Ahmed KhanASPLOS 2026 · 1 citation
- Parameterized Algorithms and Complexity for Function Merging with Branch ReorderingAmir Kafshdar Goharshady, Kerim Kochekov, Tian Shu, Ahmed Khaled ZaherPLDI 2026
Related papers
- A New Approach to Optimal Function Inlining for Code Size Minimization via E-graphsAmir K. Goharshady, Chun Kit Lam, Andreas Pavlogiannis, Ahmed Khaled ZaherOOPSLA 2026 · 1 citation
- Understanding and exploiting optimal function inliningTheodoros Theodoridis, Tobias Grosser, Zhendong SuASPLOS 2022 · 26 citations
- Disa: Accurate Learning-based Static Disassembly with AttentionsPeicheng Wang, Monika Santra, Mingyu Liu, Cong Sun et al.CCS 2025
- A Holistic Functionalization Approach to Optimizing Imperative Tensor Programs in Deep LearningJinming Ma, Xiuhong Li, Zihan Wang, Xingcheng Zhang et al.DAC 2024 · 1 citation
- Relaxing Alias Analysis: Exploring the Unexplored SpaceMichel Weber, Theodoros Theodoridis, Zhendong SuPLDI 2025 · 1 citation
