summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[ThinLTO] Renaming of function index to module summary index (NFC)"Teresa Johnson2016-03-141-7/+7
| | | | | | This reverts commit r263490. Missed a file. llvm-svn: 263493
* [ThinLTO] Renaming of function index to module summary index (NFC)Teresa Johnson2016-03-141-7/+7
| | | | | | | | | | | | | With the changes in r263275, there are now more than just functions in the summary. Completed the renaming of data structures (started in r263275) to reflect the wider scope. In particular, changed the FunctionIndex* data structures to ModuleIndex*, and renamed related variables and comments. Also renamed the files to reflect the changes. A companion clang patch will immediately succeed this patch to reflect this renaming. llvm-svn: 263490
* Minor cleanup and documentation to IRMover (NFC)Mehdi Amini2016-03-111-20/+32
| | | | | From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 263304
* Materialize metadata in IRLinker before value mappingTeresa Johnson2016-03-101-5/+6
| | | | | | | | | | | | | | | | | | | Summary: Unless we plan to do later postpass metadata linking (ThinLTO special mode), always invoke metadata materialization at the start of IRLinker::run(). This avoids the need for clients who use lazy metadata loading to explicitly invoke materializeMetadata before the IRMover, which in turn invokes IRLinker::run and needs materialized metadata for mapping. Came up in the context of an LLD issue (D17982). Reviewers: rafael Subscribers: silvas, llvm-commits Differential Revision: http://reviews.llvm.org/D17992 llvm-svn: 263143
* FunctionIndex is not optional for renameModuleForThinLTO(), make it a ↵Mehdi Amini2016-03-091-1/+1
| | | | | | | reference (NFC) From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 262976
* Pass a std::unique_ptr to IRMover::move.Rafael Espindola2016-02-162-55/+57
| | | | | | | It was already the one "destroying" the source module, now the API reflects that. llvm-svn: 260989
* Delete the deprecated LLVMLinkModules.Rafael Espindola2016-02-121-34/+0
| | | | llvm-svn: 260683
* [ThinLTO] Move global processing from Linker to TransformUtils (NFC)Teresa Johnson2016-02-101-294/+6
| | | | | | | | | | | | | | | Summary: As discussed on IRC, move the ThinLTOGlobalProcessing code out of the linker, and into TransformUtils. The name of the class is changed to FunctionImportGlobalProcessing. Reviewers: joker.eph, rafael Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D17081 llvm-svn: 260395
* [ThinLTO] Remove imported available externally defs from comdats.Teresa Johnson2016-02-081-2/+14
| | | | | | | | | | | | | | | Summary: Available externally definitions are considered declarations for the linker and eventually dropped. As such they are not allowed to be in comdats. Remove any such imported functions from comdats. Reviewers: rafael Subscribers: davidxl, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D16120 llvm-svn: 260122
* Improve efficiency of handling unmapped subprogram metadataTeresa Johnson2016-01-281-25/+28
| | | | | | | | | | | | | | | | The stripNullSubprograms function is very inefficient because it walks all subprograms in all compile units in the dest module any time a new module is linked in. For LTO in particular this will get increasingly expensive as more modules are linked. This patch improves the efficiency in several ways. The first is that no scanning is necessary when there were no unneeded subprograms identified in the first place. The second is that only the newly-linked module's compile unit metadata should be examined. Fixes PR26346. llvm-svn: 259049
* Remove autoconf supportChris Bieneman2016-01-261-15/+0
| | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened." - Obi Wan Kenobi Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16471 llvm-svn: 258861
* [ThinLTO] Find all needed metadata when linking metadata as postpassTeresa Johnson2016-01-251-6/+27
| | | | | | | | | For metadata postpass linking, after importing all functions, we need to recursively walk through any nodes reached via imported functions to locate needed subprogram metadata. Some might only be reached indirectly via the variable list for an inlined function. llvm-svn: 258728
* [ThinLTO] Handle DISubprogram reached indirectly from DIImportedEntityTeresa Johnson2016-01-251-2/+4
| | | | | | | Extend fix for PR26037 to identify DISubprogram reached from a DIImportedEntity via a DILexicalBlock. llvm-svn: 258722
* [ThinLTO] Do metadata linking during batch function importingTeresa Johnson2016-01-221-2/+0
| | | | | | | | | | | | | | | | | | | | Summary: Since we are currently not doing incremental importing there is no need to link metadata as a postpass. The module linker will only link in the imported subroutines due to the functionality added by r256003. (Note that the metadata postpass linking functionalitiy is still used by llvm-link, and may be needed here in the future if a more incremental strategy is adopted.) Reviewers: joker.eph Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D16424 llvm-svn: 258458
* Use early return to simplify code (NFC)Teresa Johnson2016-01-211-22/+21
| | | | | | Follow on to r258405. llvm-svn: 258407
* [ThinLTO] Avoid unnecesary hash lookups during metadata linking (NFC)Teresa Johnson2016-01-211-16/+16
| | | | | | | Replace sequences of count() followed by operator[] with either find() or insert(), depending on the context. llvm-svn: 258405
* Remove redundant argument.Rafael Espindola2016-01-211-3/+3
| | | | | | It is already a member variable. llvm-svn: 258369
* Simplify the logic. NFC.Rafael Espindola2016-01-201-19/+2
| | | | | | Found while reviewing the change for PR26152. llvm-svn: 258362
* Fix PR26152.Evgeniy Stepanov2016-01-201-1/+1
| | | | | | | | Fix the condition for when the new global takes over the name of the existing one to be the negation of the condition for the new global to get internal linkage. llvm-svn: 258355
* GlobalValue: use getValueType() instead of getType()->getPointerElementType().Manuel Jacob2016-01-162-12/+10
| | | | | | | | | | | | Reviewers: mjacob Subscribers: jholewinski, arsenm, dsanders, dblaikie Patch by Eduard Burtescu. Differential Revision: http://reviews.llvm.org/D16260 llvm-svn: 257999
* [IRMover] Don't copy personality, etc unless creating defTeresa Johnson2016-01-121-0/+10
| | | | | | | | | | | | | | Function::copyAttributesFrom will copy the personality function, prefix data and prolog data from the source function to the new function, and is invoked when the IRMover copies the function prototype. This puts a reference to a constant in the source module on a function in the dest module, which causes an error when deleting the source module after importing, since the personality function in the source module still has uses (this would presumably also be an issue for the prologue and prefix data). Remove the copies added to the dest copy when creating the new prototype, as they are mapped properly when/if we link the function body. llvm-svn: 257420
* [ThinLTO] Use new in-place symbol changes for exporting moduleTeresa Johnson2016-01-081-7/+3
| | | | | | | | | | | | | | Due to the new in-place ThinLTO symbol handling support added in r257174, we now invoke renameModuleForThinLTO on the current module from within the FunctionImport pass. Additionally, renameModuleForThinLTO no longer needs to return the Module as it is performing the renaming in place on the one provided. This commit will be immediately preceeded by a companion clang patch to remove its invocation of renameModuleForThinLTO. llvm-svn: 257181
* [ThinLTO] Enable in-place symbol changes for exporting moduleTeresa Johnson2016-01-081-39/+114
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Move ThinLTO global value processing functions out of ModuleLinker and into a new ThinLTOGlobalProcessor class, which performs any necessary linkage and naming changes on the given module in place. As a result, renameModuleForThinLTO no longer needs to create a new Module when performing any necessary local to global promotion on a module that we are possibly exporting from during a ThinLTO backend compilation. During function importing the ThinLTO processing is still invoked from the ModuleLinker (via the new class), as it needs to perform renaming and linkage changes on the source module, e.g. in order to get the correct renaming during local to global promotion. Reviewers: joker.eph Subscribers: davidxl, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D15696 llvm-svn: 257174
* [Linker] Also treat a DIImportedEntity scope DISubprogram as needed.Ahmed Bougacha2016-01-071-1/+3
| | | | | | | | | Follow-up to r257000: DIImportedEntity can reach a DISubprogram via its entity, but also via its scope. Handle the latter case as well. PR26037. llvm-svn: 257019
* Always treat DISubprogram reached by DIImportedEntity as needed.Teresa Johnson2016-01-071-1/+11
| | | | | | | | | | It is illegal to have a null entity in a DIImportedEntity, so we must link in a DISubprogram metadata node referenced by one, even if the associated function is not linked in or inlined anywhere. Fixes PR26037. llvm-svn: 257000
* [ThinLTO] Rename variables used in metadata linking (NFC)Teresa Johnson2015-12-301-2/+4
| | | | | | | | As suggested in review for r255909, rename MDMaterialized to AllowTemps, and identify the name of the boolean flag being set in calls to saveMetadataList. llvm-svn: 256653
* Ensure MDNode used as key in metadata linking map cannot be RAUWedTeresa Johnson2015-12-301-0/+17
| | | | | | | | | | | | As suggested in review for r255909, add a way to ensure that temporary MD used as keys in the MetadataToID map during ThinLTO importing are not RAUWed. Add support for marking an MDNode as not replaceable. Clear the new CanReplace flag when adding a temporary MD node to the MetadataToID map and clear it when destroying the map. llvm-svn: 256648
* Rename MDValue* to Metadata* (NFC)Teresa Johnson2015-12-291-10/+10
| | | | | | | Renamed MDValue* to Metadata*, and MDValueToValIDMap to MetadataToIDs, as per review for r255909. llvm-svn: 256593
* Handle empty Subprogram list when linking metadata.Teresa Johnson2015-12-221-1/+1
| | | | | | | | Use an iterator that handles an empty subprogram list. Fixes PR25915. llvm-svn: 256224
* [ThinLTO] Rename variable to reflect bulk importing change (NFC)Teresa Johnson2015-12-211-10/+11
| | | | llvm-svn: 256171
* Remove unused functions from ModuleLinker (NFC)Teresa Johnson2015-12-211-54/+0
| | | | | | | Remove a couple ModuleLinker methods and a related static function that are no longer used after the linker split. llvm-svn: 256162
* Drop support for dematerializing.Rafael Espindola2015-12-181-1/+0
| | | | | | | It was only used on lib/Linker and the use was "dead" since it was used on a function the IRMover had just moved. llvm-svn: 256019
* Rename variables to reflect linker split (NFC)Teresa Johnson2015-12-182-22/+22
| | | | | | | | Renamed variables to be more reflective of whether they are an instance of Linker, IRLinker or ModuleLinker. Also fix a stale comment. llvm-svn: 256011
* [ThinLTO/LTO] Don't link in unneeded metadataTeresa Johnson2015-12-181-0/+107
| | | | | | | | | | | | | | | | | | | | Summary: Third patch split out from http://reviews.llvm.org/D14752. Only map in needed DISubroutine metadata (imported or otherwise linked in functions and other DISubroutine referenced by inlined instructions). This is supported for ThinLTO, LTO and llvm-link --only-needed, with associated tests for each one. Depends on D14838. Reviewers: dexonsmith, joker.eph Subscribers: davidxl, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D14843 llvm-svn: 256003
* [ThinLTO] Metadata linking for imported functionsTeresa Johnson2015-12-172-31/+212
| | | | | | | | | | | | | | | | | | | | | | | Summary: Second patch split out from http://reviews.llvm.org/D14752. Maps metadata as a post-pass from each module when importing complete, suturing up final metadata to the temporary metadata left on the imported instructions. This entails saving the mapping from bitcode value id to temporary metadata in the importing pass, and from bitcode value id to final metadata during the metadata linking postpass. Depends on D14825. Reviewers: dexonsmith, joker.eph Subscribers: davidxl, llvm-commits, joker.eph Differential Revision: http://reviews.llvm.org/D14838 llvm-svn: 255909
* Mark a couple ModuleLinker member functions as const (NFC)Teresa Johnson2015-12-171-2/+2
| | | | llvm-svn: 255903
* Change linkInModule to take a std::unique_ptr.Rafael Espindola2015-12-161-7/+21
| | | | | | | Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. llvm-svn: 255842
* Use diagnostic handler in the LLVMContextRafael Espindola2015-12-142-28/+30
| | | | | | | | | | | | | | | | This patch converts code that has access to a LLVMContext to not take a diagnostic handler. This has a few advantages * It is easier to use a consistent diagnostic handler in a single program. * Less clutter since we are not passing a handler around. It does make it a bit awkward to implement some C APIs that return a diagnostic string. I will propose new versions of these APIs and deprecate the current ones. llvm-svn: 255571
* Fix another case where the linkage was not set.Rafael Espindola2015-12-101-1/+1
| | | | llvm-svn: 255272
* Avoid undefined behavior when vector is empty.Rafael Espindola2015-12-101-2/+1
| | | | | | Found by ubsan. llvm-svn: 255258
* Slit lib/Linker in two.Rafael Espindola2015-12-104-1273/+1510
| | | | | | | | | | | | | | | | A linker normally has two stages: symbol resolution and "moving stuff". In lib/Linker there is the complication of lazy linking some globals, but it was still far more mixed than it needed to. This splits the linker into a lower level IRMover and the linker proper. The IRMover just takes a list of globals to move and a callback that lets the user control what is lazy linked. The main motivation is that now tools/gold (and soon lld) can use their own symbol resolution to instruct IRMover what to do. llvm-svn: 255254
* Synchronize the logic for deciding to link a gv.Rafael Espindola2015-12-091-1/+6
| | | | | | | We were deciding to not link an available_externally gv over a declaration, but then copying over the body anyway. llvm-svn: 255169
* Move all private members together. NFC.Rafael Espindola2015-12-081-23/+22
| | | | llvm-svn: 255021
* Factor two calls to a common location.Rafael Espindola2015-12-071-7/+3
| | | | llvm-svn: 254967
* Simplify the error handling a bit. NFC.Rafael Espindola2015-12-071-10/+9
| | | | llvm-svn: 254952
* Link declaration lazily.Rafael Espindola2015-12-071-0/+3
| | | | | | | We already linked available_externally and linkonce lazily, this just adds declarations to the list. llvm-svn: 254917
* Change how the linker handles the old llvm.global_ctors.Rafael Espindola2015-12-071-92/+34
| | | | | | | | | | | | | | | | | Now instead of changing it to the new format and then linking, it just handles the old format while copying it over. The main differences are: * There is no rauw in the source module. * An old format input is always upgraded. The first item helps with having a sane API that passes in a GV list to the linker. The second one is a small step in deprecating the old format. llvm-svn: 254907
* [ThinLTO] Helper for performing renaming/promotion on a moduleTeresa Johnson2015-12-041-0/+12
| | | | | | | | | Creates a module and performs necessary renaming/promotion of locals that may be exported to another module. Split out of D15024. llvm-svn: 254802
* Always pass a diagnostic handler to the linker.Rafael Espindola2015-12-041-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | Before this patch the diagnostic handler was optional. If it was not passed, the one in the LLVMContext was used. That is probably not a pattern we want to follow. If each area has an optional callback, there is a sea of callbacks and it is hard to follow which one is called. Doing this also found cases where the callback is a nice addition, like testing that no errors or warnings are reported. The other option is to always use the diagnostic handler in the LLVMContext. That has a few problems * To implement the C API we would have to set the diag handler and then set it back to the original value. * Code that creates the context might be far away from code that wants the diagnostics. I do have a patch that implements the second option and will send that as an RFC. llvm-svn: 254777
* [ThinLTO] Appending linkage fixesTeresa Johnson2015-12-031-5/+9
| | | | | | | | | | | | | | | | | | | | Summary: Fix import from module with appending var, which cannot be imported. The first fix is to remove an overly-aggressive error check. The second fix is to deal with restructuring introduced to the module linker yesterday in r254418 (actually, this fix was included already in r254559, just added some additional cleanup). Test by Mehdi Amini. Reviewers: joker.eph, rafael Subscribers: joker.eph, llvm-commits Differential Revision: http://reviews.llvm.org/D15156 llvm-svn: 254624
OpenPOWER on IntegriCloud