Make the side-numbering of instructions used by metadata (which is needed to
authorNick Lewycky <nicholas@mxc.ca>
Thu, 25 Feb 2010 08:30:17 +0000 (08:30 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Thu, 25 Feb 2010 08:30:17 +0000 (08:30 +0000)
keep track of instructions that return void) per-function. This fixes PR5278.

This breaks backwards compatibility with the metadata format. That's okay
because we haven't released the metadata bitcode yet.

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

lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/ValueEnumerator.cpp

index 4ac5069eb4460b67250070be23e7cbc462099b7f..a32883720be382907a24d6c1323d149eb9cca339 100644 (file)
@@ -1622,6 +1622,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
   if (Stream.EnterSubBlock(bitc::FUNCTION_BLOCK_ID))
     return Error("Malformed block record");
 
+  InstructionList.clear();
   unsigned ModuleValueListSize = ValueList.size();
 
   // Add all the function arguments to the value table.
index b56c8621fd801264c1dfff44d50e950f165280a4..aa4c3afab40ec748f5f6e9b43c8a6aa7a6bd55ca 100644 (file)
@@ -39,8 +39,6 @@ static bool CompareByFrequency(const std::pair<const llvm::Type*,
 
 /// ValueEnumerator - Enumerate module-level information.
 ValueEnumerator::ValueEnumerator(const Module *M) {
-  InstructionCount = 0;
-
   // Enumerate the global variables.
   for (Module::const_global_iterator I = M->global_begin(),
          E = M->global_end(); I != E; ++I)
@@ -377,6 +375,7 @@ void ValueEnumerator::EnumerateAttributes(const AttrListPtr &PAL) {
 
 
 void ValueEnumerator::incorporateFunction(const Function &F) {
+  InstructionCount = 0;
   NumModuleValues = Values.size();
 
   // Adding function arguments to the value table.