diff options
author | Teresa Johnson <tejohnson@google.com> | 2015-12-17 17:14:09 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2015-12-17 17:14:09 +0000 |
commit | d0f8afa9b6d5bc8697c56f1b909cfce0e30eec9e (patch) | |
tree | 48cd2005cdf733ae9b1b1d7ab933750cb3e04cd2 /lib/IRReader | |
parent | 55618d8f5c5498672bc044ccfc32dcd4f76f8456 (diff) |
[ThinLTO] Metadata linking for imported functions
Summary:
Second patch split out from http://reviews.llvm.org/D14752.
Maps metadata as a post-pass from each module when importing complete,
suturing up final metadata to the temporary metadata left on the
imported instructions.
This entails saving the mapping from bitcode value id to temporary
metadata in the importing pass, and from bitcode value id to final
metadata during the metadata linking postpass.
Depends on D14825.
Reviewers: dexonsmith, joker.eph
Subscribers: davidxl, llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D14838
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IRReader')
-rw-r--r-- | lib/IRReader/IRReader.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/IRReader/IRReader.cpp b/lib/IRReader/IRReader.cpp index 43fee65db7f..9b243fc571d 100644 --- a/lib/IRReader/IRReader.cpp +++ b/lib/IRReader/IRReader.cpp @@ -31,11 +31,11 @@ static const char *const TimeIRParsingName = "Parse IR"; static std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err, - LLVMContext &Context) { + LLVMContext &Context, bool ShouldLazyLoadMetadata) { if (isBitcode((const unsigned char *)Buffer->getBufferStart(), (const unsigned char *)Buffer->getBufferEnd())) { - ErrorOr<std::unique_ptr<Module>> ModuleOrErr = - getLazyBitcodeModule(std::move(Buffer), Context); + ErrorOr<std::unique_ptr<Module>> ModuleOrErr = getLazyBitcodeModule( + std::move(Buffer), Context, ShouldLazyLoadMetadata); if (std::error_code EC = ModuleOrErr.getError()) { Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error, EC.message()); @@ -49,7 +49,8 @@ getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err, std::unique_ptr<Module> llvm::getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, - LLVMContext &Context) { + LLVMContext &Context, + bool ShouldLazyLoadMetadata) { ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr = MemoryBuffer::getFileOrSTDIN(Filename); if (std::error_code EC = FileOrErr.getError()) { @@ -58,7 +59,8 @@ std::unique_ptr<Module> llvm::getLazyIRFileModule(StringRef Filename, return nullptr; } - return getLazyIRModule(std::move(FileOrErr.get()), Err, Context); + return getLazyIRModule(std::move(FileOrErr.get()), Err, Context, + ShouldLazyLoadMetadata); } std::unique_ptr<Module> llvm::parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err, |