[llvm] r256161 - Remove overly strict new assert in BitcodeReader.

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 21 07:38:13 PST 2015


Author: tejohnson
Date: Mon Dec 21 09:38:13 2015
New Revision: 256161

URL: http://llvm.org/viewvc/llvm-project?rev=256161&view=rev
Log:
Remove overly strict new assert in BitcodeReader.

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.

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=256161&r1=256160&r2=256161&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Dec 21 09:38:13 2015
@@ -97,7 +97,6 @@ public:
 class BitcodeReaderMDValueList {
   unsigned NumFwdRefs;
   bool AnyFwdRefs;
-  bool SavedFwdRefs;
   unsigned MinFwdRef;
   unsigned MaxFwdRef;
   std::vector<TrackingMDRef> MDValuePtrs;
@@ -105,12 +104,7 @@ class BitcodeReaderMDValueList {
   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(); }
@@ -121,8 +115,6 @@ public:
   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];
@@ -1080,9 +1072,6 @@ Metadata *BitcodeReaderMDValueList::getV
     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();
@@ -3089,10 +3078,6 @@ void BitcodeReader::saveMDValueList(
         continue;
       }
       MDValueToValIDMap[MD] = ValID;
-      // Flag that we saved the forward refs (temporary metadata) for error
-      // checking during MDValueList destruction.
-      if (OnlyTempMD)
-        MDValueList.savedFwdRefs();
     }
   }
 }




More information about the llvm-commits mailing list