diff options
Diffstat (limited to 'lib/VMCore/Metadata.cpp')
-rw-r--r-- | lib/VMCore/Metadata.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 9966433496..993df41b46 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -470,9 +470,11 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) { } // Otherwise, we're removing metadata from an instruction. - assert(hasMetadataHashEntry() && - getContext().pImpl->MetadataStore.count(this) && + assert((hasMetadataHashEntry() == + getContext().pImpl->MetadataStore.count(this)) && "HasMetadata bit out of date!"); + if (!hasMetadataHashEntry()) + return; // Nothing to remove! LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this]; // Common case is removing the only entry. |