summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOBackend.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* More accurate header inclusions. NFC.Peter Collingbourne2017-03-281-0/+1
| | | | llvm-svn: 298960
* IPO: Const correctness for summaries passed into passes.Peter Collingbourne2017-03-221-7/+12
| | | | | | | | | Pass const qualified summaries into importers and unqualified summaries into exporters. This lets us const-qualify the summary argument to thinBackend. Differential Revision: https://reviews.llvm.org/D31230 llvm-svn: 298534
* Perform symbol binding for .symver versioned symbolsTeresa Johnson2017-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In a .symver assembler directive like: .symver name, name2@@nodename "name2@@nodename" should get the same symbol binding as "name". While the ELF object writer is updating the symbol binding for .symver aliases before emitting the object file, not doing so when the module inline assembly is handled by the RecordStreamer is causing the wrong behavior in *LTO mode. E.g. when "name" is global, "name2@@nodename" must also be marked as global. Otherwise, the symbol is skipped when iterating over the LTO InputFile symbols (InputFile::Symbol::shouldSkip). So, for example, when performing any *LTO via the gold-plugin, the versioned symbol definition is not recorded by the plugin and passed back to the linker. If the object was in an archive, and there were no other symbols needed from that object, the object would not be included in the final link and references to the versioned symbol are undefined. The llvm-lto2 tests added will give an error about an unused symbol resolution without the fix. Reviewers: rafael, pcc Reviewed By: pcc Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D30485 llvm-svn: 297332
* [LTO] Add ability to emit assembly to new LTO APITobias Edler von Koch2017-02-151-2/+1
| | | | | | | | | | | | | | | | Summary: Add a field to LTO::Config, CGFileType, to select the file type to emit (object or assembly). This is useful for testing and to implement -save-temps. Reviewers: tejohnson, mehdi_amini, pcc Reviewed By: mehdi_amini Subscribers: davide, llvm-commits Differential Revision: https://reviews.llvm.org/D29475 llvm-svn: 295226
* [LTO] Make sure we flush buffers to work around linker shenanigans.Davide Italiano2017-02-131-2/+17
| | | | | | | lld, at least, doesn't call global destructors by default (unless --full-shutdown is passed) because it's, allegedly, expensive. llvm-svn: 294953
* [lib/LTO] Initial support for optimization remarks in the new API.Davide Italiano2017-02-121-0/+6
| | | | llvm-svn: 294882
* [LTO] Teach lib/LTO about the new pass manager.Davide Italiano2017-01-241-4/+66
| | | | | | Differential Revision: https://reviews.llvm.org/D28997 llvm-svn: 292864
* IPO, LTO: Plumb the summary from the LTO API into the pass manager.Peter Collingbourne2017-01-201-6/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D28840 llvm-svn: 292661
* [PM] Separate the LoopAnalysisManager from the LoopPassManager and moveChandler Carruth2017-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the latter to the Transforms library. While the loop PM uses an analysis to form the IR units, the current plan is to have the PM itself establish and enforce both loop simplified form and LCSSA. This would be a layering violation in the analysis library. Fundamentally, the idea behind the loop PM is to *transform* loops in addition to running passes over them, so it really seemed like the most natural place to sink this was into the transforms library. We can't just move *everything* because we also have loop analyses that rely on a subset of the invariants. So this patch splits the the loop infrastructure into the analysis management that has to be part of the analysis library, and the transform-aware pass manager. This also required splitting the loop analyses' printer passes out to the transforms library, which makes sense to me as running these will transform the code into LCSSA in theory. I haven't split the unittest though because testing one component without the other seems nearly intractable. Differential Revision: https://reviews.llvm.org/D28452 llvm-svn: 291662
* [ThinLTO] Import composite types as declarationsTeresa Johnson2016-12-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: When reading the metadata bitcode, create a type declaration when possible for composite types when we are importing. Doing this in the bitcode reader saves memory. Also it works naturally in the case when the type ODR map contains a definition for the same composite type because it was used in the importing module (buildODRType will automatically use the existing definition and not create a type declaration). For Chromium built with -g2, this reduces the aggregate size of the generated native object files by 66% (from 31G to 10G). It reduced the time through the ThinLTO link and backend phases by about 20% on my machine. Reviewers: mehdi_amini, dblaikie, aprantl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27775 llvm-svn: 289993
* Pass sample pgo flags to thinlto.Dehao Chen2016-12-161-0/+1
| | | | | | | | | | | | 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 llvm-svn: 289957
* [LTO] Reject modules without datalayout.Davide Italiano2016-12-141-1/+0
| | | | | | | | | | | Also, udpate the ~60 failing tests in the tree which did not contain a valid datalayout. This fixes PR31123. lld will be updated in a following patch, immediately after this is committed. Differential Revision: https://reviews.llvm.org/D27082 llvm-svn: 289719
* LTO: Add support for multi-module bitcode files.Peter Collingbourne2016-12-141-3/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D27313 llvm-svn: 289621
* Object: Extract a ModuleSymbolTable class from IRObjectFile.Peter Collingbourne2016-12-011-1/+1
| | | | | | | | | | | | This class represents a symbol table built from in-memory IR. It provides access to GlobalValues and should only be used if such access is required (e.g. in the LTO implementation). We will eventually change IRObjectFile to read from a bitcode symbol table rather than using ModuleSymbolTable, so it would not be able to expose the module. Differential Revision: https://reviews.llvm.org/D27073 llvm-svn: 288319
* [lib/LTO] Rename few instances of Lto to LTO.Davide Italiano2016-11-241-6/+6
| | | | llvm-svn: 287840
* Bitcode: Change module reader functions to return an llvm::Expected.Peter Collingbourne2016-11-131-5/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D26562 llvm-svn: 286752
* 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 llvm-svn: 286566
* Make the Error class constructor protectedMehdi Amini2016-11-111-10/+10
| | | | | | | | | This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
* Bitcode: Change the materializer interface to return llvm::Error.Peter Collingbourne2016-11-091-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D26439 llvm-svn: 286382
* IR, Bitcode: Change bitcode reader to no longer own its memory buffer.Peter Collingbourne2016-11-081-2/+1
| | | | | | | | | | | | | | | | | | Unique ownership is just one possible ownership pattern for the memory buffer underlying the bitcode reader. In practice, as this patch shows, ownership can often reside at a higher level. With the upcoming change to allow multiple modules in a single bitcode file, it will no longer be appropriate for modules to generally have unique ownership of their memory buffer. The C API exposes the ownership relation via the LLVMGetBitcodeModuleInContext and LLVMGetBitcodeModuleInContext2 functions, so we still need some way for the module to own the memory buffer. This patch does so by adding an owned memory buffer field to Module, and using it in a few other places where it is convenient. Differential Revision: https://reviews.llvm.org/D26384 llvm-svn: 286214
* Reduce global namespace pollution. NFC.Benjamin Kramer2016-10-181-1/+1
| | | | llvm-svn: 284521
* Add explanatory comment.Peter Collingbourne2016-09-291-0/+4
| | | | llvm-svn: 282678
* LTO: Fix use-after-scope error.Peter Collingbourne2016-09-291-0/+1
| | | | llvm-svn: 282665
* LTO: Simplify caching interface.Peter Collingbourne2016-09-231-27/+11
| | | | | | | | | | | | | | | | | 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 llvm-svn: 282299
* [lib/LTO] Try harder to reduce code duplication. NFCI.Davide Italiano2016-09-171-13/+14
| | | | llvm-svn: 281843
* [LTO] Add ability to parse AA pipelines.Davide Italiano2016-09-161-1/+10
| | | | | | | This is supposed to be a drop in replacement for what lld provides via --lto-newpm-aa-pipeline. llvm-svn: 281774
* [LTO] Prevent asm references to be dropped from the output.Davide Italiano2016-09-161-0/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D24617 llvm-svn: 281741
* [lib/LTO] Fix a typo. NFC.Davide Italiano2016-09-141-1/+1
| | | | llvm-svn: 281517
* [lib/LTO] Add a way to run a custom pipelineDavide Italiano2016-09-071-1/+45
| | | | | | Differential Revision: https://reviews.llvm.org/D24095 llvm-svn: 280830
* [LTO] Rename variables to be more explicative.Davide Italiano2016-09-071-29/+30
| | | | | | Thanks to Mehdi for the suggestion! llvm-svn: 280772
* [lib/LTO] Simplify a bit. NFCI.Davide Italiano2016-09-011-4/+1
| | | | llvm-svn: 280396
* [lib/LTO] Factor out logic for running passes.Davide Italiano2016-08-311-4/+7
| | | | | | | | This is in preparation for adding an option to run a custom pipeline with the new PM. It's currently used in lld. llvm-svn: 280258
* [LTO] Remove extraneous outputTeresa Johnson2016-08-291-1/+0
| | | | | | Remove some debugging output to stderr that snuck in with r279576. llvm-svn: 279974
* [ThinLTO] Add caching to the new LTO APIMehdi Amini2016-08-231-4/+22
| | | | | | | | | | | | Add the ability to plug a cache on the LTO API. I tried to write such that a linker implementation can control the cache backend. This is intrusive and I'm not totally happy with it, but I can't figure out a better design right now. Differential Revision: https://reviews.llvm.org/D23599 llvm-svn: 279576
* [ThinLTO] Make sure the Context used for the ThinLTO backend has all the ↵Mehdi Amini2016-08-231-0/+2
| | | | | | | | | | | | | appropriate options An important performance setting on the LLVMContext for LTO is enableDebugTypeODRUniquing(), this adds an automatic merging of debug information in the context based on type ids. Also, the lto::Config includes a diagnostic handler that needs to be set on the Context, as well as the setDiscardValueNames() setting. llvm-svn: 279532
* [LTO] Constify the Module Hook function (NFC)Mehdi Amini2016-08-221-1/+1
| | | | | | | | It use to be non-const for the sole purpose of custom handling of commons symbol. This is moved now in the regular LTO handling now and such we can constify the callback. llvm-svn: 279438
* [LTO] Add a "CodeGenOnly" option. Allows the client to skip the optimizer.Mehdi Amini2016-08-221-2/+8
| | | | | | | | | | | | Summary: Slowly getting on par with libLTO Reviewers: tejohnson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23615 llvm-svn: 279416
* [LTO] Promote before performing weak resolutionMehdi Amini2016-08-181-2/+2
| | | | | | | | | | | | | | | | Summary: This was reversed compared to ThinLTOCodeGenerator for some reason, and lead to an increased code-size on my tests. I figured that the weak resolution may internalize a linkonce function, which will be promoted immediately (and renamed), before being internalized again. Reviewers: tejohnson Subscribers: pcc, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23632 llvm-svn: 279021
* [LTO] Change addSaveTemps API: do not add dot to the supplied prefix pathMehdi Amini2016-08-181-5/+3
| | | | | | | | | | | | | | | | 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 llvm-svn: 279014
* [LTO] Introduce an Output class to wrap the output stream creation (NFC)Mehdi Amini2016-08-171-9/+11
| | | | | | | | | | | | | | | | | 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 llvm-svn: 278907
* [LTO] Rename variables with meaningul names, i.e. more than one character (NFC)Mehdi Amini2016-08-161-15/+16
| | | | llvm-svn: 278766
* Fix type truncation warningsTeresa Johnson2016-08-111-5/+6
| | | | | | | | | Avoid type truncation warnings from a 32-bit bot due to size_t not being unsigned long long, by converting the variables and constants to unsigned. This was introduced by r278338 and caused warnings here: http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/15527/steps/build_llvmclang/logs/warnings%20%287%29 llvm-svn: 278406
* Restore "Resolution-based LTO API."Teresa Johnson2016-08-111-0/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 278338
* Revert "Resolution-based LTO API."Teresa Johnson2016-08-111-277/+0
| | | | | | | | | | 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. llvm-svn: 278331
* Resolution-based LTO API.Teresa Johnson2016-08-111-0/+277
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 llvm-svn: 278330
OpenPOWER on IntegriCloud