From 7b0d145768fe907fd8e46d102cee006f06400430 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sun, 8 Jan 2017 00:44:45 +0000 Subject: [PATCH] [ThinLTO] Fix lazy-loading of Metadata attachment, which left some Fwd ref behind The change in r291362 was too agressive. We still need to flush at the end of the block because function local metadata can introduce fwd ref as well. (Bootstrap with ThinLTO was broken) llvm-svn: 291379 --- llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp index 89edbbef92ef..4a5d18e2db75 100644 --- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp @@ -1561,6 +1561,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseMetadataAttachment( return error("Invalid record"); SmallVector Record; + PlaceholderQueue Placeholders; while (true) { BitstreamEntry Entry = Stream.advanceSkippingSubblocks(); @@ -1570,6 +1571,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseMetadataAttachment( case BitstreamEntry::Error: return error("Malformed block"); case BitstreamEntry::EndBlock: + resolveForwardRefsAndPlaceholders(Placeholders); return Error::success(); case BitstreamEntry::Record: // The interesting case. @@ -1608,7 +1610,6 @@ Error MetadataLoader::MetadataLoaderImpl::parseMetadataAttachment( !MetadataList.lookup(Idx)) { // Load the attachment if it is in the lazy-loadable range and hasn't // been loaded yet. - PlaceholderQueue Placeholders; lazyLoadOneMetadata(Idx, Placeholders); resolveForwardRefsAndPlaceholders(Placeholders); }