llvm.org GIT mirror llvm / 44f8ddb
[ThinLTO] Use new in-place symbol changes for exporting module Due to the new in-place ThinLTO symbol handling support added in r257174, we now invoke renameModuleForThinLTO on the current module from within the FunctionImport pass. Additionally, renameModuleForThinLTO no longer needs to return the Module as it is performing the renaming in place on the one provided. This commit will be immediately preceeded by a companion clang patch to remove its invocation of renameModuleForThinLTO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257181 91177308-0d34-0410-b5e6-96231b3b80d8 Teresa Johnson 4 years ago
3 changed file(s) with 11 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
6868
6969 /// Perform in-place global value handling on the given Module for
7070 /// exported local functions renamed and promoted for ThinLTO.
71 std::unique_ptr renameModuleForThinLTO(std::unique_ptr M,
72 const FunctionInfoIndex *Index);
71 bool renameModuleForThinLTO(Module &M, const FunctionInfoIndex *Index);
7372
7473 } // End llvm namespace
7574
862862 return L.linkInModule(std::move(Src), Flags);
863863 }
864864
865 std::unique_ptr
866 llvm::renameModuleForThinLTO(std::unique_ptr M,
867 const FunctionInfoIndex *Index) {
868 ThinLTOGlobalProcessing ThinLTOProcessing(*M, Index);
869 if (ThinLTOProcessing.run())
870 return nullptr;
871 return M;
865 bool llvm::renameModuleForThinLTO(Module &M, const FunctionInfoIndex *Index) {
866 ThinLTOGlobalProcessing ThinLTOProcessing(M, Index);
867 return ThinLTOProcessing.run();
872868 }
873869
874870 //===----------------------------------------------------------------------===//
412412 Index = IndexPtr.get();
413413 }
414414
415 // First we need to promote to global scope and rename any local values that
416 // are potentially exported to other modules.
417 if (renameModuleForThinLTO(M, Index)) {
418 errs() << "Error renaming module\n";
419 return false;
420 }
421
415422 // Perform the import now.
416423 auto ModuleLoader = [&M](StringRef Identifier) {
417424 return loadFile(Identifier, M.getContext());
418425 };
419426 FunctionImporter Importer(*Index, ModuleLoader);
420427 return Importer.importFunctions(M);
421
422 return false;
423428 }
424429 };
425430 } // anonymous namespace