From: Teresa Johnson Date: Mon, 21 Dec 2015 15:38:13 +0000 (+0000) Subject: Remove overly strict new assert in BitcodeReader. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3470295967f4a215d9e4692244de88bb3bd12faa;p=platform%2Fupstream%2Fllvm.git 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. llvm-svn: 256161 --- diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index 7872a7b..dd898a7 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -97,7 +97,6 @@ public: class BitcodeReaderMDValueList { unsigned NumFwdRefs; bool AnyFwdRefs; - bool SavedFwdRefs; unsigned MinFwdRef; unsigned MaxFwdRef; std::vector 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::getValueFwdRef(unsigned Idx) { 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(); } } }