Fix the bitcode reader to clear out function-specific state
authorDan Gohman <gohman@apple.com>
Wed, 25 Aug 2010 20:22:53 +0000 (20:22 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 25 Aug 2010 20:22:53 +0000 (20:22 +0000)
from MDValueList between each function, now that the bitcode
writer is reusing the index space for function-local metadata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112082 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Reader/BitcodeReader.cpp

index 63c85974e45496a7685487f7e1aaa98e917ef2ad..0d961c3ab91d174d00d3bfdc1f961c801ae04a4f 100644 (file)
@@ -1636,6 +1636,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
 
   InstructionList.clear();
   unsigned ModuleValueListSize = ValueList.size();
+  unsigned ModuleMDValueListSize = MDValueList.size();
 
   // Add all the function arguments to the value table.
   for(Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
@@ -2353,6 +2354,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
   
   // Trim the value list down to the size it was before we parsed this function.
   ValueList.shrinkTo(ModuleValueListSize);
+  MDValueList.shrinkTo(ModuleMDValueListSize);
   std::vector<BasicBlock*>().swap(FunctionBBs);
 
   return false;