[llvm-dev] LLD: Possible optimization for TargetInfo

Rui Ueyama via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 30 15:39:05 PDT 2016


I was wandering how much is the overhead of virtual function calls of
TargetInfo member functions. TargetInfo handles platform-specific details,
and we have target-specific subclasses of that class. The subclasses
override functions defined in TargetInfo.

The TargetInfo member functions are called multiple times for each
relocation. So the cost of virtual function calls may be non-neglible. That
is a motication to do the following test.

As a test, I removed all TargetInfo subclasses except for x86-64, move all
code from X86_64TargetInfo to TargetInfo, and remove `virtual` from
TargetInfo.

The original LLD links itself (with debug info) in 7.499 seconds. The
de-virtualized version did the same thing in 7.364 seconds. So it can
improve it by 1.8%.

I'm just pointing out that there's room there to improve performance, and
I'm not suggesting we do something for this right now. We probably
shouldn't do anything for this because the current code is pretty
straightforward. But I'd expect that we will eventually want do something
for this in future.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160330/2da3e72f/attachment.html>


More information about the llvm-dev mailing list