1 //===-- Metadata.cpp - Implement Metadata classes -------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Metadata classes.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/IR/Metadata.h"
15 #include "LLVMContextImpl.h"
16 #include "SymbolTableListTraitsImpl.h"
17 #include "llvm/ADT/DenseMap.h"
18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/SmallSet.h"
20 #include "llvm/ADT/SmallString.h"
21 #include "llvm/ADT/StringMap.h"
22 #include "llvm/IR/ConstantRange.h"
23 #include "llvm/IR/Instruction.h"
24 #include "llvm/IR/LLVMContext.h"
25 #include "llvm/IR/LeakDetector.h"
26 #include "llvm/IR/Module.h"
27 #include "llvm/IR/ValueHandle.h"
31 Metadata::Metadata(LLVMContext &Context, unsigned ID)
32 : Value(Type::getMetadataTy(Context), ID) {}
34 //===----------------------------------------------------------------------===//
35 // MDString implementation.
38 void MDString::anchor() { }
40 MDString *MDString::get(LLVMContext &Context, StringRef Str) {
41 auto &Store = Context.pImpl->MDStringCache;
42 auto I = Store.find(Str);
47 StringMapEntry<MDString>::Create(Str, Store.getAllocator(), Context);
48 bool WasInserted = Store.insert(Entry);
50 assert(WasInserted && "Expected entry to be inserted");
51 return &Entry->second;
54 StringRef MDString::getString() const {
55 return StringMapEntry<MDString>::GetStringMapEntryFromValue(*this).first();
58 //===----------------------------------------------------------------------===//
59 // MDNodeOperand implementation.
62 // Use CallbackVH to hold MDNode operands.
64 class MDNodeOperand : public CallbackVH {
66 MDNodeOperand *Cur = this;
68 while (Cur->getValPtrInt() != 1)
71 assert(Cur->getValPtrInt() == 1 &&
72 "Couldn't find the beginning of the operand list!");
73 return reinterpret_cast<MDNode*>(Cur) - 1;
77 MDNodeOperand(Value *V) : CallbackVH(V) {}
78 virtual ~MDNodeOperand();
81 unsigned IsFirst = this->getValPtrInt();
83 this->setAsFirstOperand(IsFirst);
86 /// \brief Accessor method to mark the operand as the first in the list.
87 void setAsFirstOperand(unsigned V) { this->setValPtrInt(V); }
89 void deleted() override;
90 void allUsesReplacedWith(Value *NV) override;
92 } // end namespace llvm.
94 // Provide out-of-line definition to prevent weak vtable.
95 MDNodeOperand::~MDNodeOperand() {}
97 void MDNodeOperand::deleted() {
98 getParent()->replaceOperand(this, nullptr);
101 void MDNodeOperand::allUsesReplacedWith(Value *NV) {
102 getParent()->replaceOperand(this, NV);
105 //===----------------------------------------------------------------------===//
106 // MDNode implementation.
109 /// \brief Get the MDNodeOperand's coallocated on the end of the MDNode.
110 static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {
111 // Use <= instead of < to permit a one-past-the-end address.
112 assert(Op <= N->getNumOperands() && "Invalid operand number");
113 return reinterpret_cast<MDNodeOperand*>(N + 1) + Op;
116 void MDNode::replaceOperandWith(unsigned i, Value *Val) {
117 MDNodeOperand *Op = getOperandPtr(this, i);
118 replaceOperand(Op, Val);
121 MDNode::MDNode(LLVMContext &C, ArrayRef<Value *> Vals, bool isFunctionLocal)
122 : Metadata(C, Value::MDNodeVal), Hash(0) {
123 NumOperands = Vals.size();
126 setValueSubclassData(getSubclassDataFromValue() | FunctionLocalBit);
128 // Initialize the operand list, which is co-allocated on the end of the node.
130 for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands;
131 Op != E; ++Op, ++i) {
132 new (Op) MDNodeOperand(Vals[i]);
134 // Mark the first MDNodeOperand as being the first in the list of operands.
136 Op->setAsFirstOperand(1);
140 /// ~MDNode - Destroy MDNode.
142 assert((getSubclassDataFromValue() & DestroyFlag) != 0 &&
143 "Not being destroyed through destroy()?");
144 LLVMContextImpl *pImpl = getType()->getContext().pImpl;
145 if (isNotUniqued()) {
146 pImpl->NonUniquedMDNodes.erase(this);
148 pImpl->MDNodeSet.erase(this);
151 // Destroy the operands.
152 for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands;
154 Op->~MDNodeOperand();
157 static const Function *getFunctionForValue(Value *V) {
158 if (!V) return nullptr;
159 if (Instruction *I = dyn_cast<Instruction>(V)) {
160 BasicBlock *BB = I->getParent();
161 return BB ? BB->getParent() : nullptr;
163 if (Argument *A = dyn_cast<Argument>(V))
164 return A->getParent();
165 if (BasicBlock *BB = dyn_cast<BasicBlock>(V))
166 return BB->getParent();
167 if (MDNode *MD = dyn_cast<MDNode>(V))
168 return MD->getFunction();
173 static const Function *assertLocalFunction(const MDNode *N) {
174 if (!N->isFunctionLocal()) return nullptr;
176 // FIXME: This does not handle cyclic function local metadata.
177 const Function *F = nullptr, *NewF = nullptr;
178 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
179 if (Value *V = N->getOperand(i)) {
180 if (MDNode *MD = dyn_cast<MDNode>(V))
181 NewF = assertLocalFunction(MD);
183 NewF = getFunctionForValue(V);
188 assert((NewF == nullptr || F == NewF) &&
189 "inconsistent function-local metadata");
195 // getFunction - If this metadata is function-local and recursively has a
196 // function-local operand, return the first such operand's parent function.
197 // Otherwise, return null. getFunction() should not be used for performance-
198 // critical code because it recursively visits all the MDNode's operands.
199 const Function *MDNode::getFunction() const {
201 return assertLocalFunction(this);
203 if (!isFunctionLocal()) return nullptr;
204 for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
205 if (const Function *F = getFunctionForValue(getOperand(i)))
211 // destroy - Delete this node. Only when there are no uses.
212 void MDNode::destroy() {
213 setValueSubclassData(getSubclassDataFromValue() | DestroyFlag);
214 // Placement delete, then free the memory.
219 /// \brief Check if the Value would require a function-local MDNode.
220 static bool isFunctionLocalValue(Value *V) {
221 return isa<Instruction>(V) || isa<Argument>(V) || isa<BasicBlock>(V) ||
222 (isa<MDNode>(V) && cast<MDNode>(V)->isFunctionLocal());
225 MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef<Value*> Vals,
226 FunctionLocalness FL, bool Insert) {
227 auto &Store = Context.pImpl->MDNodeSet;
229 GenericMDNodeInfo::KeyTy Key(Vals);
230 auto I = Store.find_as(Key);
231 if (I != Store.end())
236 bool isFunctionLocal = false;
239 for (Value *V : Vals) {
241 if (isFunctionLocalValue(V)) {
242 isFunctionLocal = true;
248 isFunctionLocal = false;
251 isFunctionLocal = true;
255 // Coallocate space for the node and Operands together, then placement new.
256 void *Ptr = malloc(sizeof(MDNode) + Vals.size() * sizeof(MDNodeOperand));
257 MDNode *N = new (Ptr) MDNode(Context, Vals, isFunctionLocal);
264 MDNode *MDNode::get(LLVMContext &Context, ArrayRef<Value*> Vals) {
265 return getMDNode(Context, Vals, FL_Unknown);
268 MDNode *MDNode::getWhenValsUnresolved(LLVMContext &Context,
269 ArrayRef<Value*> Vals,
270 bool isFunctionLocal) {
271 return getMDNode(Context, Vals, isFunctionLocal ? FL_Yes : FL_No);
274 MDNode *MDNode::getIfExists(LLVMContext &Context, ArrayRef<Value*> Vals) {
275 return getMDNode(Context, Vals, FL_Unknown, false);
278 MDNode *MDNode::getTemporary(LLVMContext &Context, ArrayRef<Value*> Vals) {
280 (MDNode *)malloc(sizeof(MDNode) + Vals.size() * sizeof(MDNodeOperand));
281 N = new (N) MDNode(Context, Vals, FL_No);
282 N->setValueSubclassData(N->getSubclassDataFromValue() |
284 LeakDetector::addGarbageObject(N);
288 void MDNode::deleteTemporary(MDNode *N) {
289 assert(N->use_empty() && "Temporary MDNode has uses!");
290 assert(!N->getContext().pImpl->MDNodeSet.erase(N) &&
291 "Deleting a non-temporary uniqued node!");
292 assert(!N->getContext().pImpl->NonUniquedMDNodes.erase(N) &&
293 "Deleting a non-temporary non-uniqued node!");
294 assert((N->getSubclassDataFromValue() & NotUniquedBit) &&
295 "Temporary MDNode does not have NotUniquedBit set!");
296 assert((N->getSubclassDataFromValue() & DestroyFlag) == 0 &&
297 "Temporary MDNode has DestroyFlag set!");
298 LeakDetector::removeGarbageObject(N);
302 /// \brief Return specified operand.
303 Value *MDNode::getOperand(unsigned i) const {
304 assert(i < getNumOperands() && "Invalid operand number");
305 return *getOperandPtr(const_cast<MDNode*>(this), i);
308 void MDNode::setIsNotUniqued() {
309 setValueSubclassData(getSubclassDataFromValue() | NotUniquedBit);
310 LLVMContextImpl *pImpl = getType()->getContext().pImpl;
312 pImpl->NonUniquedMDNodes.insert(this);
315 // Replace value from this node's operand list.
316 void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
319 // If is possible that someone did GV->RAUW(inst), replacing a global variable
320 // with an instruction or some other function-local object. If this is a
321 // non-function-local MDNode, it can't point to a function-local object.
322 // Handle this case by implicitly dropping the MDNode reference to null.
323 // Likewise if the MDNode is function-local but for a different function.
324 if (To && isFunctionLocalValue(To)) {
325 if (!isFunctionLocal())
328 const Function *F = getFunction();
329 const Function *FV = getFunctionForValue(To);
330 // Metadata can be function-local without having an associated function.
331 // So only consider functions to have changed if non-null.
332 if (F && FV && F != FV)
340 // If this node is already not being uniqued (because one of the operands
341 // already went to null), then there is nothing else to do here.
342 if (isNotUniqued()) {
347 auto &Store = getContext().pImpl->MDNodeSet;
349 // Remove "this" from the context map.
352 // Update the operand.
355 // If we are dropping an argument to null, we choose to not unique the MDNode
356 // anymore. This commonly occurs during destruction, and uniquing these
357 // brings little reuse. Also, this means we don't need to include
358 // isFunctionLocal bits in the hash for MDNodes.
364 // Now that the node is out of the table, get ready to reinsert it. First,
365 // check to see if another node with the same operands already exists in the
366 // set. If so, then this node is redundant.
367 SmallVector<Value *, 8> Vals;
368 GenericMDNodeInfo::KeyTy Key(this, Vals);
369 auto I = Store.find_as(Key);
370 if (I != Store.end()) {
371 replaceAllUsesWith(*I);
376 this->Hash = Key.Hash;
379 // If this MDValue was previously function-local but no longer is, clear
380 // its function-local flag.
381 if (isFunctionLocal() && !isFunctionLocalValue(To)) {
382 bool isStillFunctionLocal = false;
383 for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
384 Value *V = getOperand(i);
386 if (isFunctionLocalValue(V)) {
387 isStillFunctionLocal = true;
391 if (!isStillFunctionLocal)
392 setValueSubclassData(getSubclassDataFromValue() & ~FunctionLocalBit);
396 MDNode *MDNode::concatenate(MDNode *A, MDNode *B) {
402 SmallVector<Value *, 4> Vals(A->getNumOperands() +
403 B->getNumOperands());
406 for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i)
407 Vals[j++] = A->getOperand(i);
408 for (unsigned i = 0, ie = B->getNumOperands(); i != ie; ++i)
409 Vals[j++] = B->getOperand(i);
411 return MDNode::get(A->getContext(), Vals);
414 MDNode *MDNode::intersect(MDNode *A, MDNode *B) {
418 SmallVector<Value *, 4> Vals;
419 for (unsigned i = 0, ie = A->getNumOperands(); i != ie; ++i) {
420 Value *V = A->getOperand(i);
421 for (unsigned j = 0, je = B->getNumOperands(); j != je; ++j)
422 if (V == B->getOperand(j)) {
428 return MDNode::get(A->getContext(), Vals);
431 MDNode *MDNode::getMostGenericFPMath(MDNode *A, MDNode *B) {
435 APFloat AVal = cast<ConstantFP>(A->getOperand(0))->getValueAPF();
436 APFloat BVal = cast<ConstantFP>(B->getOperand(0))->getValueAPF();
437 if (AVal.compare(BVal) == APFloat::cmpLessThan)
442 static bool isContiguous(const ConstantRange &A, const ConstantRange &B) {
443 return A.getUpper() == B.getLower() || A.getLower() == B.getUpper();
446 static bool canBeMerged(const ConstantRange &A, const ConstantRange &B) {
447 return !A.intersectWith(B).isEmptySet() || isContiguous(A, B);
450 static bool tryMergeRange(SmallVectorImpl<Value *> &EndPoints, ConstantInt *Low,
452 ConstantRange NewRange(Low->getValue(), High->getValue());
453 unsigned Size = EndPoints.size();
454 APInt LB = cast<ConstantInt>(EndPoints[Size - 2])->getValue();
455 APInt LE = cast<ConstantInt>(EndPoints[Size - 1])->getValue();
456 ConstantRange LastRange(LB, LE);
457 if (canBeMerged(NewRange, LastRange)) {
458 ConstantRange Union = LastRange.unionWith(NewRange);
459 Type *Ty = High->getType();
460 EndPoints[Size - 2] = ConstantInt::get(Ty, Union.getLower());
461 EndPoints[Size - 1] = ConstantInt::get(Ty, Union.getUpper());
467 static void addRange(SmallVectorImpl<Value *> &EndPoints, ConstantInt *Low,
469 if (!EndPoints.empty())
470 if (tryMergeRange(EndPoints, Low, High))
473 EndPoints.push_back(Low);
474 EndPoints.push_back(High);
477 MDNode *MDNode::getMostGenericRange(MDNode *A, MDNode *B) {
478 // Given two ranges, we want to compute the union of the ranges. This
479 // is slightly complitade by having to combine the intervals and merge
480 // the ones that overlap.
488 // First, walk both lists in older of the lower boundary of each interval.
489 // At each step, try to merge the new interval to the last one we adedd.
490 SmallVector<Value*, 4> EndPoints;
493 int AN = A->getNumOperands() / 2;
494 int BN = B->getNumOperands() / 2;
495 while (AI < AN && BI < BN) {
496 ConstantInt *ALow = cast<ConstantInt>(A->getOperand(2 * AI));
497 ConstantInt *BLow = cast<ConstantInt>(B->getOperand(2 * BI));
499 if (ALow->getValue().slt(BLow->getValue())) {
500 addRange(EndPoints, ALow, cast<ConstantInt>(A->getOperand(2 * AI + 1)));
503 addRange(EndPoints, BLow, cast<ConstantInt>(B->getOperand(2 * BI + 1)));
508 addRange(EndPoints, cast<ConstantInt>(A->getOperand(2 * AI)),
509 cast<ConstantInt>(A->getOperand(2 * AI + 1)));
513 addRange(EndPoints, cast<ConstantInt>(B->getOperand(2 * BI)),
514 cast<ConstantInt>(B->getOperand(2 * BI + 1)));
518 // If we have more than 2 ranges (4 endpoints) we have to try to merge
519 // the last and first ones.
520 unsigned Size = EndPoints.size();
522 ConstantInt *FB = cast<ConstantInt>(EndPoints[0]);
523 ConstantInt *FE = cast<ConstantInt>(EndPoints[1]);
524 if (tryMergeRange(EndPoints, FB, FE)) {
525 for (unsigned i = 0; i < Size - 2; ++i) {
526 EndPoints[i] = EndPoints[i + 2];
528 EndPoints.resize(Size - 2);
532 // If in the end we have a single range, it is possible that it is now the
533 // full range. Just drop the metadata in that case.
534 if (EndPoints.size() == 2) {
535 ConstantRange Range(cast<ConstantInt>(EndPoints[0])->getValue(),
536 cast<ConstantInt>(EndPoints[1])->getValue());
537 if (Range.isFullSet())
541 return MDNode::get(A->getContext(), EndPoints);
544 //===----------------------------------------------------------------------===//
545 // NamedMDNode implementation.
548 static SmallVector<TrackingVH<MDNode>, 4> &getNMDOps(void *Operands) {
549 return *(SmallVector<TrackingVH<MDNode>, 4> *)Operands;
552 NamedMDNode::NamedMDNode(const Twine &N)
553 : Name(N.str()), Parent(nullptr),
554 Operands(new SmallVector<TrackingVH<MDNode>, 4>()) {}
556 NamedMDNode::~NamedMDNode() {
558 delete &getNMDOps(Operands);
561 unsigned NamedMDNode::getNumOperands() const {
562 return (unsigned)getNMDOps(Operands).size();
565 MDNode *NamedMDNode::getOperand(unsigned i) const {
566 assert(i < getNumOperands() && "Invalid Operand number!");
567 return &*getNMDOps(Operands)[i];
570 void NamedMDNode::addOperand(MDNode *M) {
571 assert(!M->isFunctionLocal() &&
572 "NamedMDNode operands must not be function-local!");
573 getNMDOps(Operands).push_back(TrackingVH<MDNode>(M));
576 void NamedMDNode::eraseFromParent() {
577 getParent()->eraseNamedMetadata(this);
580 void NamedMDNode::dropAllReferences() {
581 getNMDOps(Operands).clear();
584 StringRef NamedMDNode::getName() const {
585 return StringRef(Name);
588 //===----------------------------------------------------------------------===//
589 // Instruction Metadata method implementations.
592 void Instruction::setMetadata(StringRef Kind, MDNode *Node) {
593 if (!Node && !hasMetadata())
595 setMetadata(getContext().getMDKindID(Kind), Node);
598 MDNode *Instruction::getMetadataImpl(StringRef Kind) const {
599 return getMetadataImpl(getContext().getMDKindID(Kind));
602 void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
603 SmallSet<unsigned, 5> KnownSet;
604 KnownSet.insert(KnownIDs.begin(), KnownIDs.end());
606 // Drop debug if needed
607 if (KnownSet.erase(LLVMContext::MD_dbg))
610 if (!hasMetadataHashEntry())
611 return; // Nothing to remove!
613 DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &MetadataStore =
614 getContext().pImpl->MetadataStore;
616 if (KnownSet.empty()) {
617 // Just drop our entry at the store.
618 MetadataStore.erase(this);
619 setHasMetadataHashEntry(false);
623 LLVMContextImpl::MDMapTy &Info = MetadataStore[this];
626 // Walk the array and drop any metadata we don't know.
627 for (I = 0, E = Info.size(); I != E;) {
628 if (KnownSet.count(Info[I].first)) {
633 Info[I] = Info.back();
637 assert(E == Info.size());
640 // Drop our entry at the store.
641 MetadataStore.erase(this);
642 setHasMetadataHashEntry(false);
646 /// setMetadata - Set the metadata of of the specified kind to the specified
647 /// node. This updates/replaces metadata if already present, or removes it if
649 void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
650 if (!Node && !hasMetadata())
653 // Handle 'dbg' as a special case since it is not stored in the hash table.
654 if (KindID == LLVMContext::MD_dbg) {
655 DbgLoc = DebugLoc::getFromDILocation(Node);
659 // Handle the case when we're adding/updating metadata on an instruction.
661 LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
662 assert(!Info.empty() == hasMetadataHashEntry() &&
663 "HasMetadata bit is wonked");
665 setHasMetadataHashEntry(true);
667 // Handle replacement of an existing value.
669 if (P.first == KindID) {
675 // No replacement, just add it to the list.
676 Info.push_back(std::make_pair(KindID, Node));
680 // Otherwise, we're removing metadata from an instruction.
681 assert((hasMetadataHashEntry() ==
682 (getContext().pImpl->MetadataStore.count(this) > 0)) &&
683 "HasMetadata bit out of date!");
684 if (!hasMetadataHashEntry())
685 return; // Nothing to remove!
686 LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
688 // Common case is removing the only entry.
689 if (Info.size() == 1 && Info[0].first == KindID) {
690 getContext().pImpl->MetadataStore.erase(this);
691 setHasMetadataHashEntry(false);
695 // Handle removal of an existing value.
696 for (unsigned i = 0, e = Info.size(); i != e; ++i)
697 if (Info[i].first == KindID) {
698 Info[i] = Info.back();
700 assert(!Info.empty() && "Removing last entry should be handled above");
703 // Otherwise, removing an entry that doesn't exist on the instruction.
706 void Instruction::setAAMetadata(const AAMDNodes &N) {
707 setMetadata(LLVMContext::MD_tbaa, N.TBAA);
708 setMetadata(LLVMContext::MD_alias_scope, N.Scope);
709 setMetadata(LLVMContext::MD_noalias, N.NoAlias);
712 MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
713 // Handle 'dbg' as a special case since it is not stored in the hash table.
714 if (KindID == LLVMContext::MD_dbg)
715 return DbgLoc.getAsMDNode(getContext());
717 if (!hasMetadataHashEntry()) return nullptr;
719 LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
720 assert(!Info.empty() && "bit out of sync with hash table");
722 for (const auto &I : Info)
723 if (I.first == KindID)
728 void Instruction::getAllMetadataImpl(
729 SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const {
732 // Handle 'dbg' as a special case since it is not stored in the hash table.
733 if (!DbgLoc.isUnknown()) {
734 Result.push_back(std::make_pair((unsigned)LLVMContext::MD_dbg,
735 DbgLoc.getAsMDNode(getContext())));
736 if (!hasMetadataHashEntry()) return;
739 assert(hasMetadataHashEntry() &&
740 getContext().pImpl->MetadataStore.count(this) &&
741 "Shouldn't have called this");
742 const LLVMContextImpl::MDMapTy &Info =
743 getContext().pImpl->MetadataStore.find(this)->second;
744 assert(!Info.empty() && "Shouldn't have called this");
746 Result.append(Info.begin(), Info.end());
748 // Sort the resulting array so it is stable.
749 if (Result.size() > 1)
750 array_pod_sort(Result.begin(), Result.end());
753 void Instruction::getAllMetadataOtherThanDebugLocImpl(
754 SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const {
756 assert(hasMetadataHashEntry() &&
757 getContext().pImpl->MetadataStore.count(this) &&
758 "Shouldn't have called this");
759 const LLVMContextImpl::MDMapTy &Info =
760 getContext().pImpl->MetadataStore.find(this)->second;
761 assert(!Info.empty() && "Shouldn't have called this");
762 Result.append(Info.begin(), Info.end());
764 // Sort the resulting array so it is stable.
765 if (Result.size() > 1)
766 array_pod_sort(Result.begin(), Result.end());
769 /// clearMetadataHashEntries - Clear all hashtable-based metadata from
770 /// this instruction.
771 void Instruction::clearMetadataHashEntries() {
772 assert(hasMetadataHashEntry() && "Caller should check");
773 getContext().pImpl->MetadataStore.erase(this);
774 setHasMetadataHashEntry(false);