[llvm-dev] [lld] We call SymbolBody::getVA redundantly a lot...

Rafael Avila de Espindola via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 28 09:47:04 PST 2017


Sean Silva <chisophugis at gmail.com> writes:

> tl;dr: it looks like we call SymbolBody::getVA about 5x more times than we
> need to
>
> Should we cache it  or something? (careful with threads).

Maybe. It might be the case that there are multiple relocations to the
same symbol. It can also be the case that we look for it to find the
value to put in a symbol table.

The cost of the call is very different depending on what section the
symbol is in. One thing I think we can do is move the symbols out in the
section merge hierarchy.

For example, a symbol initially points to a MergeInputSection, but we
could then change it to point to a SyntheticSection or even an output
section.

Cheers,
Rafael


More information about the llvm-dev mailing list