summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "Use StringRef in LTOModule implementation (NFC)"Mehdi Amini2016-10-062-30/+26
| | | | | | | This reverts commit r282997, a windows bot is asserting in one test apparently. llvm-svn: 283456
* Use StringRef in LTOCodegenerator (NFC)Mehdi Amini2016-10-011-4/+4
| | | | llvm-svn: 282998
* Use StringRef in LTOModule implementation (NFC)Mehdi Amini2016-10-012-26/+30
| | | | llvm-svn: 282997
* 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
* Refactor the ProfileSummaryInfo to use doInitialization and doFinalization ↵Dehao Chen2016-09-281-1/+1
| | | | | | | | | | | | | | to handle Module update. Summary: This refactors the change in r282616 Reviewers: davidxl, eraman, mehdi_amini Subscribers: mehdi_amini, davide, llvm-commits Differential Revision: https://reviews.llvm.org/D25041 llvm-svn: 282630
* Fix the bug introduced in r282616.Dehao Chen2016-09-281-1/+1
| | | | llvm-svn: 282618
* [thinlto] Basic thinlto fdo heuristicPiotr Padlewski2016-09-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch improves thinlto importer by importing 3x larger functions that are called from hot block. I compared performance with the trunk on spec, and there were about 2% on povray and 3.33% on milc. These results seems to be consistant and match the results Teresa got with her simple heuristic. Some benchmarks got slower but I think they are just noisy (mcf, xalancbmki, omnetpp)- running the benchmarks again with more iterations to confirm. Geomean of all benchmarks including the noisy ones were about +0.02%. I see much better improvement on google branch with Easwaran patch for pgo callsite inlining (the inliner actually inline those big functions) Over all I see +0.5% improvement, and I get +8.65% on povray. So I guess we will see much bigger change when Easwaran patch will land (it depends on new pass manager), but it is still worth putting this to trunk before it. Implementation details changes: - Removed CallsiteCount. - ProfileCount got replaced by Hotness - hot-import-multiplier is set to 3.0 for now, didn't have time to tune it up, but I see that we get most of the interesting functions with 3, so there is no much performance difference with higher, and binary size doesn't grow as much as with 10.0. Reviewers: eraman, mehdi_amini, tejohnson Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D24638 llvm-svn: 282437
* Add qualification to fix MSVC build.Peter Collingbourne2016-09-231-1/+1
| | | | llvm-svn: 282313
* LTO: Simplify caching interface.Peter Collingbourne2016-09-233-115/+101
| | | | | | | | | | | | | | | | | 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
* [ThinLTO] Emit files for distributed builds for all modulesTeresa Johnson2016-09-211-20/+20
| | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 282100
* [ThinLTO] Always emit a summary when compiling in ThinLTO modeTeresa Johnson2016-09-201-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Emit an empty summary section, instead of no summary section, when there are no global variables in the index. This ensures that LTO will treat these files as ThinLTO inputs, instead of as regular LTO inputs. In addition to not being what the user likely intended when compiling with -flto=thin, the current behavior is problematic for distributed build systems that expect to get ThinLTO index and imports files back for each input compiled with -flto=thin. Combining into a single regular LTO module also reduces the backend parallelism. And in the case where the index was suppressed due to uses in inline assembly, combining into a single LTO module could provoke renaming of duplicates that we were trying to prevent by suppressing the index. This change required a couple of fixes to handle the empty summary section. Reviewers: mehdi_amini Subscribers: mehdi_amini, llvm-commits, pcc Differential Revision: https://reviews.llvm.org/D24779 llvm-svn: 282037
* [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
* [LTO] Fix handling of mixed (regular and thin) mode LTOTeresa Johnson2016-09-161-6/+9
| | | | | | | | | | | | | | | | | | | | | Summary: In runThinLTO we start the task numbering for ThinLTO backend tasks depending on whether there was also a regular LTO object (CombinedModule). However, the CombinedModule is moved at the end of runRegularLTO, so we need to save this information and pass it into runThinLTO. Otherwise the AddOutput callback to the client will use the same task number for both the regular LTO object and the first ThinLTO object, which in gold-plugin caused only one to be end up in the output filename array and therefore passed back to gold for the final native link. Reviewers: pcc, mehdi_amini Subscribers: mehdi_amini, kromanova Differential Revision: https://reviews.llvm.org/D24643 llvm-svn: 281725
* Move the Mangler from the AsmPrinter down to TLOF and clean up theEric Christopher2016-09-161-4/+1
| | | | | | TLOF API accordingly. llvm-svn: 281708
* [LTO] Fix commons handlingMehdi Amini2016-09-141-3/+7
| | | | | | | | | | | | | | Previously the prevailing information was not honored, and commons symbols could override a strong definition. This patch fixes it and propose the following semantic for commons: the client should mark as prevailing the commons that it expects the LTO implementation to merge (i.e. take the maximum size and alignment). It implies that commons are allowed to have multiple prevailing definitions. Differential Revision: https://reviews.llvm.org/D24545 llvm-svn: 281538
* [lib/LTO] Fix a typo. NFC.Davide Italiano2016-09-141-1/+1
| | | | llvm-svn: 281517
* [LTO] Don't pass SF_Undefined symbols to the IRmover.Davide Italiano2016-09-131-0/+2
| | | | | | This should fix PR 30363. llvm-svn: 281366
* [lib/LTO] Add a way to run a custom pipelineDavide Italiano2016-09-072-1/+46
| | | | | | 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
* [LTO] Constify (NFC)Mehdi Amini2016-09-061-16/+20
| | | | llvm-svn: 280687
* [lib/LTO] Simplify. No functional change intended.Davide Italiano2016-09-021-11/+6
| | | | llvm-svn: 280503
* [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
* [LTO] Don't create a new common unless merged has different sizeTeresa Johnson2016-08-271-3/+4
| | | | | | | | | | | | | | | | | Summary: This addresses a regression in common handling from the new LTO API in r278338. Only create a new common if the size is different. The type comparison against an array type fails when the size is different but not an array. GlobalMerge does not handle the array types as well and we lose some global merging opportunities. Reviewers: mehdi_amini Subscribers: junbuml, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23955 llvm-svn: 279911
* [ThinLTO] Move loading of cache entry to clientTeresa Johnson2016-08-261-8/+2
| | | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 279883
* Make writeToResolutionFile a static helper.Rafael Espindola2016-08-261-10/+10
| | | | llvm-svn: 279859
* [lib/LTO] Add an assertion to catch invalid opt levels.Davide Italiano2016-08-261-4/+5
| | | | llvm-svn: 279823
* [ThinLTO] Add caching to the new LTO APIMehdi Amini2016-08-234-32/+248
| | | | | | | | | | | | 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
* Stop always creating and running an LTO compilation if there is not a single ↵Mehdi Amini2016-08-231-21/+13
| | | | | | | | | | | | | | | | | | | | LTO object Summary: I assume there was a use case, so maybe this strawman patch will help clarifying if it is legit. In any case the current situation is not legit: a ThinLTO compilation should not trigger an unexpected full LTO compilation. Right now, adding a --save-temps option triggers this and makes the number of output differs. Reviewers: tejohnson Subscribers: pcc, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23600 llvm-svn: 279550
* [ThinLTO] Make sure the Context used for the ThinLTO backend has all the ↵Mehdi Amini2016-08-232-1/+3
| | | | | | | | | | | | | 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
* [LTOCodeGenerator] Reduce code duplication. NFCI.Davide Italiano2016-08-231-8/+8
| | | | llvm-svn: 279514
* [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] Handles commons in monolithic LTOMehdi Amini2016-08-221-0/+33
| | | | | | | | | 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 llvm-svn: 279417
* [LTO] Add a "CodeGenOnly" option. Allows the client to skip the optimizer.Mehdi Amini2016-08-222-21/+29
| | | | | | | | | | | | 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] Remove dead-code: collectUsedGlobalVariables has been moved to Thin ↵Mehdi Amini2016-08-191-3/+1
| | | | | | and LTO specifc path (NFC) llvm-svn: 279261
* [PM] Rework the new PM support for building the ModuleSummaryIndex toChandler Carruth2016-08-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | directly produce the index as the value type result. This requires making the index movable which is straightforward. It greatly simplifies things by allowing us to completely avoid the builder API and the layers of abstraction inherent there. Instead both pass managers can directly construct these when run by value. They still won't be constructed truly eagerly thanks to the optional in the legacy PM. The code that directly builds the index can also just share a direct function. A notable change here is that the result type of the analysis for the new PM is no longer a reference type. This was really problematic when making changes to how we handle result types to make our interface requirements *much* more strict and precise. But I think this is an overall improvement. Differential Revision: https://reviews.llvm.org/D23701 llvm-svn: 279216
* [LTO] Move callback member from base class to the derived where it is used (NFC)Mehdi Amini2016-08-191-12/+10
| | | | llvm-svn: 279212
* [LTO] Add a move to inialize member in ctor initialization list (NFC)Mehdi Amini2016-08-191-1/+1
| | | | llvm-svn: 279210
* [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-172-30/+32
| | | | | | | | | | | | | | | | | 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] Simplify APIs and constify (NFC)Mehdi Amini2016-08-162-10/+10
| | | | | | | | | | | | | | | | | Summary: Multiple APIs were taking a StringMap for the ImportLists containing the entries for for all the modules while operating on a single entry for the current module. Instead we can pass the desired ModuleImport directly. Also some of the APIs were not const, I believe just to be able to use operator[] on the StringMap. Reviewers: tejohnson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23537 llvm-svn: 278776
* [LTO] Rename variables with meaningul names, i.e. more than one character (NFC)Mehdi Amini2016-08-161-15/+16
| | | | llvm-svn: 278766
* [ThinLTO] Fix temp file dumping, enable via llvm-lto and test itTeresa Johnson2016-08-151-2/+2
| | | | | | | | | | | | | | | | | | | Summary: Fixed a bug in ThinLTOCodeGenerator's temp file dumping. The Twine needs to be passed directly as an argument, or a copy saved into a std::string. It doesn't seem there are any consumers of this, so I added a new option to llvm-lto to enable saving of temp files during ThinLTO, and augmented a test to use it to check post-import but pre-opt bitcode. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23525 llvm-svn: 278761
* Fix type truncation warningsTeresa Johnson2016-08-112-13/+14
| | | | | | | | | 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-114-6/+817
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud