IRHash: Efficient Multi-Language Compiler Caching by IR-Level Hashing
Tobias Landsberg, Johannes Grunenberg, Christian Dietrich, Daniel Lohmann
Abstract
Compilation caches (CCs) save time, energy, and money by avoiding redundant compilations. They are provided by means of compiler wrappers (Ccache, sccache, cHash) or native build system features (Bazel, Buck2). Conceptually, a CC pays off if the achieved savings by cache hits outweigh the extra costs for cache lookups. Thus, most techniques try to detect a cache hit early in the compilation process by hashing the (preprocessed/tokenized) source code, but hashing the AST has also been suggested to achieve even higher end-to-end savings, as the increased accuracy outweighs the additional parsing costs. Technically, all these CCs are currently limited to C or C-style languages.
In this paper we take the conceptual question of the "right" lookup level for compiler caches one step further onto the IR level. We provide IRHash, an IR-level CC for LLVM that not only offers higher accuracy than the previous works but can also support all languages with an LLVM backend.
We evaluate IRHash against Ccache and cHash based on the development history of 16 open-source projects written in C, C++, Fortran, and Haskell. With an average build time reduction of 19% across all C projects, IRHash provides better end-to-end savings than Ccache (10%) and cHash (16%), while additionally supporting more languages.
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 43298a74-55f8-4473-b8c7-b5a44d044f75Related papers
- IRDL: an IR definition language for SSA compilersMathieu Fehr, Jeff Niu, River Riddle, Mehdi Amini et al.PLDI 2022 · 13 citations
- IRFuzzer: Specialized Fuzzing for LLVM Backend Code GenerationYuyang Rong, Zhanghan Yu, Zhenkai Weng, Stephen Neuendorffer et al.ICSE 2025 · 1 citation
- Redundant Array Computation EliminationZixuan Wang, Liang Yuan, Xianmeng Jiang, Kun Li et al.PLDI 2026
- FLUX: Finding Bugs with LLVM IR Based Unit Test CrossoversEric Liu, Shengjie Xu, David LieASE 2023 · 8 citations
- CIRBench: Evaluating Large Language Models as LLVM IR OptimizersZi Yang, Haifeng Ding, Fei Liu, Yingying Cheng et al.ICML 2026
