aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2010-01-14 01:50:08 +0000
committerVictor Hernandez <vhernandez@apple.com>2010-01-14 01:50:08 +0000
commit5fdf4646a4182c82810536b90f07a23d2137bba0 (patch)
treea2b0047670ffed3cf3a098a6c4bb7bdb2e2036dc /lib/Bitcode/Writer/BitcodeWriter.cpp
parent557fc83dbfc64eddc150049eea3d6c2280e0e37c (diff)
downloadexternal_llvm-5fdf4646a4182c82810536b90f07a23d2137bba0.zip
external_llvm-5fdf4646a4182c82810536b90f07a23d2137bba0.tar.gz
external_llvm-5fdf4646a4182c82810536b90f07a23d2137bba0.tar.bz2
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 5318b51..c71f676 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/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();