summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[LTO] Support filtering by hotness threshold"Bob Haarman2018-03-081-3/+1
| | | | | | | | This reverts commit 1f3bd185c53beb6aa68446974b7e80837abd6ef0 (r326107) because it fails ThinLTO/X86/diagnostic-handler-remarks-with-hotness.ll. llvm-svn: 326975
* [LTO] Support filtering by hotness thresholdAdam Nemet2018-02-261-1/+3
| | | | | | | | | | | This wires up -pass-remarks-hotness-threshold to LTO and ThinLTO. Next is to change the clang driver to pass this with -fdiagnostics-hotness-threshold. Differential Revision: https://reviews.llvm.org/D41465 llvm-svn: 326107
* Pass a reference to a module to the bitcode writer.Rafael Espindola2018-02-141-2/+2
| | | | | | | This simplifies most callers as they are already using references or std::unique_ptr. llvm-svn: 325155
* [ThinLTO] - Stop internalizing and drop non-prevailing symbols.George Rimar2018-01-291-4/+16
| | | | | | | | | | | Implementation marks non-prevailing symbols as not live in the summary. Then them are dropped in backends. Fixes https://bugs.llvm.org/show_bug.cgi?id=35938 Differential revision: https://reviews.llvm.org/D42107 llvm-svn: 323633
* [ThinLTO] Re-commit of dot dumper after test fixEugene Leviant2018-01-221-1/+1
| | | | llvm-svn: 323116
* Temporarily revert r323062 to investigate buildbot failuresEugene Leviant2018-01-211-1/+1
| | | | llvm-svn: 323065
* [ThinLTO] Implement summary visualizerEugene Leviant2018-01-211-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D41297 llvm-svn: 323062
* [ThinLTO] - Remove code duplication. NFC.George Rimar2018-01-171-22/+17
| | | | | | | Refactors 3 copies of isExpected. Splitted from D42107. llvm-svn: 322627
* Avoid int to string conversion in Twine or raw_ostream contexts.Benjamin Kramer2017-12-281-1/+1
| | | | | | Some output changes from uppercase hex to lowercase hex, no other functionality change intended. llvm-svn: 321526
* Move the stripping of invalid debug info from the Verifier to AutoUpgrade.Adrian Prantl2017-10-021-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | This came out of a recent discussion on llvm-dev (https://reviews.llvm.org/D38042). Currently the Verifier will strip the debug info metadata from a module if it finds the dbeug info to be malformed. This feature is very valuable since it allows us to improve the Verifier by making it stricter without breaking bcompatibility, but arguable the Verifier pass should not be modifying the IR. This patch moves the stripping of broken debug info into AutoUpgrade (UpgradeDebugInfo to be precise), which is a much better location for this since the stripping of malformed (i.e., produced by older, buggy versions of Clang) is a (harsh) form of AutoUpgrade. This change is mostly NFC in nature, the one big difference is the behavior when LLVM module passes are introducing malformed debug info. Prior to this patch, a NoAsserts build would have printed a warning and stripped the debug info, after this patch the Verifier will report a fatal error. I believe this behavior is actually more desirable anyway. Differential Revision: https://reviews.llvm.org/D38184 llvm-svn: 314699
* Revert "[ThinLTO] Avoid archive member collisions with old API"Johan Engelen2017-09-171-3/+1
| | | | | | This reverts commit r313488, because it breaks compilation on Android and breaks llvm-lto. llvm-svn: 313489
* [ThinLTO] Avoid archive member collisions with old APIJohan Engelen2017-09-171-1/+3
| | | | | | | | | | | | | | | | | | Summary: ld64 on OSX uses the old ThinLTOCodegenerator API. When two modules have the same name in an archive (valid archive), a name collision happens for the modules' buffer identifiers. This PR resolves this, by suffixing the module name with an increasing number such that the identifiers are guaranteed to be unique. For a similar fix in LLD, see https://reviews.llvm.org/D25495 Reviewers: mehdi_amini, tejohnson Reviewed By: mehdi_amini Subscribers: inglorion, eraman, llvm-commits Differential Revision: https://reviews.llvm.org/D37961 llvm-svn: 313488
* Delete Default and JITDefault code modelsRafael Espindola2017-08-031-3/+3
| | | | | | | | | | | | | | | IMHO it is an antipattern to have a enum value that is Default. At any given piece of code it is not clear if we have to handle Default or if has already been mapped to a concrete value. In this case in particular, only the target can do the mapping and it is nice to make sure it is always done. This deletes the two default enum values of CodeModel and uses an explicit Optional<CodeModel> when it is possible that it is unspecified. llvm-svn: 309911
* [ThinLTO] Remove unnecessary include of Linker.h (NFC)Teresa Johnson2017-06-221-1/+0
| | | | | | | | The ModuleLinker is no longer used by ThinLTO, so this is not needed. Patch by Benoit Belley <Benoit.Belley@autodesk.com> llvm-svn: 306028
* Sort the remaining #include lines in include/... and lib/....Chandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I did this a long time ago with a janky python script, but now clang-format has built-in support for this. I fed clang-format every line with a #include and let it re-sort things according to the precise LLVM rules for include ordering baked into clang-format these days. I've reverted a number of files where the results of sorting includes isn't healthy. Either places where we have legacy code relying on particular include ordering (where possible, I'll fix these separately) or where we have particular formatting around #include lines that I didn't want to disturb in this patch. This patch is *entirely* mechanical. If you get merge conflicts or anything, just ignore the changes in this patch and run clang-format over your #include lines in the files. Sorry for any noise here, but it is important to keep these things stable. I was seeing an increasing number of patches with irrelevant re-ordering of #include lines because clang-format was used. This patch at least isolates that churn, makes it easy to skip when resolving conflicts, and gets us to a clean baseline (again). llvm-svn: 304787
* (NFC) Track global summary liveness in GVFlags.Evgeniy Stepanov2017-06-011-8/+8
| | | | | | | | Replace GVFlags::LiveRoot with GVFlags::Live and use that instead of all the DeadSymbols sets. This is refactoring in order to make liveness information available in the RegularLTO pipeline. llvm-svn: 304466
* Revert "Revert "ThinLTO: Verify bitcode before lauching the ↵Adrian Prantl2017-05-201-1/+33
| | | | | | | | | | | | | ThinLTOCodeGenerator."" This reapplies commit r303438 modified to not verify cross-imported bitcode in FunctionImporter. rdar://problem/31233625 Differential Revision: https://reviews.llvm.org/D33370 llvm-svn: 303470
* Revert "ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator."Adrian Prantl2017-05-191-33/+2
| | | | | | This reverts commit r303438 while deliberating buildbot breakage. llvm-svn: 303467
* ThinLTO: Verify bitcode before lauching the ThinLTOCodeGenerator.Adrian Prantl2017-05-191-2/+33
| | | | | | | | rdar://problem/31233625 Differential Revision: https://reviews.llvm.org/D33151 llvm-svn: 303438
* [ThinLTO] Do not assert when adding a module with a different butAkira Hatanaka2017-05-181-21/+17
| | | | | | | | | | | | | | | | compatible target triple Currently, an assertion fails in ThinLTOCodeGenerator::addModule when the target triple of the module being added doesn't match that of the one stored in TMBuilder. This patch relaxes the constraint and makes changes to allow target triples that only differ in their version numbers on Apple platforms, similarly to what r228999 did. rdar://problem/30133904 Differential Revision: https://reviews.llvm.org/D33291 llvm-svn: 303326
* [LTO] Print time-passes information at conclusion of LTO codegenJames Henderson2017-05-161-0/+1
| | | | | | | | | | | | | | | | | | | The information collected when requested by -time-passes is only printed when llvm_shutdown is called at the moment. This means that when linking against the LTO library dynamically and using the C interface, it is not possible to see the timing information, because llvm_shutdown cannot be called. This change modifies the LTO code generation functions for both regular LTO and thin LTO to explicitly print and reset the timing information. I have tested that this works with our proprietary linker. However, as this relies on a specific method of building and linking against the LTO library, I'm not sure how or if this can be tested in the LLVM testsuite. Reviewed by: mehdi_amini Differential Revision: https://reviews.llvm.org/D32803 llvm-svn: 303152
* Ensure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builderTeresa Johnson2017-05-101-1/+1
| | | | | | | | | | | | This fixes a ubsan bot failure after r302597, which made getProfileCount non-static, but ended up invoking it on a null ProfileSummaryInfo object in some cases from buildModuleSummaryIndex. Most testing passed because the non-static getProfileCount currently doesn't access any member variables, but I found this when testing a follow on patch (D32877) that adds a member variable access. llvm-svn: 302705
* Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in ↵Peter Collingbourne2017-05-041-2/+3
| | | | | | | | the module summary. NFCI." with a fix for the clang backend. llvm-svn: 302176
* Revert "IR: Use pointers instead of GUIDs to represent edges in the module ↵Eric Liu2017-05-041-3/+2
| | | | | | | | | | summary. NFCI." This reverts commit r302108. This causes crash in clang bootstrap with LTO. Contacted the auther in the original commit. llvm-svn: 302140
* IR: Use pointers instead of GUIDs to represent edges in the module summary. ↵Peter Collingbourne2017-05-041-2/+3
| | | | | | | | | | | | | | | | | | | | NFCI. When profiling a no-op incremental link of Chromium I found that the functions computeImportForFunction and computeDeadSymbols were consuming roughly 10% of the profile. The goal of this change is to improve the performance of those functions by changing the map lookups that they were previously doing into pointer dereferences. This is achieved by changing the ValueInfo data structure to be a pointer to an element of the global value map owned by ModuleSummaryIndex, and changing reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs. This means that a ValueInfo will take a client directly to the summary list for a given GUID. Differential Revision: https://reviews.llvm.org/D32471 llvm-svn: 302108
* Bitcode: Make the summary reader responsible for merging. NFCI.Peter Collingbourne2017-05-011-10/+5
| | | | | | | | | This is to prepare for an upcoming change which uses pointers instead of GUIDs to represent references. Differential Revision: https://reviews.llvm.org/D32469 llvm-svn: 301843
* Object: Remove ModuleSummaryIndexObjectFile class.Peter Collingbourne2017-05-011-10/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D32195 llvm-svn: 301832
* Support: Add a VCSRevision.h header file.Peter Collingbourne2017-04-131-5/+2
| | | | | | | | | | | | | | | | | | | | | This is a magic header file supported by the build system that provides a single definition, LLVM_REVISION, containing an LLVM revision identifier, if available. This functionality previously lived in the LTO library, but I am moving it out to lib/Support because I want to also start using it in lib/Object to create the IR symbol table. This change also fixes a bug where LLVM_REVISION was never actually being used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was only being defined in a non-existent file Version.cpp). I also changed the code to use "git rev-parse --git-dir" to locate the .git directory, instead of looking for it in the LLVM source root directory, which makes this compatible with monorepos as well as git worktrees. Differential Revision: https://reviews.llvm.org/D31985 llvm-svn: 300160
* Add support for -fno-builtin to LTO and ThinLTO to libLTOMehdi Amini2017-03-281-7/+10
| | | | | | | | | | Reviewers: tejohnson, pcc Subscribers: Prazek, dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D30791 llvm-svn: 298936
* Support, LTO: When pruning a directory, ignore files matching a prefix.Peter Collingbourne2017-03-201-1/+4
| | | | | | | | | | This is a safeguard against data loss if the user specifies a directory that is not a cache directory. Teach the existing cache pruning clients to create files with appropriate names. Differential Revision: https://reviews.llvm.org/D31109 llvm-svn: 298271
* Support: Simplify the CachePruning API. NFCI.Peter Collingbourne2017-03-151-5/+1
| | | | | | | | | Change the function that implements the pruning into a free function that takes the policy as a struct argument. Differential Revision: https://reviews.llvm.org/D31009 llvm-svn: 297907
* [ThinLTO] Make a copy of buffer identifier in ThinLTOCodeGeneratorMehdi Amini2017-02-141-14/+17
| | | | | | | We can't assume that the `const char *` provided through libLTO has a lifetime that expands beyond the codegenerator itself. llvm-svn: 295018
* [LTO] Share the optimization remarks setup between Thin/Full LTO.Davide Italiano2017-02-101-22/+2
| | | | llvm-svn: 294807
* Revert "[ThinLTO] Add an auto-hide feature"Mehdi Amini2017-02-031-34/+26
| | | | | | | | | This reverts commit r293970. After more discussion, this belongs to the linker side and there is no added value to do it at this level. llvm-svn: 293993
* [ThinLTO] Add an auto-hide featureMehdi Amini2017-02-031-26/+34
| | | | | | | | | | | | | | | When a symbol is not exported outside of the DSO, it is can be hidden. Usually we try to internalize as much as possible, but it is not always possible, for instance a symbol can be referenced outside of the LTO unit, or there can be cross-module reference in ThinLTO. This is a recommit of r293912 after fixing build failures, and a recommit of r293918 after fixing LLD tests. Differential Revision: https://reviews.llvm.org/D28978 llvm-svn: 293970
* Revert "[ThinLTO] Add an auto-hide feature"Mehdi Amini2017-02-021-34/+26
| | | | | | This reverts commit r293918, one lld test does not pass. llvm-svn: 293961
* [ThinLTO] Add an auto-hide featureMehdi Amini2017-02-021-26/+34
| | | | | | | | | | | | | | When a symbol is not exported outside of the DSO, it is can be hidden. Usually we try to internalize as much as possible, but it is not always possible, for instance a symbol can be referenced outside of the LTO unit, or there can be cross-module reference in ThinLTO. This is a recommit of r293912 after fixing build failures. Differential Revision: https://reviews.llvm.org/D28978 llvm-svn: 293918
* Revert "[ThinLTO] Add an auto-hide feature"Mehdi Amini2017-02-021-30/+22
| | | | | | This reverts r293912, bots are broken. llvm-svn: 293914
* [ThinLTO] Add an auto-hide featureMehdi Amini2017-02-021-22/+30
| | | | | | | | | | | | When a symbol is not exported outside of the DSO, it is can be hidden. Usually we try to internalize as much as possible, but it is not always possible, for instance a symbol can be referenced outside of the LTO unit, or there can be cross-module reference in ThinLTO. Differential Revision: https://reviews.llvm.org/D28978 llvm-svn: 293912
* [ThinLTO] The "codegen only" path didn't honor the recently added file-based APIMehdi Amini2017-01-201-15/+19
| | | | llvm-svn: 292667
* [ThinLTO] Hash more part of the config to build cache entriesMehdi Amini2017-01-101-2/+34
| | | | | | | This has been fixed in the "new" LTO API used by Gold/LLD, this is fixing the same issue in the libLTO API used by ld64 (amongst other) llvm-svn: 291518
* [ThinLTO] Expected<> return values need to be handled to avoid an assertionMehdi Amini2017-01-081-1/+8
| | | | llvm-svn: 291377
* ThinLTO: add early "dead-stripping" on the IndexTeresa Johnson2017-01-051-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Using the linker-supplied list of "preserved" symbols, we can compute the list of "dead" symbols, i.e. the one that are not reachable from a "preserved" symbol transitively on the reference graph. Right now we are using this information to mark these functions as non-eligible for import. The impact is two folds: - Reduction of compile time: we don't import these functions anywhere or import the function these symbols are calling. - The limited number of import/export leads to better internalization. Patch originally by Mehdi Amini. Reviewers: mehdi_amini, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D23488 llvm-svn: 291177
* [ThinLTO] Honor -O{0,1,2,4} passed through the libLTO interface for ThinLTOMehdi Amini2016-12-281-6/+8
| | | | | | | This was hardcoded to be O3 till now, without any way to change it without changing the code. llvm-svn: 290682
* [ThinLTO] Import composite types as declarationsTeresa Johnson2016-12-161-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | 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
* [ThinLTO] Add an API to trigger file-based API for returning objects to the ↵Mehdi Amini2016-12-141-19/+86
| | | | | | | | | | | | | | | | | | | | linker Summary: The motivation is to support better the -object_path_lto option on Darwin. The linker needs to write down the generate object files on disk for later use by lldb or dsymutil (debug info are not present in the final binary). We're moving this into libLTO so that we can be smarter when a cache is enabled and hard-link when possible instead of duplicating the files. Reviewers: tejohnson, deadalnix, pcc Subscribers: dexonsmith, llvm-commits Differential Revision: https://reviews.llvm.org/D27507 llvm-svn: 289631
* [LTOs] Allow generation of hotness informationAdam Nemet2016-12-021-0/+4
| | | | | | | | The flag is passed by the clang driver. Differential Revision: https://reviews.llvm.org/D27331 llvm-svn: 288519
* LTO: Remove ModuleLoader, make loadModuleFromBuffer static and move into its ↵Peter Collingbourne2016-12-011-1/+24
| | | | | | | | | | only client, ThinLTOCodeGenerator. This is no longer the recommended way to load modules for importing, so it should not be public API. Differential Revision: https://reviews.llvm.org/D27292 llvm-svn: 288316
* [ThinLTO] Implement -pass-remarks-output in ThinLTOCodeGeneratorMehdi Amini2016-11-191-0/+27
| | | | | | | | | | | | | | Summary: This will also be added to the LTO API, right now this will bring ThinLTO on par with Monolithic LTO on Darwin. Reviewers: anemet Subscribers: tejohnson, llvm-commits Differential Revision: https://reviews.llvm.org/D26886 llvm-svn: 287450
* [ThinLTO] Only promote exported locals as marked in indexTeresa Johnson2016-11-141-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We have always speculatively promoted all renamable local values (except const non-address taken variables) for both the exporting and importing module. We would then internalize them back based on the ThinLink results if they weren't actually exported. This is inefficient, and results in unnecessary renames. It also meant we had to check the non-renamability of a value in the summary, which was already checked during function importing analysis in the ThinLink. Made renameModuleForThinLTO (which does the promotion/renaming) instead use the index when exporting, to avoid unnecessary renames/promotions. For importing modules, we can simply promoted all values as any local we import by definition is exported and needs promotion. This required changes to the method used by the FunctionImport pass (only invoked from 'opt' for testing) and when invoked from llvm-link, since neither does a ThinLink. We simply conservatively mark all locals in the index as promoted, which preserves the current aggressive promotion behavior. I also needed to change an llvm-lto based test where we had previously been aggressively promoting values that weren't importable (aliasees), but now will not promote. Reviewers: mehdi_amini Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26467 llvm-svn: 286871
OpenPOWER on IntegriCloud