diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index 2f230439b96a..f864cd2b6f30 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1416,7 +1416,7 @@ static void writeMetadataRecords(ArrayRef MDs, #include "llvm/IR/Metadata.def" } } - writeValueAsMetadata(cast(MD), VE, Stream, Record); + writeValueAsMetadata(cast(MD), VE, Stream, Record); } } @@ -1441,11 +1441,8 @@ static void writeFunctionMetadata(const Function &F, const ValueEnumerator &VE, return; Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3); - SmallVector Record; - for (const Metadata *MD : VE.getFunctionMDs()) - writeValueAsMetadata(cast(MD), VE, Stream, Record); - + writeMetadataRecords(MDs, VE, Stream, Record); Stream.ExitBlock(); }