# \[RFC\] Global Function Merging

**URL:** <https://discourse.llvm.org/t/rfc-global-function-merging/82608>\
**Category:** IR & Optimizations\
**Created:** [October 18, 2024, 4:36am UTC](https://discourse.llvm.org/t/rfc-global-function-merging/82608 "2024-10-18T04:36:14Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![nocchijiang](https://sea1.discourse-cdn.com/flex021/user_avatar/discourse.llvm.org/nocchijiang/32/20310_2.png) [@nocchijiang](https://discourse.llvm.org/u/nocchijiang)\
**Post date:** [April 3, 2025, 9:54am UTC](https://discourse.llvm.org/t/rfc-global-function-merging/82608/9 "2025-04-03T09:54:27Z")

</div>

Here is my plan of improving the performance of loading global stable function map for non-LTO setups:

- The `Names` are unused during the actual consumption of the **Use** pass. I believe we should avoid loading them into the `NameToId` map to reduce memory footprint. Also I believe this should apply for all scenarios regardless of LTO configuration. To make it happen, we have to move the `Names` to the end of the serialized file and make some adjustments around the existing assertions accordingly (like skipping them during **Use** pass).

- We should make a dedicated mode for non-LTO/traditional 1-compiler-process-per-source-file setups that the map should be lazily loaded. The mode should be toggleable via a new flag. This would also lead to a major structural change to the serialized file:

What is your thought on this approach? Any feedbacks are appreciated.

---

_[View the full topic](https://discourse.llvm.org/t/rfc-global-function-merging/82608)._
