eliminate unlockedRefineAbstractTypeTo, types are all per-llvmcontext,
authorChris Lattner <sabre@nondot.org>
Fri, 16 Jul 2010 20:50:13 +0000 (20:50 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 16 Jul 2010 20:50:13 +0000 (20:50 +0000)
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
lib/Transforms/IPO/GlobalOpt.cpp
lib/VMCore/Type.cpp
lib/VMCore/TypesContext.h

index 912bb6d882b066e3a4ccc60b1212744bceb96754..8af4ea0e8023443d035de0c4d1133699e361ff8c 100644 (file)
@@ -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:
 
   //===--------------------------------------------------------------------===//
index 735a1c47c39b5eda580d9b2e2a671c30c9e664a5..1fb9e649653305f29ff8c0b82b7363cc0d160cb1 100644 (file)
@@ -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;
index 845b523c24216930905b45f20b78c777603807bc..83e018c97d9b8dbd9eeb9b67a8a7d97c3fc31add 100644 (file)
@@ -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.
 //
index 02ab1135b32cf376dec1a942b7d81009ca9d870e..e9f7d835972456059a8029046ce1bd902fc9a10d 100644 (file)
@@ -370,7 +370,7 @@ public:
         // We already have this type in the table.  Get rid of the newly refined
         // type.
         TypeClass *NewTy = cast<TypeClass>((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;
           }
         }