diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index a33216d1852..e402f93ec17 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -126,11 +126,7 @@ static void findExternalCalls(const Module &DestModule, Function &F, if (CalledFunction->hasInternalLinkage()) { ImportedName = Renamed; } - // 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); + auto It = CalledFunctions.insert(ImportedName); if (!It.second) { // This is a call to a function we already considered, skip. continue; @@ -217,12 +213,14 @@ static void GetImportList(Module &DestModule, GlobalValue *SGV = SrcModule.getNamedValue(CalledFunctionName); if (!SGV) { - // 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 + // 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 // name in the source module. - std::pair<StringRef, StringRef> Split = CalledFunctionName.split(":"); - SGV = SrcModule.getNamedValue(Split.second); + std::pair<StringRef, StringRef> Split = + CalledFunctionName.split(".llvm."); + SGV = SrcModule.getNamedValue(Split.first); assert(SGV && "Can't find function to import in source module"); } if (!SGV) { |