Move functionality preserving changes.
authorChris Lattner <sabre@nondot.org>
Fri, 5 Sep 2003 02:39:52 +0000 (02:39 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 5 Sep 2003 02:39:52 +0000 (02:39 +0000)
Inline containsEquivalent
Remove some //'s

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8358 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Type.cpp

index d8ec500a4aaa51d73073be8003067037534c466e..8840b0a0ebb7d8e98691292dfa3780cc225d8ba3 100644 (file)
@@ -504,32 +504,23 @@ public:
   }
 
 
-  // containsEquivalent - Return true if the typemap contains a type that is
-  // structurally equivalent to the specified type.
-  //
-  inline TypeClass *containsEquivalent(TypeClass *Ty) { //iterator TyIt) {
+  void finishRefinement(TypeClass *Ty) {
     //const TypeClass *Ty = (const TypeClass*)TyIt->second.get();
     for (iterator I = Map.begin(), E = Map.end(); I != E; ++I)
       if (I->second.get() != Ty && TypesEqual(Ty, I->second.get())) {
-        TypeClass *New = (TypeClass*)I->second.get();
+        TypeClass *NewTy = (TypeClass*)I->second.get();
 #if 0
-        Map.erase(TyIt);                // The old entry is now dead!
+        //Map.erase(TyIt);                // The old entry is now dead!
 #endif
-       return New;
+        // Refined to a different type altogether?
+        Ty->refineAbstractTypeToInternal(NewTy, false);
+        return;
       }
-    return 0;
-  }
 
-  void finishRefinement(TypeClass *Ty) {
-    if (TypeClass *NewTy = containsEquivalent(Ty)) {
-      // Refined to a different type altogether?
-      Ty->refineAbstractTypeToInternal(NewTy, false);
-    } else {
-      // If the type is currently thought to be abstract, rescan all of our
-      // subtypes to see if the type has just become concrete!
-      if (Ty->isAbstract()) Ty->setAbstract(Ty->isTypeAbstract());
-      Ty->typeIsRefined();                   // Same type, different contents...
-    }
+    // If the type is currently thought to be abstract, rescan all of our
+    // subtypes to see if the type has just become concrete!
+    if (Ty->isAbstract()) Ty->setAbstract(Ty->isTypeAbstract());
+    Ty->typeIsRefined();                   // Same type, different contents...
   }
 
   // refineAbstractType - This is called when one of the contained abstract
@@ -710,8 +701,7 @@ FunctionType *FunctionType::get(const Type *ReturnType,
 
 void FunctionType::dropAllTypeUses(bool inMap) {
 #if 0
-  //if (inMap) FunctionTypes.remove(FunctionTypes.getEntryForType(this));
-
+  if (inMap) FunctionTypes.remove(FunctionTypes.getEntryForType(this));
   // Drop all uses of other types, which might be recursive.
   ResultType = Type::VoidTy;
   ParamTys.clear();
@@ -782,7 +772,7 @@ ArrayType *ArrayType::get(const Type *ElementType, unsigned NumElements) {
 
 void ArrayType::dropAllTypeUses(bool inMap) {
 #if 0
-  //if (inMap) ArrayTypes.remove(ArrayTypes.getEntryForType(this));
+  if (inMap) ArrayTypes.remove(ArrayTypes.getEntryForType(this));
   ElementType = Type::IntTy;
 #endif
 }
@@ -865,7 +855,7 @@ StructType *StructType::get(const std::vector<const Type*> &ETypes) {
 
 void StructType::dropAllTypeUses(bool inMap) {
 #if 0
-  //if (inMap) StructTypes.remove(StructTypes.getEntryForType(this));
+  if (inMap) StructTypes.remove(StructTypes.getEntryForType(this));
   ETypes.clear();
 #endif
 }
@@ -934,7 +924,7 @@ PointerType *PointerType::get(const Type *ValueType) {
 
 void PointerType::dropAllTypeUses(bool inMap) {
 #if 0
-  //if (inMap) PointerTypes.remove(PointerTypes.getEntryForType(this));
+  if (inMap) PointerTypes.remove(PointerTypes.getEntryForType(this));
   ElementType = Type::IntTy;
 #endif
 }
@@ -1033,13 +1023,11 @@ void DerivedType::refineAbstractTypeToInternal(const Type *NewType, bool inMap){
   //
   addAbstractTypeUser(this);
 
-#if 0
   // To make the situation simpler, we ask the subclass to remove this type from
   // the type map, and to replace any type uses with uses of non-abstract types.
   // This dramatically limits the amount of recursive type trouble we can find
   // ourselves in.
   dropAllTypeUses(inMap);
-#endif
 
   // Count the number of self uses.  Stop looping when sizeof(list) == NSU.
   unsigned NumSelfUses = 0;