[llvm-commits] [llvm] r108948 - in /llvm/trunk: include/llvm/Instruction.h lib/VMCore/Instruction.cpp lib/VMCore/Metadata.cpp

Devang Patel dpatel at apple.com
Tue Jul 20 15:34:59 PDT 2010


On Jul 20, 2010, at 3:25 PM, Dan Gohman wrote:

> Author: djg
> Date: Tue Jul 20 17:25:04 2010
> New Revision: 108948
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=108948&view=rev
> Log:
> Rename removeAllMetadata to clearMetadataHashEntries and simplify
> it to just do the things that need to be done when an instruction
> is deleted.
> 
> Modified:
>    llvm/trunk/include/llvm/Instruction.h
>    llvm/trunk/lib/VMCore/Instruction.cpp
>    llvm/trunk/lib/VMCore/Metadata.cpp
> 
> Modified: llvm/trunk/include/llvm/Instruction.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=108948&r1=108947&r2=108948&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Instruction.h (original)
> +++ llvm/trunk/include/llvm/Instruction.h Tue Jul 20 17:25:04 2010
> @@ -189,7 +189,7 @@
>   void getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,MDNode*> > &)const;
>   void getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
>                                            MDNode*> > &) const;
> -  void removeAllMetadata();
> +  void clearMetadataHashEntries();
> public:
>   //===--------------------------------------------------------------------===//
>   // Predicates and helper methods.
> 
> Modified: llvm/trunk/lib/VMCore/Instruction.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=108948&r1=108947&r2=108948&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Instruction.cpp (original)
> +++ llvm/trunk/lib/VMCore/Instruction.cpp Tue Jul 20 17:25:04 2010
> @@ -49,8 +49,8 @@
> // 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();
> }
> 
> 
> 
> Modified: llvm/trunk/lib/VMCore/Metadata.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=108948&r1=108947&r2=108948&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Metadata.cpp (original)
> +++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Jul 20 17:25:04 2010
> @@ -563,13 +563,11 @@
> }
> 
> 
> -/// removeAllMetadata - Remove all metadata from this instruction.
> -void Instruction::removeAllMetadata() {
> -  assert(hasMetadata() && "Caller should check");
> -  DbgLoc = DebugLoc();
> -  if (hasMetadataHashEntry()) {
> -    getContext().pImpl->MetadataStore.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);
> }

Please reset DbgLoc also.
-
Devang





More information about the llvm-commits mailing list