[PATCH] Improve performance of lazy linking in llvm-link

James Molloy James.Molloy at arm.com
Tue Mar 26 11:30:21 PDT 2013


Hi,

The attached patch improves the runtime performance of LinkModules. When
linking even a small module against a large (for example a library)
module with many demand-linked symbols (available_externally linkage),
the linker ends up taking much longer than it should.

For every function in the library module (whether it will be linked or
not), it creates an equivalent function declaration in the source
module. Then, at the end of the link, it checks the usage count of the
declaration - if it's non-zero it needs to be linked. If it's zero, it
doesn't need to be linked and can be removed.

This is very neat in terms of the code structure, but the creation and
erasing of these function declarations does take quite a bit of time
with a large library module.

The attached patch changes the algorithm to be slightly less "neat" in
coding style but much more performant.

Please review!

Cheers,

James

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lazy-linking.patch
Type: text/x-patch
Size: 4426 bytes
Desc: lazy-linking.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130326/4206643e/attachment.bin>


More information about the llvm-commits mailing list