[PATCH] D17529: ELF: Implement ICF.
Joerg Sonnenberger via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 23 04:34:45 PST 2016
On Tue, Feb 23, 2016 at 01:11:32AM +0000, Rui Ueyama via llvm-commits wrote:
> GNU gold implements so-called "safe ICF" that identifies functions
> that are safe to merge by heuristics -- for example, gold think
> that constructors are safe to merge because there is no way to
> take an address of a constructor in C++. We have a different idea
> which David Majnemer suggested, which is to add NOPs at beginning
> of merged functions so that two or more pointers can have distinct
> values. We can do whichever we want, but this patch does not
> include neither one.
I think the "take the address" part is the crucial hint. Can't you tell
from the combination of visibility and relocations what functions are
safe to merge? The only tricky part I can imagine is identifying
vtables, as they do not classify as pointer leak.
More information about the llvm-commits