MetadataLoader: Add an assertion for the implicit invariant of PlaceHolder while loading Metadata (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290408 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehdi Amini 2016-12-23 02:20:09 +00:00
parent 4408314ccf
commit b1c75432e5

View File

@ -372,8 +372,14 @@ DistinctMDOperandPlaceholder &PlaceholderQueue::getPlaceholderOp(unsigned ID) {
void PlaceholderQueue::flush(BitcodeReaderMetadataList &MetadataList) {
while (!PHs.empty()) {
PHs.front().replaceUseWith(
MetadataList.getMetadataFwdRef(PHs.front().getID()));
auto *MD = MetadataList.getMetadataFwdRef(PHs.front().getID());
#ifndef NDEBUG
if (auto MDN = dyn_cast<MDNode>(MD)) {
assert(MDN->isResolved() &&
"Flushing Placeholder while cycles aren't resolved");
}
#endif
PHs.front().replaceUseWith(MD);
PHs.pop_front();
}
}