summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IRReader
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2015-12-17 17:14:09 +0000
committerTeresa Johnson <tejohnson@google.com>2015-12-17 17:14:09 +0000
commite5a619173274bf2a9033ea1c8b2346f1bee2766b (patch)
treedf1a23654ddaef760e878af89977d13945649896 /llvm/lib/IRReader
parentcaaa3aa07c8fa129c8032597f2d0317637a1569a (diff)
downloadbcm5719-llvm-e5a619173274bf2a9033ea1c8b2346f1bee2766b.tar.gz
bcm5719-llvm-e5a619173274bf2a9033ea1c8b2346f1bee2766b.zip
[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 llvm-svn: 255909
Diffstat (limited to 'llvm/lib/IRReader')
-rw-r--r--llvm/lib/IRReader/IRReader.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/IRReader/IRReader.cpp b/llvm/lib/IRReader/IRReader.cpp
index 43fee65db7f..9b243fc571d 100644
--- a/llvm/lib/IRReader/IRReader.cpp
+++ b/llvm/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,
OpenPOWER on IntegriCloud