Commit Graph

15 Commits

Author SHA1 Message Date
Davide Italiano 595ee8cb9c [LTO] Include ASM undefs in llvm.compiler_used.
This fixes PR28218. Thanks to Rafael for spotting a failure in
the SHARED_LIBS build!

Differential Revision:  http://reviews.llvm.org/D21577

llvm-svn: 273451
2016-06-22 18:09:23 +00:00
Rafael Espindola 0de48c393d Delete dead variable.
llvm-svn: 267935
2016-04-28 20:29:12 +00:00
Rafael Espindola 156f4ee1c0 Use a single context for lto.
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
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 is 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
llvm-svn: 267921
2016-04-28 19:30:41 +00:00
Rui Ueyama b29465fe47 Remove unused #include.
llvm-svn: 267222
2016-04-22 21:17:55 +00:00
Rui Ueyama 412c802bda Move BitcodeCompiler constructor to the .cpp file. NFC.
llvm-svn: 267221
2016-04-22 21:16:18 +00:00
Davide Italiano 3c0410d09d [LTO] Discard names for Values that are not global.
This is not on by default (but it might be in the future).
The knob to enable the optimization is -lto-discard-value-names.

llvm-svn: 266953
2016-04-21 04:46:22 +00:00
Duncan P. N. Exon Smith 28d8d04657 LTO: Adapt to LLVM API changes in r266713
llvm-svn: 266714
2016-04-19 04:57:40 +00:00
Rafael Espindola abf6c650ac Make CreateTargetMachine as small as possible.
It is a pity that we have to create a TargetMachine once per thread,
so at least make that code as small as possible.

llvm-svn: 266578
2016-04-17 23:20:08 +00:00
Duncan P. N. Exon Smith 2c66b23d79 LTO: Merge debug info types when linking bitcode
Make sure lld enables ODR type uniquing for debug info when invoking
LTO, as a follow-up to LLVM r266549.

llvm-svn: 266555
2016-04-17 07:35:38 +00:00
Davide Italiano bc176631cd [LTO] Implement parallel Codegen for LTO using splitCodeGen.
Parallelism level can be chosen using the new --lto-jobs=K option
where K is the number of threads used for CodeGen. It currently
defaults to 1.

llvm-svn: 266484
2016-04-15 22:38:10 +00:00
Davide Italiano 15c41b25c7 [LTO] Switch Module to std::unique_ptr<>.
Differential Revision:   http://reviews.llvm.org/D18994

llvm-svn: 266009
2016-04-11 22:39:51 +00:00
Rui Ueyama 01ddc06484 Make BitcodeCompiler::compile a non-template function. NFC.
llvm-svn: 264770
2016-03-29 19:08:46 +00:00
Davide Italiano 828ac541ef [LTO] Internalize symbols.
IPO doesn't work very well across symbols referenced
by others TUs. The linker here tries to evaluate
which symbols are safe to internalize and switches
their linkage.

Differential Revision:  http://reviews.llvm.org/D18415

llvm-svn: 264585
2016-03-28 15:44:21 +00:00
Rui Ueyama 961f2ff21e ELF: Split BitcodeCompiler::compile.
http://reviews.llvm.org/D18410

llvm-svn: 264193
2016-03-23 21:19:27 +00:00
Rui Ueyama 259924869b ELF: Create LTO.{cpp,h} and move LTO-related code to that file.
The code for LTO has been growing, so now is probably a good time to
move it to its own file. SymbolTable.cpp is for symbol table, and
because compiling bitcode files are semantically not a part of
symbol table, this is I think a good thing to do.

http://reviews.llvm.org/D18370

llvm-svn: 264091
2016-03-22 20:52:10 +00:00