[PATCH] D41120: Compact symbols from 88 to 80 bytes

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 18:16:23 PST 2017


After the current optimizations the results of this is mixed.

We get better cache, but more branches.

I tried to instead create an absolute section so that we can always
access the section of a symbol. This has the advantage that some code
simplifies a lot

OutputSection *Symbol::getOutputSection() const {
  return getSection()->Repl->getOutputSection();
}

But the extra loads for checking if a symbol is absolute seem to offset
any advantage.

I will drop this effort for now.  Some ideas that got while working on
it

* Free SymMap once we are done looking up names. That should reduce peak
  memory usage.

* Walk all symbols and
  * Remove lazy symbols
  * Move the symbol definition outwards. If the symbol points to a merge
    section, we can have it point to a synthetic section or even the
    output section in some cases. This can also handle Repl.

The first item should simplify isUndefWeak with was using close to 1.5%
of the time in some cases. The second one should help when there is more
than one relocation for each symbol, which is probably very common when
compiling with debug info.

Cheers,
Rafael

Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu added a comment.
>
> How much do you gain by this change? This is I think undeniably a bit tricky, so if the difference is negligible, I wouldn't make this change. I actually tried to do a similar thing but decided not to do that in the end to keep these classes simple.
>
>
> https://reviews.llvm.org/D41120


More information about the llvm-commits mailing list