In WriteFunction(), write function-local metadata before we write the instructions...
authorVictor Hernandez <vhernandez@apple.com>
Thu, 14 Jan 2010 01:50:08 +0000 (01:50 +0000)
committerVictor Hernandez <vhernandez@apple.com>
Thu, 14 Jan 2010 01:50:08 +0000 (01:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93403 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Writer/BitcodeWriter.cpp

index 5318b51bba61097baced43289fdcddedff2541a1..c71f676d4b7ce3ea5e9e9fbd152792106ea57fcd 100644 (file)
@@ -1226,6 +1226,9 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
   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 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
   // Emit names for all the instructions etc.
   WriteValueSymbolTable(F.getValueSymbolTable(), VE, Stream);
 
-  WriteFunctionLocalMetadata(VE, Stream);
   WriteMetadataAttachment(F, VE, Stream);
   VE.purgeFunction();
   Stream.ExitBlock();