[llvm] r291379 - [ThinLTO] Fix lazy-loading of Metadata attachment, which left some Fwd ref behind

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 7 16:44:45 PST 2017


Author: mehdi_amini
Date: Sat Jan  7 18:44:45 2017
New Revision: 291379

URL: http://llvm.org/viewvc/llvm-project?rev=291379&view=rev
Log:
[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)

Modified:
    llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp?rev=291379&r1=291378&r2=291379&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/MetadataLoader.cpp Sat Jan  7 18:44:45 2017
@@ -1561,6 +1561,7 @@ Error MetadataLoader::MetadataLoaderImpl
     return error("Invalid record");
 
   SmallVector<uint64_t, 64> Record;
+  PlaceholderQueue Placeholders;
 
   while (true) {
     BitstreamEntry Entry = Stream.advanceSkippingSubblocks();
@@ -1570,6 +1571,7 @@ Error MetadataLoader::MetadataLoaderImpl
     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
             !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);
         }




More information about the llvm-commits mailing list