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

llvm-svn: 290408
This commit is contained in:
Mehdi Amini 2016-12-23 02:20:09 +00:00
parent 70a9cd4cbe
commit 5ae6170fc2
1 changed files with 8 additions and 2 deletions

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();
}
}