Remove overly strict new assert in BitcodeReader.
authorTeresa Johnson <tejohnson@google.com>
Mon, 21 Dec 2015 15:38:13 +0000 (15:38 +0000)
committerTeresa Johnson <tejohnson@google.com>
Mon, 21 Dec 2015 15:38:13 +0000 (15:38 +0000)
This fixes a bug introduced by the ThinLTO metadata linking patch
r255909. The assert is overly-strict and while useful in development of
the patch, doesn't seem interesting to keep.

Fixes PR25907.

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

lib/Bitcode/Reader/BitcodeReader.cpp

index 7872a7b584944b11aed3defbf8a47e112428106f..dd898a7f32245b83d7c791cd41b0255a7615c0cb 100644 (file)
@@ -97,7 +97,6 @@ public:
 class BitcodeReaderMDValueList {
   unsigned NumFwdRefs;
   bool AnyFwdRefs;
 class BitcodeReaderMDValueList {
   unsigned NumFwdRefs;
   bool AnyFwdRefs;
-  bool SavedFwdRefs;
   unsigned MinFwdRef;
   unsigned MaxFwdRef;
   std::vector<TrackingMDRef> MDValuePtrs;
   unsigned MinFwdRef;
   unsigned MaxFwdRef;
   std::vector<TrackingMDRef> MDValuePtrs;
@@ -105,12 +104,7 @@ class BitcodeReaderMDValueList {
   LLVMContext &Context;
 public:
   BitcodeReaderMDValueList(LLVMContext &C)
   LLVMContext &Context;
 public:
   BitcodeReaderMDValueList(LLVMContext &C)
-      : NumFwdRefs(0), AnyFwdRefs(false), SavedFwdRefs(false), Context(C) {}
-  ~BitcodeReaderMDValueList() {
-    // Assert that we either replaced all forward references, or saved
-    // them for later replacement.
-    assert(!NumFwdRefs || SavedFwdRefs);
-  }
+      : NumFwdRefs(0), AnyFwdRefs(false), Context(C) {}
 
   // vector compatibility methods
   unsigned size() const       { return MDValuePtrs.size(); }
 
   // vector compatibility methods
   unsigned size() const       { return MDValuePtrs.size(); }
@@ -121,8 +115,6 @@ public:
   void pop_back()             { MDValuePtrs.pop_back(); }
   bool empty() const          { return MDValuePtrs.empty(); }
 
   void pop_back()             { MDValuePtrs.pop_back(); }
   bool empty() const          { return MDValuePtrs.empty(); }
 
-  void savedFwdRefs() { SavedFwdRefs = true; }
-
   Metadata *operator[](unsigned i) const {
     assert(i < MDValuePtrs.size());
     return MDValuePtrs[i];
   Metadata *operator[](unsigned i) const {
     assert(i < MDValuePtrs.size());
     return MDValuePtrs[i];
@@ -1080,9 +1072,6 @@ Metadata *BitcodeReaderMDValueList::getValueFwdRef(unsigned Idx) {
     MinFwdRef = MaxFwdRef = Idx;
   }
   ++NumFwdRefs;
     MinFwdRef = MaxFwdRef = Idx;
   }
   ++NumFwdRefs;
-  // Reset flag to ensure that we save this forward reference if we
-  // are delaying metadata mapping (e.g. for function importing).
-  SavedFwdRefs = false;
 
   // Create and return a placeholder, which will later be RAUW'd.
   Metadata *MD = MDNode::getTemporary(Context, None).release();
 
   // Create and return a placeholder, which will later be RAUW'd.
   Metadata *MD = MDNode::getTemporary(Context, None).release();
@@ -3089,10 +3078,6 @@ void BitcodeReader::saveMDValueList(
         continue;
       }
       MDValueToValIDMap[MD] = ValID;
         continue;
       }
       MDValueToValIDMap[MD] = ValID;
-      // Flag that we saved the forward refs (temporary metadata) for error
-      // checking during MDValueList destruction.
-      if (OnlyTempMD)
-        MDValueList.savedFwdRefs();
     }
   }
 }
     }
   }
 }