summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
Commit message (Collapse)AuthorAgeFilesLines
...
* ThinLTOCodeGenerator: handle cases where temporary files can't be renamedMehdi Amini2016-05-141-2/+6
| | | | | | | For instance when they're on different filesystem. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 269544
* ThinLTOCodeGenerator: handle std::error_code instead of silently dropping it.Mehdi Amini2016-05-141-1/+5
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 269541
* [ThinLTO] Add option to emit imports files for distributed backendsTeresa Johnson2016-05-101-0/+24
| | | | | | | | | | | | | | | | | | | | | Summary: Add support for emission of plaintext lists of the imported files for each distributed backend compilation. Used for distributed build file staging. Invoked with new gold-plugin thinlto-emit-imports-files option, which is only valid with thinlto-index-only (i.e. for distributed builds), or from llvm-lto with new -thinlto-action=emitimports value. Depends on D19556. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19636 llvm-svn: 269067
* Restore "[ThinLTO] Emit individual index files for distributed backends"Teresa Johnson2016-05-101-0/+23
| | | | | | | | | | | | | | | | | | | This restores commit r268627: Summary: When launching ThinLTO backends in a distributed build (currently supported in gold via the thinlto-index-only plugin option), emit an individual index file for each backend process as described here: http://lists.llvm.org/pipermail/llvm-dev/2016-April/098272.html ... Differential Revision: http://reviews.llvm.org/D19556 Address msan failures by avoiding std::prev on map.end(), the theory is that this is causing issues due to some known UB problems in __tree. llvm-svn: 269059
* Allow the LTO code generator to strip invalid debug info from the input.Adrian Prantl2016-05-091-0/+20
| | | | | | | | | | | | | | | | | | | | | This patch introduces a new option -lto-strip-invalid-debug-info, which drops malformed debug info from the input. The problem I'm trying to solve with this sequence of patches is that historically we've done a really bad job at verifying debug info. We want to be able to make the verifier stricter without having to worry about breaking bitcode compatibility with existing producers. For example, we don't necessarily want IR produced by an older version of clang to be rejected by an LTO link just because of malformed debug info, and rather provide an option to strip it. Note that merely outdated (but well-formed) debug info would continue to be auto-upgraded in this scenario. rdar://problem/25818489 http://reviews.llvm.org/D19987 This reapplies 268936 with a test case fix for Linux (-exported-symbol foo) llvm-svn: 268965
* Revert "Allow the LTO code generator to strip invalid debug info from the ↵Adrian Prantl2016-05-091-20/+0
| | | | | | | | input." This reverts commit 268936 while investigating buildbot breakage. llvm-svn: 268940
* Allow the LTO code generator to strip invalid debug info from the input.Adrian Prantl2016-05-091-0/+20
| | | | | | | | | | | | | | | | | | | This patch introduces a new option -lto-strip-invalid-debug-info, which drops malformed debug info from the input. The problem I'm trying to solve with this sequence of patches is that historically we've done a really bad job at verifying debug info. We want to be able to make the verifier stricter without having to worry about breaking bitcode compatibility with existing producers. For example, we don't necessarily want IR produced by an older version of clang to be rejected by an LTO link just because of malformed debug info, and rather provide an option to strip it. Note that merely outdated (but well-formed) debug info would continue to be auto-upgraded in this scenario. rdar://problem/25818489 http://reviews.llvm.org/D19987 llvm-svn: 268936
* [PM] Port Interprocedural SCCP to the new pass manager.Davide Italiano2016-05-051-1/+1
| | | | llvm-svn: 268684
* Revert "LTOCodeGenerator: handle correctly "unnamed" symbol"Mehdi Amini2016-05-051-1/+1
| | | | | | | | | | This reverts commit r268658. I incorrectly diagnose this as the source of an assertion during an LTO bootstrap of clang. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 268680
* Degrade assertions to a warning in LTOCodeGenerator for preserved linkonceMehdi Amini2016-05-051-2/+19
| | | | | | | | | | The assertions were assuming that the linker will not ask to preserve a global that is internal or available_externally, as it does not really make sense. In practice this break the bootstrap of clang, I degrade to a warning for now. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 268671
* Revert "[ThinLTO] Emit individual index files for distributed backends"Vitaly Buka2016-05-051-23/+0
| | | | | | | | | MemorySanitizer: use-of-uninitialized-value in lib/Bitcode/Writer/BitcodeWriter.cpp:364:70 http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/12544/steps/check-llvm%20msan/logs/stdio This reverts commit 0c4a898ea550699d1b2f4fe3767251c8f9a48d52. llvm-svn: 268660
* LTOCodeGenerator: handle correctly "unnamed" symbolMehdi Amini2016-05-051-1/+1
| | | | | | | This should fix the assertions in a clang LTO bootstrap we're seeing. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 268658
* [ThinLTO] Emit individual index files for distributed backendsTeresa Johnson2016-05-051-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When launching ThinLTO backends in a distributed build (currently supported in gold via the thinlto-index-only plugin option), emit an individual index file for each backend process as described here: http://lists.llvm.org/pipermail/llvm-dev/2016-April/098272.html The individual index file encodes the summary and module information required for implementing the importing/exporting decisions made for a given module in the thin link step. This is in place of the current mechanism that uses the combined index to make importing decisions in each back end independently. It is an enabler for doing global summary based optimizations in the thin link step (which will be recorded in the individual index files), and reduces the size of the index that must be sent to each backend process, and the amount of work to scan it in the backends. Rather than create entirely new ModuleSummaryIndex structures (and all the included unique_ptrs) for each backend index file, a map is created to record all of the GUID and summary pointers needed for a particular index file. The IndexBitcodeWriter walks this map instead of the full index (hiding the details of managing the appropriate summary iteration in a new iterator subclass). This is more efficient than walking the entire combined index and filtering out just the needed summaries during each backend bitcode index write. Depends on D19481. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19556 llvm-svn: 268627
* LTOCodeGenerator: add linkonce(_odr) to "llvm.compiler.used" when present in ↵Mehdi Amini2016-05-051-17/+67
| | | | | | | | | | | | | | | "MustPreserve" set If the linker requested to preserve a linkonce function, we should honor this even if we drop all uses. We explicitely avoid turning them into weak_odr (unlike the first version of this patch in r267644), because the codegen can be different on Darwin: because of `llvm::canBeOmittedFromSymbolTable()` we may emit the symbol as weak_def_can_be_hidden instead of weak_definition. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 268607
* Revert "LTOCodeGenerator: turns linkonce(_odr) into weak_(odr) when present ↵Mehdi Amini2016-05-051-52/+19
| | | | | | | | | | | | "MustPreserve" set" This reverts commit r267644. Turning linkonce_odr into weak_odr is a sementic change on Darwin: because of `llvm::canBeOmittedFromSymbolTable()` we may emit the symbol as weak_def_can_be_hidden instead of weak_definition. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 268606
* ThinLTOCodeGenerator: remove useless temporary file that was emitted.Mehdi Amini2016-05-051-7/+4
| | | | | | | | This was a remaining of a previous scheme where some IPOs were taking place before we enter this code. This is not relevant anymore. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 268605
* [PM] Port ConstantMerge to the new pass manager.Davide Italiano2016-05-051-1/+1
| | | | llvm-svn: 268582
* [IPO/GlobalDCE] Port to the new pass manager.Davide Italiano2016-05-031-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D19782 llvm-svn: 268425
* LTO: Don't bother trying to mangle unnamed globals, as they can't be ↵Peter Collingbourne2016-04-271-0/+4
| | | | | | | | | | | | | | preserved with MustPreserveSymbols. Summary: Should fix sanitizer-windows bot. Reviewers: joker.eph Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19635 llvm-svn: 267820
* Clean up to avoid compiler warnings for casting away const qualifiers.Sjoerd Meijer2016-04-271-3/+3
| | | | | | Differential Revision: http://reviews.llvm.org/D19598 llvm-svn: 267753
* Revert "Support "preserving" the summary information when using setModule() ↵Mehdi Amini2016-04-271-8/+1
| | | | | | | | | | API in LTOCodeGenerator" This reverts commit r267665. ASAN shows that there is a use of undefined value. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267668
* Support "preserving" the summary information when using setModule() API in ↵Mehdi Amini2016-04-271-1/+8
| | | | | | | | | LTOCodeGenerator Another attempt at r267655... From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267665
* Revert "Support "preserving" the summary information when using setModule() ↵Mehdi Amini2016-04-271-8/+1
| | | | | | | | | | API in LTOCodeGenerator" This reverts commit r267657, r267656, and r267655. The test does not pass on multiple bots, I'm unsure why yet but let's unbreak them. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267664
* Support "preserving" the summary information when using setModule() API in ↵Mehdi Amini2016-04-271-1/+8
| | | | | | | LTOCodeGenerator From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267655
* LTOCodeGenerator: turns linkonce(_odr) into weak_(odr) when present ↵Mehdi Amini2016-04-271-19/+48
| | | | | | | | | | | | | | | | | "MustPreserve" set Summary: If the linker requested to preserve a linkonce function, we should honor this even if we drop all uses. Reviewers: dexonsmith Subscribers: llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D19527 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267644
* PM: Port Internalize to the new pass managerJustin Bogner2016-04-261-1/+1
| | | | llvm-svn: 267596
* ThinLTOCodeGenerator: preserve linkonce when in "MustPreserved" setMehdi Amini2016-04-261-4/+10
| | | | | | | | | If the linker specifically requested for a linkonce to be preserved, we need to make sure we won't drop it even if all the uses in the current module disappear. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267543
* PM: Port GlobalOpt to the new pass managerJustin Bogner2016-04-261-1/+1
| | | | llvm-svn: 267499
* [ThinLTO] Introduce typedef for commonly-used map type (NFC)Teresa Johnson2016-04-251-11/+6
| | | | | | | | Add a typedef for the std::map<GlobalValue::GUID, GlobalValueSummary *> map that is passed around to identify summaries for values defined in a particular module. This shortens up declarations in a variety of places. llvm-svn: 267471
* [ThinLTO] Remove GlobalValueInfo class from indexTeresa Johnson2016-04-241-11/+13
| | | | | | | | | | | | | | | | Summary: Remove the GlobalValueInfo and change the ModuleSummaryIndex to directly reference summary objects. The info structure was there to support lazy parsing of the combined index summary objects, which is no longer needed and not supported. Reviewers: joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19462 llvm-svn: 267344
* Add an internalization step to the ThinLTOCodeGeneratorMehdi Amini2016-04-241-18/+151
| | | | | | | | | | | | | Keeping as much as possible internal/private is known to help the optimizer. Let's try to benefit from this in ThinLTO. Note: this is early work, but is enough to build clang (and all the LLVM tools). I still need to write some lit-tests... Differential Revision: http://reviews.llvm.org/D19103 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 267317
* PM: Port DCE to the new pass managerJustin Bogner2016-04-221-1/+1
| | | | | | | Also add a very basic test, since apparently there aren't any tests for DCE whatsoever to add the new pass version to. llvm-svn: 267196
* [ThinLTO] Remove unused/incomplete lazy summary reading support (NFC)Teresa Johnson2016-04-221-1/+1
| | | | | | | | | | | | | | This removes the interfaces added (and not yet complete) to support lazy reading of summaries. This support is not expected to be needed since we are moving to a model where the full index is only being traversed in the thin link step, instead of the back ends. (The second part of this that I plan to do next is remove the GlobalValueInfo from the ModuleSummaryIndex - it was mostly needed to support lazy parsing of summaries. The index can instead reference the summary structures directly.) llvm-svn: 267097
* ThinLTO: add module caching handling.Mehdi Amini2016-04-211-11/+148
| | | | | | | Differential Revision: http://reviews.llvm.org/D18494 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266959
* ThinLTO: Resolve linkonce_odr aliases just like functionsMehdi Amini2016-04-211-11/+38
| | | | | | | | | | | | This help to streamline the process of handling importing since we don't need to special case alias everywhere: just like linkonce_odr function, make sure at least one alias is emitted by turning it weak. Differential Revision: http://reviews.llvm.org/D19308 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266958
* LTO: Verify the input even if optimize() isn't calledDuncan P. N. Exon Smith2016-04-201-2/+24
| | | | | | | | | | | | | | Clients may call writeMergedModules before calling optimize, or call compileOptimized without calling optimize. Make sure they don't sneak past the verifier. This adds LTOCodeGenerator::verifyMergedModuleOnce, and calls it from writeMergedModule, optimize, and codegenOptimized. I couldn't find a good way to test this. I tried writing broken IR to send into llvm-lto, but LTOCodeGenerator doesn't understand textual IR, and assembler runs the verifier itself anyway. Checking in valid-but-doesn't-verify bitcode here doesn't seem valuable. llvm-svn: 266894
* Enable ODR uniquing of DITypes in more placesTeresa Johnson2016-04-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is a follow-on to apply Duncan's new DIType ODR uniquing from r266549 and r266713 in more places. Enable enableDebugTypeODRUniquing() for ThinLTO backends invoked via libLTO, similar to the way r266549 enabled this for ThinLTO backend threads launched from gold-plugin. Also enable enableDebugTypeODRUniquing in opt, similar to the way r266549 enabled this for llvm-link (on by default, can be disabled with new -disable-debug-info-type-map option), since we may perform ThinLTO importing from opt. Reviewers: dexonsmith, joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D19263 llvm-svn: 266746
* IR: Rename API for enabling ODR uniquing of DITypes, NFCDuncan P. N. Exon Smith2016-04-191-1/+1
| | | | | | | | | | | As per David's review, rename everything in the new API for ODR type uniquing of debug info. ensureDITypeMap => enableDebugTypeODRUniquing destroyDITypeMap => disableDebugTypeODRUniquing hasDITypeMap => isODRUniquingDebugTypes llvm-svn: 266713
* [NFC] Header cleanupMehdi Amini2016-04-181-1/+0
| | | | | | | | | | | | | | Removed some unused headers, replaced some headers with forward class declarations. Found using simple scripts like this one: clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap' Patch by Eugene Kosov <claprix@yandex.ru> Differential Revision: http://reviews.llvm.org/D19219 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266595
* Keep only the splitCodegen version that takes a factory.Rafael Espindola2016-04-171-9/+13
| | | | | | | This makes it much easier to see that all created TargetMachines are equivalent. llvm-svn: 266564
* IR: Use an explicit map for debug info type uniquingDuncan P. N. Exon Smith2016-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than relying on the structural equivalence of DICompositeType to merge type definitions, use an explicit map on the LLVMContext that LLParser and BitcodeReader consult when constructing new nodes. Each non-forward-declaration DICompositeType with a non-empty 'identifier:' field is stored/loaded from the type map, and the first definiton will "win". This map is opt-in: clients that expect ODR types from different modules to be merged must call LLVMContext::ensureDITypeMap. - Clients that just happen to load more than one Module in the same LLVMContext won't magically merge types. - Clients (like LTO) that want to continue to merge types based on ODR identifiers should opt-in immediately. I have updated LTOCodeGenerator.cpp, the two "linking" spots in gold-plugin.cpp, and llvm-link (unless -disable-debug-info-type-map) to set this. With this in place, it will be straightforward to remove the DITypeRef concept (i.e., referencing types by their 'identifier:' string rather than pointing at them directly). llvm-svn: 266549
* Add SVN version to libLLVMLTOMehdi Amini2016-04-161-0/+50
| | | | | | | | | | | | | | | | | | | | Summary: For Incremental LTO, we need to make sure that an old cache entry is not used when incrementally re-linking with a new libLTO. Adding a global LLVM_REVISION in llvm-config.h would for to rebuild/relink the world for every "git pull"/"svn update". So instead only libLTO is made dependent on the VCS and will be rebuilt (and the dependent binaries relinked, i.e. as of today: libLTO.dylib and llvm-lto). Reviewers: beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18987 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266523
* ThinLTO: Move the ODR resolution to be based purely on the summary.Mehdi Amini2016-04-161-47/+91
| | | | | | | | | This is a requirement for the cache handling in D18494 Differential Revision: http://reviews.llvm.org/D18908 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266519
* ThinLTO: linkonce compile-time optimization, do not bother when there is ↵Mehdi Amini2016-04-141-0/+4
| | | | | | | only one input file From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266281
* Simplify LTOInternalize into UpdateLLVMCompilerUsedMehdi Amini2016-04-135-95/+91
| | | | | | | | | It is now only doing the update to the llvm.compiler_used global. The client has to call separately the internalization stage. Hopefully the code is simpler to understand this way. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266174
* Minor cleanup in Internalize, hide helper class using anonymous namespace (NFC)Mehdi Amini2016-04-132-0/+0
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266173
* LTOInternalize: Use a StringSet instead of a sorted vector and a binary ↵Mehdi Amini2016-04-131-9/+4
| | | | | | | search query for each function From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266172
* Move "ExternalSymbols" out of LTOInternalize (NFC)Mehdi Amini2016-04-133-18/+22
| | | | | | | This is not really related to internalization per se. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266170
* Refactor the InternalizePass into a helper class, and expose it through a ↵Mehdi Amini2016-04-131-6/+2
| | | | | | | | | | public free function (NFC) There is really no reason to require to instanciate a pass manager to internalize. From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266167
* Refactor Internalization pass to use as a callback instead of a StringSet (NFC)Mehdi Amini2016-04-133-35/+41
| | | | | | | | | | | | This will save a bunch of copies / initialization of intermediate datastructure, and (hopefully) simplify the code. This also abstract the symbol preservation mechanism outside of the Internalization pass into the client code, which is not forced to keep a map of strings for instance (ThinLTO will prefere hashes). From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266163
OpenPOWER on IntegriCloud