diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-20 01:04:20 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2016-04-20 01:04:20 +0000 |
commit | 6968ef773bbc4263e420e8d05ed16801021fdc09 (patch) | |
tree | 595f17199a137bc67e78ff02f4677a135c378796 /llvm/lib/Transforms/IPO/FunctionImport.cpp | |
parent | f12609c9ed12e5d56a735dbd88c70a776dd64eec (diff) | |
download | bcm5719-llvm-6968ef773bbc4263e420e8d05ed16801021fdc09.tar.gz bcm5719-llvm-6968ef773bbc4263e420e8d05ed16801021fdc09.zip |
ThinLTO: Move alias importing decision on the summary
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266845
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 0c714dff3e0..eef7385dd08 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -163,10 +163,20 @@ static void computeImportForFunction( } // "Resolve" the summary, traversing alias, const FunctionSummary *ResolvedCalleeSummary; - if (isa<AliasSummary>(CalleeSummary)) + if (isa<AliasSummary>(CalleeSummary)) { ResolvedCalleeSummary = cast<FunctionSummary>( &cast<AliasSummary>(CalleeSummary)->getAliasee()); - else + if (!GlobalValue::isLinkOnceODRLinkage( + ResolvedCalleeSummary->linkage())) { + // Alias can't point to "available_externally". However when we import + // linkOnceODR the linkage does not change. So we import the alias + // and aliasee only in this case. + // FIXME: we should import alias as available_externally *function*, the + // destination module does need to know it is an alias. + DEBUG(dbgs() << "ignored! Aliasee is not linkonce_odr.\n"); + continue; + } + } else ResolvedCalleeSummary = cast<FunctionSummary>(CalleeSummary); assert(ResolvedCalleeSummary->instCount() <= Threshold && @@ -380,10 +390,11 @@ bool FunctionImporter::importFunctions( if (Import) { // Alias can't point to "available_externally". However when we import // linkOnceODR the linkage does not change. So we import the alias - // and aliasee only in this case. + // and aliasee only in this case. This has been handled by + // computeImportForFunction() GlobalObject *GO = GV.getBaseObject(); - if (!GO->hasLinkOnceODRLinkage()) - continue; + assert(GO->hasLinkOnceODRLinkage() && + "Unexpected alias to a non-linkonceODR in import list"); #ifndef NDEBUG if (!GlobalsToImport.count(GO)) DEBUG(dbgs() << " alias triggers importing aliasee " << GO->getGUID() |