summaryrefslogtreecommitdiffstats
path: root/tools/gold
Commit message (Collapse)AuthorAgeFilesLines
* Use emplace_back to replace size() and resize().Dehao Chen2017-07-101-1/+1
| | | | | | | | | | | | | | Summary: This speeds-up thin-link for ~29% for large programs. Reviewers: tejohnson Reviewed By: tejohnson Subscribers: grandinj, sanjoy, llvm-commits Differential Revision: https://reviews.llvm.org/D35145 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307543 91177308-0d34-0410-b5e6-96231b3b80d8
* Infer relocation model from module flags in relocatable LTO link.Evgeniy Stepanov2017-05-221-2/+4
| | | | | | Fix for PR33096. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303578 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-apply r299168 and r299169 now that the libdeps are fixed.Peter Collingbourne2017-03-311-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299184 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r299168 and r299169 due to library dependency issues.Peter Collingbourne2017-03-311-2/+2
| | | | | | http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/25073/steps/build_llvmclang/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299171 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO: Reduce memory consumption by creating an in-memory symbol table for ↵Peter Collingbourne2017-03-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | InputFiles. NFCI. Introduce symbol table data structures that can be potentially written to disk, have the LTO library build those data structures using temporarily constructed modules and redirect the LTO library implementation to go through those data structures. This allows us to remove the LLVMContext and Modules owned by InputFile. With this change I measured a peak memory consumption decrease from 5.4GB to 2.8GB in a no-op incremental ThinLTO link of Chromium on Linux. The impact on memory consumption is larger in COFF linkers where we are currently forced to materialize all metadata in order to read linker options. Peak memory consumption linking a large piece of Chromium for Windows with full LTO and debug info decreases from >64GB (OOM) to 15GB. Part of PR27551. Differential Revision: https://reviews.llvm.org/D31364 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299168 91177308-0d34-0410-b5e6-96231b3b80d8
* More accurate header inclusions. NFC.Peter Collingbourne2017-03-281-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298960 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO: Replace InputFile::Symbol::getFlags() with predicate accessors. NFC.Peter Collingbourne2017-03-281-6/+4
| | | | | | | This makes the predicates independent of the flag representation and makes the code a little easier to read. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298951 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO] Add support for emitting minimized bitcode for thin linkTeresa Johnson2017-03-231-4/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The cumulative size of the bitcode files for a very large application can be huge, particularly with -g. In a distributed build environment, all of these files must be sent to the remote build node that performs the thin link step, and this can exceed size limits. The thin link actually only needs the summary along with a bitcode symbol table. Until we have a proper bitcode symbol table, simply stripping the debug metadata results in significant size reduction. Add support for an option to additionally emit minimized bitcode modules, just for use in the thin link step, which for now just strips all debug metadata. I plan to add a cc1 option so this can be invoked easily during the compile step. However, care must be taken to ensure that these minimized thin link bitcode files produce the same index as with the original bitcode files, as these original bitcode files will be used in the backends. Specifically: 1) The module hash used for caching is typically produced by hashing the written bitcode, and we want to include the hash that would correspond to the original bitcode file. This is because we want to ensure that changes in the stripped portions affect caching. Added plumbing to emit the same module hash in the minimized thin link bitcode file. 2) The module paths in the index are constructed from the module ID of each thin linked bitcode, and typically is automatically generated from the input file path. This is the path used for finding the modules to import from, and obviously we need this to point to the original bitcode files. Added gold-plugin support to take a suffix replacement during the thin link that is used to override the identifier on the MemoryBufferRef constructed from the loaded thin link bitcode file. The assumption is that the build system can specify that the minimized bitcode file has a name that is similar but uses a different suffix (e.g. out.thinlink.bc instead of out.o). Added various tests to ensure that we get identical index files out of the thin link step. Reviewers: mehdi_amini, pcc Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D31027 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298638 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO: Fix a potential race condition in the caching API.Peter Collingbourne2017-03-171-2/+6
| | | | | | | | | | | | | | | | | | | | | After the call to sys::fs::exists succeeds, indicating a cache hit, we call AddFile and the client will open the file using the supplied path. If the client is using cache pruning, there is a potential race between the pruner and the client. To avoid this, change the caching API so that it provides a MemoryBuffer to the client, and have clients use that MemoryBuffer where possible. This scheme won't work with the gold plugin because the plugin API expects a file path. So we have the gold plugin use the buffer identifier as a path and live with the race for now. (Note that the gold plugin isn't actually affected by the problem at the moment because it doesn't support cache pruning.) This effectively reverts r279883 modulo the change to use the existing path in the gold plugin. Differential Revision: https://reviews.llvm.org/D31063 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298020 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO: When creating a local cache, create the cache directory if it does not ↵Peter Collingbourne2017-03-021-1/+1
| | | | | | | | already exist. Differential Revision: https://reviews.llvm.org/D30519 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296726 91177308-0d34-0410-b5e6-96231b3b80d8
* gold-plugin: Remove unused variable.Peter Collingbourne2017-02-281-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296533 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO] PrintStatistics when we exit early for thinlto-index-onlyTeresa Johnson2017-02-021-0/+3
| | | | | | | | | | | | | | Summary: This is necessary to get stats from the ThinLink printed before the early exit when compiling in a distributed build. Reviewers: mehdi_amini Subscribers: Prazek, llvm-commits Differential Revision: https://reviews.llvm.org/D29461 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293908 91177308-0d34-0410-b5e6-96231b3b80d8
* gold-plugin: Simplify naming of object files created with save-temps or ↵Peter Collingbourne2017-01-261-5/+4
| | | | | | | | | | obj-path. Now we never append a number to the file name for task ID 0. Differential Revision: https://reviews.llvm.org/D29160 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293132 91177308-0d34-0410-b5e6-96231b3b80d8
* gold-plugin: Add the file path to the file open error diagnostic.Peter Collingbourne2017-01-251-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293013 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass sample pgo flags to thinlto.Dehao Chen2016-12-161-0/+7
| | | | | | | | | | | | Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing. Reviewers: davidxl, mehdi_amini, tejohnson Subscribers: pcc, davide, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D27790 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289957 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply clang-tidy's 'performance-faster-string-find' check to LLVM.Benjamin Kramer2016-11-301-1/+1
| | | | | | No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288235 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix gold plugin after Error API changesMehdi Amini2016-11-111-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286571 91177308-0d34-0410-b5e6-96231b3b80d8
* Split Bitcode/ReaderWriter.h into separate reader and writer headersTeresa Johnson2016-11-111-1/+2
| | | | | | | | | | | | | | | | | | | | | Summary: Split ReaderWriter.h which contains the APIs into both the BitReader and BitWriter libraries into BitcodeReader.h and BitcodeWriter.h. This is to address Chandler's concern about sharing the same API header between multiple libraries (BitReader and BitWriter). That concern is why we create a single bitcode library in our downstream build of clang, which led to r286297 being reverted as it added a dependency that created a cycle only when there is a single bitcode library (not two as in upstream). Reviewers: mehdi_amini Subscribers: dlj, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D26502 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286566 91177308-0d34-0410-b5e6-96231b3b80d8
* Bitcode: Remove the remnants of the BitcodeDiagnosticInfo class.Peter Collingbourne2016-11-091-6/+0
| | | | | | | | | The BitcodeReader no longer produces BitcodeDiagnosticInfo diagnostics. The only remaining reference was in the gold plugin; the code there has been dead since we stopped producing InvalidBitcodeSignature error codes in r225562. While at it remove the InvalidBitcodeSignature error code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286326 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the LTO comdat api more symbol table friendly.Rafael Espindola2016-10-251-2/+4
| | | | | | | | | | | | | | | | | | | | | | In an IR symbol table I would expect the comdats to be represented as: - A table of strings, one for each comdat name. - Each symbol has an optional index into that table. The natural api for accessing that would be InputFile: ArrayRef<StringRef> getComdatTable() const; Symbol: int getComdatIndex() const; This patch implements an API as close to that as possible. The implementation on top of the current IRObjectFile is a bit hackish, but should map just fine over a symbol table and is very convenient to use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285061 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO] Default backend threads to heavyweight_hardware_concurrencyTeresa Johnson2016-10-191-2/+2
| | | | | | | | | | | | | | | | | Summary: Changes default backend parallelism from thread::hardware_concurrency to the new llvm::heavyweight_hardware_concurrency, which for X86 Linux defaults to the number of physical cores (and will fall back to thread::hardware_concurrency otherwise). This avoid oversubscribing the physical cores using hyperthreading. Reviewers: mehdi_amini, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D25775 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284618 91177308-0d34-0410-b5e6-96231b3b80d8
* Return a StringRef instead of a Comdat*.Rafael Espindola2016-10-171-3/+3
| | | | | | | This is a small step in making this interface compatible with an bitcode symbol table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284408 91177308-0d34-0410-b5e6-96231b3b80d8
* LTO: Simplify caching interface.Peter Collingbourne2016-09-231-30/+18
| | | | | | | | | | | | | | | | | The NativeObjectOutput class has a design problem: it mixes up the caching policy with the interface for output streams, which makes the client-side code hard to follow and would for example make it harder to replace the cache implementation in an arbitrary client. This change separates the two aspects by moving the caching policy to a separate field in Config, replacing NativeObjectOutput with a NativeObjectStream class which only deals with streams and does not need to be overridden by most clients and introducing an AddFile callback for adding files (e.g. from the cache) to the link. Differential Revision: https://reviews.llvm.org/D24622 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282299 91177308-0d34-0410-b5e6-96231b3b80d8
* [gold] Split plugin options controlling ThinLTO and codegen parallelism.Teresa Johnson2016-09-231-10/+11
| | | | | | | | | | | | | | | | Summary: As suggested in D24826, use different options for ThinLTO backend parallelism from the option controlling regular LTO code gen parallelism. They are already split in the LTO API, and this enables controlling them with different clang options. Reviewers: pcc, mehdi_amini Subscribers: dexonsmith, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D24873 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282290 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO] Emit files for distributed builds for all modulesTeresa Johnson2016-09-211-1/+38
| | | | | | | | | | | | | | | | | | | | With the new LTO API in r278338, we stopped emitting the individual index files and imports files for some modules in the distributed backend case (thinlto-index-only plugin option). Specifically, this is when the linker decides not to include a module in the link, because it was in an archive library and did not have a strong reference to it. Not creating the expected output files makes the distributed build system implementation more difficult, in terms of checking for the expected outputs of the thin link, and scheduling the backend jobs. To address this, the gold-plugin will write dummy empty .thinlto.bc and .imports files for modules not included in the link (which LTO never sees). Augmented a gold v1.12+ test, since that version of gold has the handling for notifying on modules not being included in the link. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282100 91177308-0d34-0410-b5e6-96231b3b80d8
* gold: Simplify. Do not unnecessarily enumerate Obj's symbols.Peter Collingbourne2016-09-141-6/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281437 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO] Move loading of cache entry to clientTeresa Johnson2016-08-261-4/+3
| | | | | | | | | | | | | | | | | | | | | | Summary: Have the cache pass back the path to the cache entry when it is ready to be loaded, instead of a buffer. For gold-plugin we can simply pass this file back to gold directly, which avoids expensive writing of a separate tmp file. Ensure the cache entry is not deleted on cleanup by adjusting the setting of the IsTemporary flags. Moved the loading of the buffer into llvm-lto2 to maintain current behavior. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23946 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279883 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Add caching support to gold-pluginTeresa Johnson2016-08-241-2/+14
| | | | | | | | | | | | | | Summary: With support now in the new LTO API for caching (r279576), add optional ThinLTO caching in the gold-plugin. Reviewers: mehdi_amini Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23836 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279631 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix Gold Plugin after API change in the LTO API (constify callback type)Mehdi Amini2016-08-221-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279440 91177308-0d34-0410-b5e6-96231b3b80d8
* [LTO] Handles commons in monolithic LTOMehdi Amini2016-08-221-58/+1
| | | | | | | | | The gold-plugin was doing this internally, now the API is handling commons correctly based on the given resolution. Differential Revision: https://reviews.llvm.org/D23739 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279417 91177308-0d34-0410-b5e6-96231b3b80d8
* [gold/ThinLTO] Restore ThinLTO file management in gold pluginTeresa Johnson2016-08-201-1/+10
| | | | | | | | | | | | | | | | | | Summary: The gold-plugin changes added along with the new LTO API in r278338 had the effect of removing the management of the PluginInputFile that ensured the files weren't released back to gold until the backend threads were complete. Add back the old file handling. Fixes PR29020. Reviewers: mehdi_amini Subscribers: mehdi_amini, llvm-commits, hjl.tools Differential Revision: https://reviews.llvm.org/D23721 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279356 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO] Keep common symbols in ThinLTO modulesTeresa Johnson2016-08-181-1/+4
| | | | | | | | | | | | | | | | | | | | Summary: Skip the merging of common symbols for ThinLTO modules, they will be merged by the final native object link. Trying to merge the symbols and add to a combined module will incorrectly enable the common symbol to be internalized in the ThinLTO module. Additionally, we will not want to create a combined module for ThinLTO distributed builds. This fixes failures in 7 cpu2006 benchmarks from the new LTO API in ThinLTO mode. Reviewers: mehdi_amini Subscribers: pcc, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23637 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279023 91177308-0d34-0410-b5e6-96231b3b80d8
* [LTO] Change addSaveTemps API: do not add dot to the supplied prefix pathMehdi Amini2016-08-181-1/+2
| | | | | | | | | | | | | | | | Summary: It does not play well with directories (end up with a bunch of hidden files). Also, do not strip the 0 suffix for the first task, especially since 0 can be used by ThinLTO as well now. Reviewers: tejohnson Subscribers: mehdi_amini, pcc, llvm-commits Differential Revision: https://reviews.llvm.org/D23612 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279014 91177308-0d34-0410-b5e6-96231b3b80d8
* [LTO] Introduce an Output class to wrap the output stream creation (NFC)Mehdi Amini2016-08-171-20/+31
| | | | | | | | | | | | | | | | | Summary: While NFC for now, this will allow more flexibility on the client side to hold state necessary to back up the stream. Also when adding caching, this class will grow in complexity. Note I blindly modified the gold-plugin as I can't compile it. Reviewers: tejohnson Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D23542 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278907 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "gold: add a cast to appease std::max NFC"Saleem Abdulrasool2016-08-141-2/+1
| | | | | | This was fixed differently by Teresa and this should no longer be needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278622 91177308-0d34-0410-b5e6-96231b3b80d8
* gold: add a cast to appease std::max NFCSaleem Abdulrasool2016-08-121-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278567 91177308-0d34-0410-b5e6-96231b3b80d8
* Restore "Resolution-based LTO API."Teresa Johnson2016-08-111-944/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This restores commit r278330, with fixes for a few bot failures: - Fix a late change I had made to the save temps output file that I missed due to existing files sitting on my disk - Fix a bunch of Windows bot failures with "ambiguous call to overloaded function" due to confusion between llvm::make_unique vs std::make_unique (preface the new make_unique calls with "llvm::") - Attempt to fix a modules bot failure by adding a missing include to LTO/Config.h. Original change: Resolution-based LTO API. Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278338 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Resolution-based LTO API."Teresa Johnson2016-08-111-227/+944
| | | | | | | | | | This reverts commit r278330. I made a change to the save temps output that is causing issues with the bots. Didn't realize this because I had older output files sitting on disk in my test output directory. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278331 91177308-0d34-0410-b5e6-96231b3b80d8
* Resolution-based LTO API.Teresa Johnson2016-08-111-944/+227
| | | | | | | | | | | | | | | | | | | | | | Summary: This introduces a resolution-based LTO API. The main advantage of this API over existing APIs is that it allows the linker to supply a resolution for each symbol in each object, rather than the combined object as a whole. This will become increasingly important for use cases such as ThinLTO which require us to process symbol resolutions in a more complicated way than just adjusting linkage. Patch by Peter Collingbourne. Reviewers: rafael, tejohnson, mehdi_amini Subscribers: lhames, tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D20268 Address review comments git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@278330 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Support for getting list of included objects from goldTeresa Johnson2016-07-221-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In the distributed backend case, the ThinLink step and the final native object link are separate processes. This can be problematic when archive libraries are involved in the link (e.g. via --start-lib/--end-lib pairs). The linker only includes objects from libraries when there is a strong reference to them, and depending on the intervening ThinLTO backend processes' importing/inlining, the strong references may appear different in the two link steps. See D22356 and D22467 for two scenarios where this causes issues. To ensure that the final link includes the same objects, this patch adds support for an "=filename" form of the thinlto-index-only plugin option, in which case objects gold included in the link are emitted to the given filename. This should be used as input to the final link (e.g. via the @filename option to gold), instead of listing all the objects within --start-lib/--end-lib pairs again. Note that the support for the gold callback that identifies included objects was added in gold version 1.12. Reviewers: davidxl, mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D22677 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276450 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Perform index-based weak/linkonce resolutionTeresa Johnson2016-07-141-17/+33
| | | | | | | | | | | | | | | | | | | | Summary: Invoke the weak/linkonce symbol resolution support (already used by libLTO) that operates via the summary index. This ensures prevailing linkonce are kept, by making them weak, and marks preempted copies as available_externally when possible. With this change, the older support for keeping the prevailing linkonce (by changing their symbol resolution) is removed. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D22302 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275474 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Enable symbol resolution in distributed backend caseTeresa Johnson2016-07-131-5/+0
| | | | | | | | | | | | | | | | While testing a follow-on change to enable index-based symbol resolution and internalization in the distributed backends, I realized that a test case change I made in r275247 was only required because we were not analyzing symbols in the claimed files in thinlto-index-only mode. In the fixed test case there should be no internalization because we are linking in -shared mode, so f() is in fact exported, which is detected properly when we analyze symbols in thinlto-index-only mode. Note that this is not (yet) a correctness issue (because we are not yet performing the index-based linkage optimizations in the distributed backends - that's coming in a follow-on patch). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275277 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] ThinLTO internalization fixesTeresa Johnson2016-07-131-16/+9
| | | | | | | | | | | Internalization was missing cases where we originally had a local symbol that was promoted eagerly but not actually exported. This is because we were only internalizing the set of global (non-local) symbols that were PREVAILAING_DEF_IRONLY. Instead, collect the set of global symbols that are referenced outside of a single IR file, and skip internalization for those. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275247 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use the new x86 relax relocations on the gold plugin.Rafael Espindola2016-06-171-0/+4
| | | | | | Should bring back the bots with old versions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273022 91177308-0d34-0410-b5e6-96231b3b80d8
* IR: Introduce local_unnamed_addr attribute.Peter Collingbourne2016-06-141-26/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a local_unnamed_addr attribute is attached to a global, the address is known to be insignificant within the module. It is distinct from the existing unnamed_addr attribute in that it only describes a local property of the module rather than a global property of the symbol. This attribute is intended to be used by the code generator and LTO to allow the linker to decide whether the global needs to be in the symbol table. It is possible to exclude a global from the symbol table if three things are true: - This attribute is present on every instance of the global (which means that the normal rule that the global must have a unique address can be broken without being observable by the program by performing comparisons against the global's address) - The global has linkonce_odr linkage (which means that each linkage unit must have its own copy of the global if it requires one, and the copy in each linkage unit must be the same) - It is a constant or a function (which means that the program cannot observe that the unique-address rule has been broken by writing to the global) Although this attribute could in principle be computed from the module contents, LTO clients (i.e. linkers) will normally need to be able to compute this property as part of symbol resolution, and it would be inefficient to materialize every module just to compute it. See: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160509/356401.html http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160516/356738.html for earlier discussion. Part of the fix for PR27553. Differential Revision: http://reviews.llvm.org/D20348 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272709 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Enable summary-based internalizationTeresa Johnson2016-06-091-12/+71
| | | | | | | | | | | | Summary: Enable existing summary-based importing support in the gold-plugin. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: http://reviews.llvm.org/D21080 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272239 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Pass import lists by reference (NFC)Teresa Johnson2016-06-031-1/+1
| | | | | | | In my earlier patch r271690 I missed passing a map by reference in one place. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271732 91177308-0d34-0410-b5e6-96231b3b80d8
* [ThinLTO/gold] Pass down the imports lists from the thin link (NFC)Teresa Johnson2016-06-031-31/+30
| | | | | | No longer need to compute the imports in each backend thread. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271690 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply clang-tidy's misc-move-constructor-init throughout LLVM.Benjamin Kramer2016-05-271-2/+4
| | | | | | No functionality change intended, maybe a tiny performance improvement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270997 91177308-0d34-0410-b5e6-96231b3b80d8
* Linker: teach the IR mover to return llvm::Error.Peter Collingbourne2016-05-271-11/+12
| | | | | | | | | This will be needed in order to consistently return an Error to clients of the API being developed in D20268. Differential Revision: http://reviews.llvm.org/D20550 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270967 91177308-0d34-0410-b5e6-96231b3b80d8