RIFS: Run-Time Invariant Function Specialization

View at publisher
Authors: Saba Jamilan, Snehasish Kumar, Heiner Litz
Cited by: 0
References: 28

Abstract

Compilers apply optimizations such as function specialization and constant propagation to eliminate redundant work at compile time. However, because compilers must prove that values are constant, many profitable optimization opportunities remain unrealized. In this paper, we propose run-time invariant function specialization (RIFS), a profile-guided compiler technique that specializes functions based on runtime invariant call-site-specific argument values. RIFS introduces a novel value-profiling LLVM pass to identify runtime invariant arguments, even though they cannot be proven constant statically. A subsequent LLVM transformation pass generates specialized function variants tailored to these value profiles. To efficiently select among potentially thousands of specialization candidates, we develop a predictive cost model that estimates the performance benefit of each candidate prior to code generation. We integrate our passes seamlessly into the existing PGO-enabled LLVM toolchain. We evaluate RIFS across 11 real-world applications, demonstrating substantial improvements over state-of-the-art optimization techniques. RIFS achieves an average speedup of 6.3% and an instruction reduction of 2.5% over the LLVM -O3+PGO baseline.

Fields of Study & Subjects

Parallel Computing and Optimization Techniques Logic programming and type systems Embedded Systems Design Techniques

Publication details

Journal / source
ACM SIGPLAN International Conference on Compiler Construction (CC)
Pages
40–52
Publication date
28 January 2026