summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Linker')
-rw-r--r--llvm/lib/Linker/IRMover.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index 72e20ae0ba1..afbc57abfcc 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1062,6 +1062,16 @@ void IRLinker::prepareCompileUnitsForImport() {
ValueMap.MD()[CU->getRawEnumTypes()].reset(nullptr);
ValueMap.MD()[CU->getRawMacros()].reset(nullptr);
ValueMap.MD()[CU->getRawRetainedTypes()].reset(nullptr);
+ // The original definition (or at least its debug info - if the variable is
+ // internalized an optimized away) will remain in the source module, so
+ // there's no need to import them.
+ // If LLVM ever does more advanced optimizations on global variables
+ // (removing/localizing write operations, for instance) that can track
+ // through debug info, this decision may need to be revisited - but do so
+ // with care when it comes to debug info size. Emitting small CUs containing
+ // only a few imported entities into every destination module may be very
+ // size inefficient.
+ ValueMap.MD()[CU->getRawGlobalVariables()].reset(nullptr);
// Imported entities only need to be mapped in if they have local
// scope, as those might correspond to an imported entity inside a
OpenPOWER on IntegriCloud