summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LTO.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* ELF: Simplify naming of object files created with save-temps.Peter Collingbourne2017-01-261-1/+1
| | | | | | | | Now we never append a number to the file name for task ID 0. This is similar to r293132 in the gold plugin. llvm-svn: 293138
* Remove error(error_code, const Twine &).Rui Ueyama2017-01-121-1/+1
| | | | | | Now we have the consistent interface for all log/warn/error/fatal functions. llvm-svn: 291847
* [ELF] Add support for thunks to undefined non-weak symbolsPeter Smith2017-01-041-5/+10
| | | | | | | | | | | | In a shared library an undefined symbol is implicitly imported. If the symbol is called as a function a PLT entry is generated for it. When the caller is a Thumb b.w a thunk to the PLT entry is needed as all PLT entries are in ARM state. This change allows undefined symbols to have thunks in the same way that shared symbols may have thunks. llvm-svn: 290951
* Introduce StringRefZ class to represent null-terminated strings.Rui Ueyama2016-11-291-2/+2
| | | | | | | | | | | | | | StringRefZ is a class to represent a null-terminated string. String length is computed lazily, so it's more efficient than StringRef to represent strings in string table. The motivation of defining this new class is to merge functions that only differ in string types; we have many constructors that takes `const char *` or `StringRef`. With StringRefZ, we can merge them. Differential Revision: https://reviews.llvm.org/D27037 llvm-svn: 288172
* [ELF] Be compliant with LLVM and rename Lto into LTO. NFCI.Davide Italiano2016-11-261-10/+10
| | | | llvm-svn: 287967
* [LTO] Remove a check on datalayout.Davide Italiano2016-11-221-3/+0
| | | | | | | | Now that lld switched to lib/LTO, which always calls setDataLayout(), we don't need this check anymore. Thanks to Peter for pointing out! llvm-svn: 287699
* Prevent at compile time converting from Error::success() to Expected<T>Mehdi Amini2016-11-111-1/+1
| | | | | | | | This would trigger an assertion at runtime otherwise. Differential Revision: https://reviews.llvm.org/D26482 llvm-svn: 286562
* Create a vector containing all input sections.Rui Ueyama2016-11-051-1/+1
| | | | | | | | | | | | | | | | Previously, we do this piece of code to iterate over all input sections. for (elf::ObjectFile<ELFT> *F : Symtab.getObjectFiles()) for (InputSectionBase<ELFT> *S : F->getSections()) It turned out that this mechanisms doesn't work well with synthetic input sections because synthetic input sections don't belong to any input file. This patch defines a vector that contains all input sections including synthetic ones. llvm-svn: 286051
* Fix some Clang-tidy modernize-use-default and Include What You Use warnings; ↵Eugene Zelenko2016-11-051-2/+20
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D26320 llvm-svn: 286030
* Consolidate BumpPtrAllocators.Rui Ueyama2016-10-281-2/+1
| | | | | | | | | | | 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
* Reduce the number of allocators.Rafael Espindola2016-10-261-1/+2
| | | | | | | | | | 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
* [ELF] - Applied clang format. NFC.George Rimar2016-10-201-1/+1
| | | | llvm-svn: 284705
* [LTO] Split the options for ThinLTO jobs and Regular LTO partitionsDavide Italiano2016-10-101-3/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D25452 llvm-svn: 283817
* [LTO/Thin] Make the number of threads to run in the BE configurable.Davide Italiano2016-10-101-1/+3
| | | | | | | Before the default was whatever number hardware_concurrency() returned. Users can specify the number of threads via --lto-jobs=X option. llvm-svn: 283787
* Remove HasError check after lto::LTO::run.Rui Ueyama2016-09-291-8/+3
| | | | | | | Because LTO::run doesn't change HasError, it doesn't make sense to check that value. llvm-svn: 282801
* Remove a return type that can be trivially easily.Rui Ueyama2016-09-291-2/+1
| | | | llvm-svn: 282795
* Rename "void check(Error)".Rui Ueyama2016-09-291-3/+10
| | | | | | | | | We have a few "check" functions in Error.h. All of them are to check for an error and strip an error object if there was no error, except "void check(Error E)", which doesn't return anything. This patch renames it and moves it to the .cpp file where it is used. llvm-svn: 282764
* Rename warning -> warn.Rui Ueyama2016-09-291-1/+1
| | | | | | It's better because it's a verb. llvm-svn: 282763
* Remove unused #includes.Rui Ueyama2016-09-291-21/+0
| | | | llvm-svn: 282668
* [LTO] Fully qualify make_unique to make MSVC happy.Davide Italiano2016-09-291-1/+1
| | | | llvm-svn: 282662
* [ELF/LTO] Switch to the new resolution-based API.Davide Italiano2016-09-291-251/+79
| | | | | | Differential Revision: https://reviews.llvm.org/D24492 llvm-svn: 282656
* [LTO] Add a test for invalid alias analysis pipelines.Davide Italiano2016-09-241-1/+1
| | | | | | | | I found out this wasn't tested when looking at Vedant's coverage bot numbers, so, thanks to him. While I'm here, switch the error message to be lld-compliant (first letter lowercase). llvm-svn: 282335
* Simplify InputFile ownership management.Rui Ueyama2016-09-141-3/+3
| | | | | | | | | | | | | | | | | | | | 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
* Internalize common variables.Rafael Espindola2016-08-311-3/+6
| | | | | | | | | | | Before this lld was always creating common symbols itself. It worked, but prevented them from being internalized when possible. Now it preserves common symbols is the bitcode and they are internalized. Fixes pr30184. llvm-svn: 280242
* Delete DefinedBitcode.Rafael Espindola2016-08-311-2/+4
| | | | | | | Given that we almost always want to handle it as DefinedRegular, just use DefinedRegular. llvm-svn: 280226
* [LTO] Simplify unnamed_addr handling logic. NFCI.Davide Italiano2016-08-311-6/+3
| | | | llvm-svn: 280224
* [LTO] Fix the logic for dropping unnamed_addr.Davide Italiano2016-08-301-0/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D24037 llvm-svn: 280144
* Add a pointer to a source file to SymbolBody.Rui Ueyama2016-07-171-2/+3
| | | | | | | | | | | | Previously, each subclass of SymbolBody had a pointer to a source file from which it was created. So, there was no single way to get a source file for a symbol. We had getSourceFile<ELFT>(), but the function was a bit inconvenient as it's a template. This patch makes SymbolBody have a pointer to a source file. If a symbol is not created from a file, the pointer has a nullptr. llvm-svn: 275701
* Remove redundant namespace specifiers.Rui Ueyama2016-07-161-4/+4
| | | | llvm-svn: 275694
* ELF: Remove member variables that are used only in one function.Rui Ueyama2016-07-151-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D22396 llvm-svn: 275526
* Inline a vairable that is used only once. NFC.Rui Ueyama2016-07-151-6/+4
| | | | llvm-svn: 275524
* ELF: Simplify path constructions for -save-temps. NFC.Rui Ueyama2016-07-151-14/+16
| | | | llvm-svn: 275523
* ELF: Make check() always return a value.Rui Ueyama2016-07-151-8/+10
| | | | | | This patch corresponds to r275511 for COFF. llvm-svn: 275521
* ELF: Update #include path for D22173.Peter Collingbourne2016-07-141-1/+1
| | | | llvm-svn: 275477
* [LTO] Update after API change in LLVM. NFC.Davide Italiano2016-06-221-1/+1
| | | | llvm-svn: 273462
* [LTO] Include ASM undefs in llvm.compiler_used.Davide Italiano2016-06-221-4/+27
| | | | | | | | | 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
* Revert "Revert "Add a test showing that lto produces relaxable relocations.""Rafael Espindola2016-06-211-0/+4
| | | | | | | | This reverts commit r273247. lld should always use the new relocations. llvm-svn: 273266
* Merge two if(s) into one, simplifying the code.Davide Italiano2016-06-111-5/+1
| | | | llvm-svn: 272475
* [LTO] Add --lto-aa-pipeline.Davide Italiano2016-06-021-0/+7
| | | | | | Differential Revision: http://reviews.llvm.org/D20888 llvm-svn: 271605
* [LTO] Fix (incorrect) TLS attribute mismatch.Davide Italiano2016-06-011-1/+1
| | | | | | | | | When we undefine, we also preserve type of symbol so that we get it right in the combined LTO object. Differential Revision: http://reviews.llvm.org/D20851 llvm-svn: 271403
* Update LLD for D20550.Peter Collingbourne2016-05-271-2/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D20704 llvm-svn: 270968
* Sort includes, and don't look into system headers.Davide Italiano2016-05-151-1/+1
| | | | llvm-svn: 269607
* [LTO] Add the ability to specify a subset of passes to run.Davide Italiano2016-05-151-4/+61
| | | | | | Differential Revision: http://reviews.llvm.org/D20267 llvm-svn: 269605
* Move undefine to a separate function.Peter Collingbourne2016-05-121-1/+5
| | | | llvm-svn: 269331
* [LTO] Don't crash on old DebugInfo.Davide Italiano2016-05-111-0/+5
| | | | | | Drop them and produce a graceful warning instead. llvm-svn: 269149
* ELF: Undefine all symbols, not just those that we expect to be defined.Peter Collingbourne2016-05-051-22/+21
| | | | | | | | | | | | | | This allows the combined LTO object to provide a definition with the same name as a symbol that was internalized without causing a duplicate symbol error. This normally happens during parallel codegen which externalizes originally-internal symbols, for example. In order to make this work, I needed to relax the undefined symbol error to only report an error for symbols that are used in regular objects. Differential Revision: http://reviews.llvm.org/D19954 llvm-svn: 268649
* ELF: New symbol table design.Peter Collingbourne2016-05-011-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements a new design for the symbol table that stores SymbolBodies within a memory region of the Symbol object. Symbols are mutated by constructing SymbolBodies in place over existing SymbolBodies, rather than by mutating pointers. As mentioned in the initial proposal [1], this memory layout helps reduce the cache miss rate by improving memory locality. Performance numbers: old(s) new(s) Without debug info: chrome 7.178 6.432 (-11.5%) LLVMgold.so 0.505 0.502 (-0.5%) clang 0.954 0.827 (-15.4%) llvm-as 0.052 0.045 (-15.5%) With debug info: scylla 5.695 5.613 (-1.5%) clang 14.396 14.143 (-1.8%) Performance counter results show that the fewer required indirections is indeed the cause of the improved performance. For example, when linking chrome, stalled cycles decreases from 14,556,444,002 to 12,959,238,310, and instructions per cycle increases from 0.78 to 0.83. We are also executing many fewer instructions (15,516,401,933 down to 15,002,434,310), probably because we spend less time allocating SymbolBodies. The new mechanism by which symbols are added to the symbol table is by calling add* functions on the SymbolTable. In this patch, I handle local symbols by storing them inside "unparented" SymbolBodies. This is suboptimal, but if we do want to try to avoid allocating these SymbolBodies, we can probably do that separately. I also removed a few members from the SymbolBody class that were only being used to pass information from the input file to the symbol table. This patch implements the new design for the ELF linker only. I intend to prepare a similar patch for the COFF linker. [1] http://lists.llvm.org/pipermail/llvm-dev/2016-April/098832.html Differential Revision: http://reviews.llvm.org/D19752 llvm-svn: 268178
* Use a single context for lto.Rafael Espindola2016-04-281-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Sort includes. NFC.Rafael Espindola2016-04-271-1/+1
| | | | llvm-svn: 267821
* LTO: Merge -lto-no-discard-value-names with -save-temps.Rui Ueyama2016-04-221-1/+5
| | | | | | | | | | This patch is to remove -lto-no-discard-value-names flag and instead to use -save-temps as we discussed in the post-commit review thread for r267020. Differential Revision: http://reviews.llvm.org/D19437 llvm-svn: 267230
OpenPOWER on IntegriCloud