summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
Commit message (Collapse)AuthorAgeFilesLines
...
* [LTO] Share the optimization remarks setup between Thin/Full LTO.Davide Italiano2017-02-103-41/+29
| | | | llvm-svn: 294807
* [lib/LTO] Rework optimization remarkers setup.Davide Italiano2017-02-101-16/+19
| | | | | | | | This makes this code much more similar to what ThinLTO is using (also API wise), so now we can probably use a single code path instead of copying stuff around. llvm-svn: 294792
* fix nullptr Mangler in LTOModuleBob Haarman2017-02-041-2/+7
| | | | | | | | | | Reviewers: kcc, pcc Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D29523 llvm-svn: 294079
* IRMover: Merge flags LinkModuleInlineAsm and IsPerformingImport.Peter Collingbourne2017-02-031-1/+0
| | | | | | | | | Currently these flags are always the inverse of each other, so there is no need to keep them separate. Differential Revision: https://reviews.llvm.org/D29471 llvm-svn: 294016
* Revert "[ThinLTO] Add an auto-hide feature"Mehdi Amini2017-02-032-53/+33
| | | | | | | | | 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-032-33/+53
| | | | | | | | | | | | | | | 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-022-53/+33
| | | | | | This reverts commit r293918, one lld test does not pass. llvm-svn: 293961
* [lto] add getLinkerOpts()Bob Haarman2017-02-021-0/+30
| | | | | | | | | | | | Summary: Some compilers, including MSVC and Clang, allow linker options to be specified in source files. In the legacy LTO API, there is a getLinkerOpts() method that returns linker options for the bitcode module being processed. This change adds that method to the new API, so that the COFF linker can get the right linker options when using the new LTO API. Reviewers: pcc, ruiu, mehdi_amini, tejohnson Reviewed By: pcc Differential Revision: https://reviews.llvm.org/D29207 llvm-svn: 293950
* [ThinLTO] Add an auto-hide featureMehdi Amini2017-02-022-33/+53
| | | | | | | | | | | | | | 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-022-49/+29
| | | | | | This reverts r293912, bots are broken. llvm-svn: 293914
* [ThinLTO] Add an auto-hide featureMehdi Amini2017-02-022-29/+49
| | | | | | | | | | | | 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
* LTO: Link non-prevailing weak_odr or linkonce_odr globals into the combined ↵Peter Collingbourne2017-02-021-4/+17
| | | | | | | | | | | | module with available_externally linkage. These linkages mean that the ultimately prevailing symbol will have the same semantics as any non-prevailing copy of the symbol, so we are free to ignore the linker's resolution. Differential Revision: https://reviews.llvm.org/D29367 llvm-svn: 293865
* Linker: Move special casing for available_externally in IRMover to clients. ↵Peter Collingbourne2017-02-021-13/+22
| | | | | | | | | | NFCI. The goal is to simplify the semantic model for clients of IRMover. Differential Revision: https://reviews.llvm.org/D29435 llvm-svn: 293864
* [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
* [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC)David L. Jones2017-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The LibFunc::Func enum holds enumerators named for libc functions. Unfortunately, there are real situations, including libc implementations, where function names are actually macros (musl uses "#define fopen64 fopen", for example; any other transitively visible macro would have similar effects). Strictly speaking, a conforming C++ Standard Library should provide any such macros as functions instead (via <cstdio>). However, there are some "library" functions which are not part of the standard, and thus not subject to this rule (fopen64, for example). So, in order to be both portable and consistent, the enum should not use the bare function names. The old enum naming used a namespace LibFunc and an enum Func, with bare enumerators. This patch changes LibFunc to be an enum with enumerators prefixed with "LibFFunc_". (Unfortunately, a scoped enum is not sufficient to override macros.) There are additional changes required in clang. Reviewers: rsmith Subscribers: mehdi_amini, mzolotukhin, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D28476 llvm-svn: 292848
* [ThinLTO] Don't perform computeDeadSymbols during O0 link, as the result is ↵Mehdi Amini2017-01-201-13/+13
| | | | | | never used (NFC) llvm-svn: 292679
* [ThinLTO] The "codegen only" path didn't honor the recently added file-based APIMehdi Amini2017-01-201-15/+19
| | | | llvm-svn: 292667
* IPO, LTO: Plumb the summary from the LTO API into the pass manager.Peter Collingbourne2017-01-202-7/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D28840 llvm-svn: 292661
* [ThinLTO] Drop non-prevailing non-ODR weak to declarationsTeresa Johnson2017-01-201-3/+1
| | | | | | | | | | | | | | | Summary: Allow non-ODR weak/linkonce non-prevailing copies to be marked as available_externally in the index. Add support for dropping these to declarations in the backend. Reviewers: mehdi_amini, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D28806 llvm-svn: 292656
* LTO: Flush the resolution file after writing to it.Peter Collingbourne2017-01-191-0/+1
| | | | | | Without this the file could be truncated if the linker crashes. llvm-svn: 292532
* Apply clang-tidy's performance-unnecessary-value-param to LLVM.Benjamin Kramer2017-01-131-3/+4
| | | | | | | With some minor manual fixes for using function_ref instead of std::function. No functional change intended. llvm-svn: 291904
* [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] 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-052-18/+65
| | | | | | | | | | | | | | | | | | | | | | | | 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
* [lib/LTO] Simplify logic removing set but unused variable. NFCI.Davide Italiano2017-01-041-9/+3
| | | | | | | Reported by David Binderman and ack'ed by Teresa on IRC. PR: 31527 llvm-svn: 291000
* [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-163-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | 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-162-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 llvm-svn: 289957
* [LTO] Reject modules without datalayout.Davide Italiano2016-12-143-2/+5
| | | | | | | | | | | 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
* [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
* LTO: Add support for multi-module bitcode files.Peter Collingbourne2016-12-142-61/+117
| | | | | | Differential Revision: https://reviews.llvm.org/D27313 llvm-svn: 289621
* LTO: Port the legacy LTO API to ModuleSymbolTable.Peter Collingbourne2016-12-131-21/+19
| | | | | | Differential Revision: https://reviews.llvm.org/D27078 llvm-svn: 289576
* LTO: Port the new LTO API to ModuleSymbolTable.Peter Collingbourne2016-12-131-44/+48
| | | | | | Differential Revision: https://reviews.llvm.org/D27077 llvm-svn: 289574
* [ThinLTO] Import only necessary DICompileUnit fieldsTeresa Johnson2016-12-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed on mailing list, for ThinLTO importing we don't need to import all the fields of the DICompileUnit. Don't import enums, macros, retained types lists. Also only import local scoped imported entities. Since we don't currently import any global variables, we also don't need to import the list of global variables (added an assert to verify none are being imported). This is being done by pre-populating the value map entries to map the unneeded metadata to nullptr. For the imported entities, we can simply replace the source module's list with a new list containing only those needed imported entities. This is done in the IRLinker constructor so that value mapping automatically does the desired mapping. Reviewers: mehdi_amini, dexonsmith, dblaikie, aprantl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D27635 llvm-svn: 289441
* LTO: Hash the parts of the LTO configuration that affect code generation.Peter Collingbourne2016-12-081-3/+36
| | | | | | | | | Most importantly, we need to hash the relocation model, otherwise we can end up trying to link non-PIC object files into PIEs or DSOs. Differential Revision: https://reviews.llvm.org/D27556 llvm-svn: 289024
* [LTOs] Allow generation of hotness informationAdam Nemet2016-12-022-0/+13
| | | | | | | | The flag is passed by the clang driver. Differential Revision: https://reviews.llvm.org/D27331 llvm-svn: 288519
* 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
* LTO: Remove ModuleLoader, make loadModuleFromBuffer static and move into its ↵Peter Collingbourne2016-12-012-21/+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
* LTO: Remove Symbol::getIRName().Peter Collingbourne2016-12-011-1/+4
| | | | | | | Its only use was in the LTO implementation. Also document Symbol::getName(). llvm-svn: 288302
* [LTO] Move finishOptimizationRemarks after codegenAdam Nemet2016-11-281-2/+2
| | | | | | This addresses the comment D26832. llvm-svn: 288041
* [lib/LTO] Rename few instances of Lto to LTO.Davide Italiano2016-11-241-6/+6
| | | | llvm-svn: 287840
* Rename option to -lto-pass-remarks-outputAdam Nemet2016-11-221-1/+1
| | | | | | | The new option -pass-remarks-output broke LLVM_LINK_LLVM_DYLIB because of the duplicate option name with opt. llvm-svn: 287627
* Give some helper classes/functions internal linkage. NFC.Benjamin Kramer2016-11-191-0/+4
| | | | llvm-svn: 287462
* [ThinLTO] Implement -pass-remarks-output in ThinLTOCodeGeneratorMehdi Amini2016-11-192-7/+34
| | | | | | | | | | | | | | 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
* Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)Mehdi Amini2016-11-191-1/+1
| | | | | | | | | | | | | | Summary: This makes it explicit that ownership is taken. Also replace all `new` with make_unique<> at call sites. Reviewers: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D26884 llvm-svn: 287449
* [LTO] Add option to generate optimization recordsAdam Nemet2016-11-181-0/+34
| | | | | | | | | | It is used to drive this from the clang driver via -mllvm. Same option name is used as in opt. Differential Revision: https://reviews.llvm.org/D26832 llvm-svn: 287356
* [CMake] NFC. Updating CMake dependency specificationsChris Bieneman2016-11-171-2/+3
| | | | | | This patch updates a bunch of places where add_dependencies was being explicitly called to add dependencies on intrinsics_gen to instead use the DEPENDS named parameter. This cleanup is needed for a patch I'm working on to add a dependency debugging mode to the build system. llvm-svn: 287206
* [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
* Bitcode: Change module reader functions to return an llvm::Expected.Peter Collingbourne2016-11-133-43/+25
| | | | | | Differential Revision: https://reviews.llvm.org/D26562 llvm-svn: 286752
OpenPOWER on IntegriCloud