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/Bitcode/Reader/BitcodeReader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 11c9b13..e95aba7 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -5991,12 +5991,11 @@ llvm::getBitcodeProducerString(MemoryBufferRef Buffer, LLVMContext &Context, ErrorOr> llvm::getFunctionInfoIndex(MemoryBufferRef Buffer, DiagnosticHandlerFunction DiagnosticHandler, - const Module *ExportingModule, bool IsLazy) { + bool IsLazy) { std::unique_ptr Buf = MemoryBuffer::getMemBuffer(Buffer, false); FunctionIndexBitcodeReader R(Buf.get(), DiagnosticHandler, IsLazy); - std::unique_ptr Index = - llvm::make_unique(ExportingModule); + auto Index = llvm::make_unique(); auto cleanupOnError = [&](std::error_code EC) { R.releaseBuffer(); // Never take ownership on error. -- cgit v1.1