From 9abe1089c7863a02b86bc39e571522de98a97b0a Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Thu, 3 Dec 2015 02:37:23 +0000 Subject: Remove "ExportingModule" from ThinLTO Index (NFC) There is no real reason the index has to have the concept of an exporting Module. We should be able to have one single unique instance of the Index, and it should be read-only after creation for the whole ThinLTO processing. The linker plugin should be able to process multiple modules (in parallel or in sequence) with the same index. The only reason the ExportingModule was present seems to be to implement hasExportedFunctions() that is used by the Module linker to decide what to do with the current Module. For now I replaced it with a query to the map of Modules path to see if this module was declared in the Index and consider that if it is the case then it is probably exporting function. On the long term the Linker interface needs to evolve and this call should not be needed anymore. From: Mehdi Amini llvm-svn: 254581 --- llvm/lib/Object/FunctionIndexObjectFile.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Object/FunctionIndexObjectFile.cpp') diff --git a/llvm/lib/Object/FunctionIndexObjectFile.cpp b/llvm/lib/Object/FunctionIndexObjectFile.cpp index 717c56b..fe111de 100644 --- a/llvm/lib/Object/FunctionIndexObjectFile.cpp +++ b/llvm/lib/Object/FunctionIndexObjectFile.cpp @@ -86,7 +86,7 @@ bool FunctionIndexObjectFile::hasFunctionSummaryInMemBuffer( ErrorOr> FunctionIndexObjectFile::create(MemoryBufferRef Object, DiagnosticHandlerFunction DiagnosticHandler, - const Module *ExportingModule, bool IsLazy) { + bool IsLazy) { std::unique_ptr Index; ErrorOr BCOrErr = findBitcodeInMemBuffer(Object); @@ -94,7 +94,7 @@ FunctionIndexObjectFile::create(MemoryBufferRef Object, return BCOrErr.getError(); ErrorOr> IOrErr = getFunctionInfoIndex( - BCOrErr.get(), DiagnosticHandler, ExportingModule, IsLazy); + BCOrErr.get(), DiagnosticHandler, IsLazy); if (std::error_code EC = IOrErr.getError()) return EC; @@ -125,8 +125,7 @@ std::error_code FunctionIndexObjectFile::findFunctionSummaryInMemBuffer( // index object if found, or nullptr if not. ErrorOr> llvm::getFunctionIndexForFile(StringRef Path, - DiagnosticHandlerFunction DiagnosticHandler, - const Module *ExportingModule) { + DiagnosticHandlerFunction DiagnosticHandler) { ErrorOr> FileOrErr = MemoryBuffer::getFileOrSTDIN(Path); std::error_code EC = FileOrErr.getError(); @@ -134,8 +133,7 @@ llvm::getFunctionIndexForFile(StringRef Path, return EC; MemoryBufferRef BufferRef = (FileOrErr.get())->getMemBufferRef(); ErrorOr> ObjOrErr = - object::FunctionIndexObjectFile::create(BufferRef, DiagnosticHandler, - ExportingModule); + object::FunctionIndexObjectFile::create(BufferRef, DiagnosticHandler); EC = ObjOrErr.getError(); if (EC) return EC; -- cgit v1.1