[PATCH] D19660: Use a single context for lto

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 07:12:42 PDT 2016


rafael created this revision.
rafael added reviewers: ruiu, pcc, joker.eph.
rafael added a subscriber: llvm-commits.
Herald added a subscriber: joker.eph.

Using multiple context used to be a really big memory saving because we could free memory from each file while the linker proceeded with the the symbol resolution. We are getting lazier about reading data from the bitcode, so I was curious if this was still a good tradeoff.

One thing that is a bit annoying is that we still have to copy the symbol names. The problem is that the names are stored in the Module and get freed when we move the module bits during linking.

Long term I think the solution is to add a symbol table to the bitcode. That way IRObject file will not need to use a Module or a Context and we can drop it while still keeping a StringRef to the names.

This patch might still be an interesting medium term improvement.

When linking llvm-as without debug info this patch is a small speedup:

master: 29.861877513 seconds
patch: 29.814533787 seconds

With debug info the numbers are

master: 34.765181469 seconds
patch: 34.563351584 seconds

The peak memory usage when linking llvm-as with debug info was

master: 599.10MB
patch: 600.13MB




http://reviews.llvm.org/D19660

Files:
  ELF/Driver.cpp
  ELF/Driver.h
  ELF/InputFiles.cpp
  ELF/InputFiles.h
  ELF/LTO.cpp
  ELF/LTO.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19660.55400.patch
Type: text/x-patch
Size: 4221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160428/619e0db2/attachment.bin>


More information about the llvm-commits mailing list