diff options
| author | Victor Hernandez <vhernandez@apple.com> | 2010-01-14 01:50:08 +0000 |
|---|---|---|
| committer | Victor Hernandez <vhernandez@apple.com> | 2010-01-14 01:50:08 +0000 |
| commit | 6c730dea6ffbfc345d1ef3bb81890740f9c0364e (patch) | |
| tree | f17cc92183e901589e1a403842257a021c075951 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
| parent | 61e6e829c69970a059700c66509b981b97385b03 (diff) | |
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.
llvm-svn: 93403
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
| -rw-r--r-- | llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 5318b51bba61..c71f676d4b7c 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -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(); |
