summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-04-20 17:47:42 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-04-20 17:47:42 +0000
commitd826bbbb0a803952b13da40ac5f2a53bd15d6f28 (patch)
treef224cb6fcad007ed085be9cd5450e3ce52c3d3f4 /llvm/lib/Linker/LinkModules.cpp
parentde120799a02806f7b88f39e9a934a5c491462158 (diff)
downloadbcm5719-llvm-d826bbbb0a803952b13da40ac5f2a53bd15d6f28.tar.gz
bcm5719-llvm-d826bbbb0a803952b13da40ac5f2a53bd15d6f28.zip
ModuleLinker: only import what is in GlobalsToImport, regarless if it is a function or not.
The alias handling was specific to the old iterative inlining mechanism, so that is dead now. The variable handling could make a difference, since we were previously falling through to the normal selection logic, but we don't observe changes in the validation because no client seems to rely on it. Differential Revision: http://reviews.llvm.org/D19307 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 266893
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r--llvm/lib/Linker/LinkModules.cpp28
1 files changed, 6 insertions, 22 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 07785d7a50f..cd3cd52f7ad 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -268,31 +268,15 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc,
return false;
}
- bool SrcIsDeclaration = Src.isDeclarationForLinker();
- bool DestIsDeclaration = Dest.isDeclarationForLinker();
-
if (isPerformingImport()) {
- if (isa<Function>(&Src)) {
- // For functions, LinkFromSrc iff this is a function requested
- // for importing. For variables, decide below normally.
- LinkFromSrc = GlobalsToImport->count(&Src);
- return false;
- }
-
- // Check if this is an alias with an already existing definition
- // in Dest, which must have come from a prior importing pass from
- // the same Src module. Unlike imported function and variable
- // definitions, which are imported as available_externally and are
- // not definitions for the linker, that is not a valid linkage for
- // imported aliases which must be definitions. Simply use the existing
- // Dest copy.
- if (isa<GlobalAlias>(&Src) && !DestIsDeclaration) {
- assert(isa<GlobalAlias>(&Dest));
- LinkFromSrc = false;
- return false;
- }
+ // LinkFromSrc iff this is a global requested for importing.
+ LinkFromSrc = GlobalsToImport->count(&Src);
+ return false;
}
+ bool SrcIsDeclaration = Src.isDeclarationForLinker();
+ bool DestIsDeclaration = Dest.isDeclarationForLinker();
+
if (SrcIsDeclaration) {
// If Src is external or if both Src & Dest are external.. Just link the
// external globals, we aren't adding anything.
OpenPOWER on IntegriCloud