Commit Graph

23 Commits

Author SHA1 Message Date
Rui Ueyama 55518e7dd8 Consolidate BumpPtrAllocators.
Previously, we have a lot of BumpPtrAllocators, but all these
allocators virtually have the same lifetime because they are
not freed until the linker finishes its job. This patch aggregates
them into a single allocator.

Differential revision: https://reviews.llvm.org/D26042

llvm-svn: 285452
2016-10-28 20:57:25 +00:00
Rafael Espindola 5da1d88492 Reduce the number of allocators.
We used to have one allocator per file, which reduces the advantage of
using an allocator in the first place.

This is a small speed up is most cases. The largest speedup was in
1.014X in chromium no-gc. The largest slowdown was scylla at 1.003X.

llvm-svn: 285205
2016-10-26 15:34:24 +00:00
Rui Ueyama 1cc007aeae Keep a private member private.
llvm-svn: 282798
2016-09-29 22:37:45 +00:00
Rui Ueyama 0f327380bf Attempt to fix Windows buildbots.
llvm-svn: 282670
2016-09-29 01:59:03 +00:00
Rui Ueyama e8b2df47a3 Remove unused #includes.
llvm-svn: 282668
2016-09-29 01:45:22 +00:00
Davide Italiano 786d8e33db [ELF/LTO] Switch to the new resolution-based API.
Differential Revision:  https://reviews.llvm.org/D24492

llvm-svn: 282656
2016-09-29 00:40:08 +00:00
Rui Ueyama 38dbd3eea9 Simplify InputFile ownership management.
Previously, all input files were owned by the symbol table.
Files were created at various places, such as the Driver, the lazy
symbols, or the bitcode compiler, and the ownership of new files
was transferred to the symbol table using std::unique_ptr.
All input files were then free'd when the symbol table is freed
which is on program exit.

I think we don't have to transfer ownership just to free all
instance at once on exit.

In this patch, all instances are automatically collected to a
vector and freed on exit. In this way, we no longer have to
use std::unique_ptr.

Differential Revision: https://reviews.llvm.org/D24493

llvm-svn: 281425
2016-09-14 00:05:51 +00:00
Rui Ueyama 601b07c7f5 ELF: Remove member variables that are used only in one function.
Differential Revision: https://reviews.llvm.org/D22396

llvm-svn: 275526
2016-07-15 03:06:42 +00:00
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