diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-02-10 21:55:02 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-02-10 21:55:02 +0000 |
commit | e1164de5d0c9ae28a943d07eaf8e75f24bfb2d4a (patch) | |
tree | 7b7037f3104679a3f051dd24575543e75180b572 /llvm/lib/Transforms/IPO | |
parent | 3e58a6a7b2b6f6af9ac2b091909e829fe5a21a99 (diff) | |
download | bcm5719-llvm-e1164de5d0c9ae28a943d07eaf8e75f24bfb2d4a.tar.gz bcm5719-llvm-e1164de5d0c9ae28a943d07eaf8e75f24bfb2d4a.zip |
Restore "[ThinLTO] Use MD5 hash in function index." with fix
This restores commit r260408, along with a fix for a bot failure.
The bot failure was caused by dereferencing a unique_ptr in the same
call instruction parameter list where it was passed via std::move.
Apparently due to luck this was not exposed when I built the compiler
with clang, only with gcc.
llvm-svn: 260442
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index e402f93ec17..a33216d1852 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -126,7 +126,11 @@ static void findExternalCalls(const Module &DestModule, Function &F, if (CalledFunction->hasInternalLinkage()) { ImportedName = Renamed; } - auto It = CalledFunctions.insert(ImportedName); + // Compute the global identifier used in the function index. + auto CalledFunctionGlobalID = Function::getGlobalIdentifier( + CalledFunction->getName(), CalledFunction->getLinkage(), + CalledFunction->getParent()->getSourceFileName()); + auto It = CalledFunctions.insert(CalledFunctionGlobalID); if (!It.second) { // This is a call to a function we already considered, skip. continue; @@ -213,14 +217,12 @@ static void GetImportList(Module &DestModule, GlobalValue *SGV = SrcModule.getNamedValue(CalledFunctionName); if (!SGV) { - // The destination module is referencing function using their renamed name - // when importing a function that was originally local in the source - // module. The source module we have might not have been renamed so we try - // to remove the suffix added during the renaming to recover the original + // The function is referenced by a global identifier, which has the + // source file name prepended for functions that were originally local + // in the source module. Strip any prepended name to recover the original // name in the source module. - std::pair<StringRef, StringRef> Split = - CalledFunctionName.split(".llvm."); - SGV = SrcModule.getNamedValue(Split.first); + std::pair<StringRef, StringRef> Split = CalledFunctionName.split(":"); + SGV = SrcModule.getNamedValue(Split.second); assert(SGV && "Can't find function to import in source module"); } if (!SGV) { |