summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker
diff options
context:
space:
mode:
authorEugene Leviant <eleviant@accesssoftek.com>2018-02-16 08:11:04 +0000
committerEugene Leviant <eleviant@accesssoftek.com>2018-02-16 08:11:04 +0000
commit7331a0bf1c96a99bb47ecbdf9081e53f822eca66 (patch)
treed2f2927d5381f9c37e2039a8c86e56370fdfdf09 /llvm/lib/Linker
parent3e2ae49a25f80a24e6cb5efdcb9c4caf42ba95ae (diff)
downloadbcm5719-llvm-7331a0bf1c96a99bb47ecbdf9081e53f822eca66.tar.gz
bcm5719-llvm-7331a0bf1c96a99bb47ecbdf9081e53f822eca66.zip
[ThinLTO] Import global variables
Differential revision: https://reviews.llvm.org/D43077 llvm-svn: 325320
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r--llvm/lib/Linker/IRMover.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index ec15bbfc658..42081442db7 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1051,14 +1051,10 @@ void IRLinker::prepareCompileUnitsForImport() {
ValueMap.MD()[CU->getRawEnumTypes()].reset(nullptr);
ValueMap.MD()[CU->getRawMacros()].reset(nullptr);
ValueMap.MD()[CU->getRawRetainedTypes()].reset(nullptr);
- // If we ever start importing global variable defs, we'll need to
- // add their DIGlobalVariable to the globals list on the imported
- // DICompileUnit. Confirm none are imported, and then we can
- // map the list of global variables to nullptr.
- assert(none_of(
- ValuesToLink,
- [](const GlobalValue *GV) { return isa<GlobalVariable>(GV); }) &&
- "Unexpected importing of a GlobalVariable definition");
+ // We import global variables only temporarily in order for instcombine
+ // and globalopt to perform constant folding and static constructor
+ // evaluation. After that elim-avail-extern will covert imported globals
+ // back to declarations, so we don't need debug info for them.
ValueMap.MD()[CU->getRawGlobalVariables()].reset(nullptr);
// Imported entities only need to be mapped in if they have local
OpenPOWER on IntegriCloud