From 4f1be4abba762f8a7b77d7622abaf1ed1a87b48b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 20 Jul 2010 22:25:04 +0000 Subject: [PATCH] Rename removeAllMetadata to clearMetadataHashEntries and simplify it to just do the things that need to be done when an instruction is deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108948 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Instruction.h | 2 +- lib/VMCore/Instruction.cpp | 4 ++-- lib/VMCore/Metadata.cpp | 14 ++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index 45959ccc6e5..88f5ce1b262 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -189,7 +189,7 @@ private: void getAllMetadataImpl(SmallVectorImpl > &)const; void getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl > &) const; - void removeAllMetadata(); + void clearMetadataHashEntries(); public: //===--------------------------------------------------------------------===// // Predicates and helper methods. diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 9792adaaa12..05bed4c6431 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -49,8 +49,8 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps, // Out of line virtual method, so the vtable, etc has a home. Instruction::~Instruction() { assert(Parent == 0 && "Instruction still linked in the program!"); - if (hasMetadata()) - removeAllMetadata(); + if (hasMetadataHashEntry()) + clearMetadataHashEntries(); } diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 22e758763d6..023799ceb82 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -563,13 +563,11 @@ getAllMetadataOtherThanDebugLocImpl(SmallVectorImplMetadataStore.erase(this); - setHasMetadataHashEntry(false); - } +/// clearMetadataHashEntries - Clear all hashtable-based metadata from +/// this instruction. +void Instruction::clearMetadataHashEntries() { + assert(hasMetadataHashEntry() && "Caller should check"); + getContext().pImpl->MetadataStore.erase(this); + setHasMetadataHashEntry(false); } -- 2.34.1