<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I'm interested in finding ways to reduce code size. LLVM's MergeFunctions pass seems like a promising option, and I'm curious about its status in tree.</div><div class=""><br class=""></div><div class="">Enabling MergeFunctions gives a 1% code size reduction across the entire iOS shared cache (a collection of a few hundred system-critical DSO's). The numbers are even more compelling for Swift code. In fact, the swift compiler enables MergeFunctions by default when optimizing, along with an even more aggressive merging pass which handles equivalence-modulo-constant-uses (<a href="https://github.com/apple/swift/blob/master/lib/LLVMPasses/LLVMMergeFunctions.cpp" class="">https://github.com/apple/swift/blob/master/lib/LLVMPasses/LLVMMergeFunctions.cpp</a>).</div><div class=""><br class=""></div><div class="">Is anyone actively working on enabling MergeFunctions in LLVM's default pipelines? Is there a roadmap for doing so?</div><div class=""><br class=""></div><div class="">ISTM that preventing miscompiles when merging functions is a serious, unsolved problem. I.e., it's hard for the MergeFunctions pass to be *really sure* that two functions are a) really identical and b) safe to merge.</div><div class=""><br class=""></div><div class="">Is there a systematic solution at the IR-level, given that the semantics of IR are subject to change? Is extensive testing the only solution? Or is this intractable, and the only safe approach is to perform merging post-regalloc (or, at some late point when equivalence is easier to determine)?</div><div class=""><br class=""></div><div class="">thanks,</div><div class="">vedant</div><div class=""><br class=""></div></body></html>