diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-11-03 01:07:16 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-11-03 01:07:16 +0000 |
commit | 0515fb8d4b2dbfce4fc960abb08a8d9d2f48fe2b (patch) | |
tree | 9727e2c6a127abae389e08bb240db185c8d55fa0 /llvm/lib/Transforms/Utils | |
parent | ef09aa9023ff2b469eac95eeb6e650ebc1fd4a97 (diff) | |
download | bcm5719-llvm-0515fb8d4b2dbfce4fc960abb08a8d9d2f48fe2b.tar.gz bcm5719-llvm-0515fb8d4b2dbfce4fc960abb08a8d9d2f48fe2b.zip |
[ThinLTO] Handle distributed backend case when doing renaming
Summary:
The recent change I made to consult the summary when deciding whether to
rename (to handle inline asm) in r285513 broke the distributed build
case. In a distributed backend we will only have a portion of the
combined index, specifically for imported modules we only have the
summaries for any imported definitions. When renaming on import we were
asserting because no summary entry was found for a local reference being
linked in (def wasn't imported).
We only need to consult the summary for a renaming decision for the
exporting module. For imports, we would have prevented importing any
references to NoRename values already.
Reviewers: mehdi_amini
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D26250
llvm-svn: 285871
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r-- | llvm/lib/Transforms/Utils/FunctionImportUtils.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp index b9b3606ecfb..d1710feba9d 100644 --- a/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp +++ b/llvm/lib/Transforms/Utils/FunctionImportUtils.cpp @@ -67,10 +67,25 @@ bool FunctionImportGlobalProcessing::shouldPromoteLocalToGlobal( if (GVar && GVar->isConstant() && GVar->hasGlobalUnnamedAddr()) return false; - auto *Summary = ImportIndex.getGlobalValueSummary(SGV->getGUID()); - assert(Summary && "Missing summary for global value"); - if (Summary->noRename()) - return false; + // If we are exporting, we need to see whether this value is marked + // as NoRename in the summary. If we are importing, we may not have + // a summary in the distributed backend case (only summaries for values + // importes as defs, not references, are included in the index passed + // to the distributed backends). + auto Summaries = ImportIndex.findGlobalValueSummaryList(SGV->getGUID()); + if (Summaries == ImportIndex.end()) + // Assert that this is an import - we should always have access to the + // summary when exporting. + assert(isPerformingImport() && + "Missing summary for global value when exporting"); + else { + assert(Summaries->second.size() == 1 && "Local has more than one summary"); + if (Summaries->second.front()->noRename()) { + assert((isModuleExporting() || !GlobalsToImport->count(SGV)) && + "Imported a non-renamable local value"); + return false; + } + } // Eventually we only need to promote functions in the exporting module that // are referenced by a potentially exported function (i.e. one that is in the |