From 694285ca6d79141fc147c3841f14fcb199690721 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 4 Aug 2009 23:07:12 +0000 Subject: [PATCH] revert r78048, it isn't worth using assertingvh here. llvm-svn: 78119 --- llvm/include/llvm/Value.h | 2 +- llvm/include/llvm/ValueSymbolTable.h | 3 +-- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 2 +- llvm/lib/VMCore/Value.cpp | 16 ++++++++-------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/llvm/include/llvm/Value.h b/llvm/include/llvm/Value.h index 83a523233bae..3881e351da52 100644 --- a/llvm/include/llvm/Value.h +++ b/llvm/include/llvm/Value.h @@ -38,7 +38,7 @@ class TypeSymbolTable; template class StringMapEntry; template class AssertingVH; -typedef StringMapEntry > ValueName; +typedef StringMapEntry ValueName; class raw_ostream; class AssemblyAnnotationWriter; class ValueHandleBase; diff --git a/llvm/include/llvm/ValueSymbolTable.h b/llvm/include/llvm/ValueSymbolTable.h index 9b4ccbaf8f30..4f8ebe800172 100644 --- a/llvm/include/llvm/ValueSymbolTable.h +++ b/llvm/include/llvm/ValueSymbolTable.h @@ -17,7 +17,6 @@ #include "llvm/Value.h" #include "llvm/ADT/StringMap.h" #include "llvm/Support/DataTypes.h" -#include "llvm/Support/ValueHandle.h" namespace llvm { template @@ -45,7 +44,7 @@ class ValueSymbolTable { /// @{ public: /// @brief A mapping of names to values. - typedef StringMap > ValueMap; + typedef StringMap ValueMap; /// @brief An iterator over a ValueMap. typedef ValueMap::iterator iterator; diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index a5c28fcc763a..cb181d2810b9 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1088,7 +1088,7 @@ static void WriteValueSymbolTable(const ValueSymbolTable &VST, // VST_ENTRY: [valueid, namechar x N] // VST_BBENTRY: [bbid, namechar x N] unsigned Code; - if (isa(*SI->getValue())) { + if (isa(SI->getValue())) { Code = bitc::VST_CODE_BBENTRY; if (isChar6) AbbrevToUse = VST_BBENTRY_6_ABBREV; diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp index 8710b9461e89..2cdd55217cc4 100644 --- a/llvm/lib/VMCore/Value.cpp +++ b/llvm/lib/VMCore/Value.cpp @@ -57,14 +57,6 @@ Value::Value(const Type *ty, unsigned scid) } Value::~Value() { - // If this value is named, destroy the name. This should not be in a symtab - // at this point. - if (Name) - Name->Destroy(); - - // There should be no uses of this object anymore, remove it. - LeakDetector::removeGarbageObject(this); - // Notify all ValueHandles (if present) that this value is going away. if (HasValueHandle) ValueHandleBase::ValueIsDeleted(this); @@ -84,6 +76,14 @@ Value::~Value() { } #endif assert(use_empty() && "Uses remain when a value is destroyed!"); + + // If this value is named, destroy the name. This should not be in a symtab + // at this point. + if (Name) + Name->Destroy(); + + // There should be no uses of this object anymore, remove it. + LeakDetector::removeGarbageObject(this); } /// hasNUses - Return true if this Value has exactly N users.