[lld] [lld][MachO] Avoid quadratic iteration over already-folded symbols during ICF (PR #213339)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 1 00:22:45 PDT 2026


nocchijiang wrote:

LGTM on the fix itself. One note on the "Problem" narrative: the class-size explosion here is partly a deliberate design choice on the codegen side - global function merging and outlining emit one copy of the same body into nearly every TU and delegate dedup to linker ICF. I have [pending work](https://github.com/nocchijiang/llvm-project/compare/cgdata_outliner_hash_tree_read_in_place...nocchijiang:llvm-project:cgdata_outliner_grouped_global?expand=1) that groups the emission of outlined global functions (built on top of #205085), which should substantially reduce both the number of identical input sections the linker sees and the size of the largest class in builds like this one, relieving the ICF pressure at its origin. That said, the quadratic fold was a latent bug regardless of how the inputs arise, so this fix is necessary either way. Thanks for tracking it down.

https://github.com/llvm/llvm-project/pull/213339


More information about the llvm-commits mailing list