From 49669e6d3a5743bf02a7b22f16fee6fa187c1930 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 16 Jul 2010 20:50:13 +0000 Subject: [PATCH] eliminate unlockedRefineAbstractTypeTo, types are all per-llvmcontext, so there is no locking involved in type refinement. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108553 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/DerivedTypes.h | 4 ---- lib/Transforms/IPO/GlobalOpt.cpp | 2 +- lib/VMCore/Type.cpp | 13 ++----------- lib/VMCore/TypesContext.h | 4 ++-- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h index 912bb6d882b..8af4ea0e802 100644 --- a/include/llvm/DerivedTypes.h +++ b/include/llvm/DerivedTypes.h @@ -52,10 +52,6 @@ protected: /// void dropAllTypeUses(); - /// unlockedRefineAbstractTypeTo - Internal version of refineAbstractTypeTo - /// that performs no locking. Only used for internal recursion. - void unlockedRefineAbstractTypeTo(const Type *NewType); - public: //===--------------------------------------------------------------------===// diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 735a1c47c39..1fb9e649653 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -1467,7 +1467,7 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV, TargetData *TD) { if (!TD) return false; - + // If this is a malloc of an abstract type, don't touch it. if (!AllocTy->isSized()) return false; diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 845b523c242..83e018c97d9 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -1128,13 +1128,13 @@ void Type::removeAbstractTypeUser(AbstractTypeUser *U) const { } -// unlockedRefineAbstractTypeTo - This function is used when it is discovered +// refineAbstractTypeTo - This function is used when it is discovered // that the 'this' abstract type is actually equivalent to the NewType // specified. This causes all users of 'this' to switch to reference the more // concrete type NewType and for 'this' to be deleted. Only used for internal // callers. // -void DerivedType::unlockedRefineAbstractTypeTo(const Type *NewType) { +void DerivedType::refineAbstractTypeTo(const Type *NewType) { assert(isAbstract() && "refineAbstractTypeTo: Current type is not abstract!"); assert(this != NewType && "Can't refine to myself!"); assert(ForwardType == 0 && "This type has already been refined!"); @@ -1199,15 +1199,6 @@ void DerivedType::unlockedRefineAbstractTypeTo(const Type *NewType) { // destroyed. } -// refineAbstractTypeTo - This function is used by external callers to notify -// us that this abstract type is equivalent to another type. -// -void DerivedType::refineAbstractTypeTo(const Type *NewType) { - // All recursive calls will go through unlockedRefineAbstractTypeTo, - // to avoid deadlock problems. - unlockedRefineAbstractTypeTo(NewType); -} - // notifyUsesThatTypeBecameConcrete - Notify AbstractTypeUsers of this type that // the current type has transitioned from being abstract to being concrete. // diff --git a/lib/VMCore/TypesContext.h b/lib/VMCore/TypesContext.h index 02ab1135b32..e9f7d835972 100644 --- a/lib/VMCore/TypesContext.h +++ b/lib/VMCore/TypesContext.h @@ -370,7 +370,7 @@ public: // We already have this type in the table. Get rid of the newly refined // type. TypeClass *NewTy = cast((Type*)I->second.get()); - Ty->unlockedRefineAbstractTypeTo(NewTy); + Ty->refineAbstractTypeTo(NewTy); return; } } else { @@ -406,7 +406,7 @@ public: } TypesByHash.erase(Entry); } - Ty->unlockedRefineAbstractTypeTo(NewTy); + Ty->refineAbstractTypeTo(NewTy); return; } }