[llvm-commits] [llvm] r93403 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Victor Hernandez vhernandez at apple.com
Wed Jan 13 17:50:09 PST 2010


Author: hernande
Date: Wed Jan 13 19:50:08 2010
New Revision: 93403

URL: http://llvm.org/viewvc/llvm-project?rev=93403&view=rev
Log:
In WriteFunction(), write function-local metadata before we write the instructions, so instruction's references to metadata are fully resolved by the time they get written.

Modified:
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=93403&r1=93402&r2=93403&view=diff

==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Jan 13 19:50:08 2010
@@ -1226,6 +1226,9 @@
   VE.getFunctionConstantRange(CstStart, CstEnd);
   WriteConstants(CstStart, CstEnd, VE, Stream, false);
 
+  // If there is function-local metadata, emit it now.
+  WriteFunctionLocalMetadata(VE, Stream);
+
   // Keep a running idea of what the instruction ID is.
   unsigned InstID = CstEnd;
 
@@ -1241,7 +1244,6 @@
   // Emit names for all the instructions etc.
   WriteValueSymbolTable(F.getValueSymbolTable(), VE, Stream);
 
-  WriteFunctionLocalMetadata(VE, Stream);
   WriteMetadataAttachment(F, VE, Stream);
   VE.purgeFunction();
   Stream.ExitBlock();





More information about the llvm-commits mailing list