This situation can occur:
[oota-llvm.git] / lib / VMCore / Type.cpp
index c9805ea856ac3977ca6e9479703273266bff50d0..3a9ea582f112efb088d357bd55f48f55f133986e 100644 (file)
@@ -717,11 +717,11 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2) {
 // ever reach a non-abstract type, we know that we don't need to search the
 // subgraph.
 static bool AbstractTypeHasCycleThrough(const Type *TargetTy, const Type *CurTy,
-                                std::set<const Type*> &VisitedTypes) {
+                                SmallPtrSet<const Type*, 128> &VisitedTypes) {
   if (TargetTy == CurTy) return true;
   if (!CurTy->isAbstract()) return false;
 
-  if (!VisitedTypes.insert(CurTy).second)
+  if (!VisitedTypes.insert(CurTy))
     return false;  // Already been here.
 
   for (Type::subtype_iterator I = CurTy->subtype_begin(),
@@ -732,10 +732,10 @@ static bool AbstractTypeHasCycleThrough(const Type *TargetTy, const Type *CurTy,
 }
 
 static bool ConcreteTypeHasCycleThrough(const Type *TargetTy, const Type *CurTy,
-                                        std::set<const Type*> &VisitedTypes) {
+                                SmallPtrSet<const Type*, 128> &VisitedTypes) {
   if (TargetTy == CurTy) return true;
 
-  if (!VisitedTypes.insert(CurTy).second)
+  if (!VisitedTypes.insert(CurTy))
     return false;  // Already been here.
 
   for (Type::subtype_iterator I = CurTy->subtype_begin(),
@@ -748,7 +748,7 @@ static bool ConcreteTypeHasCycleThrough(const Type *TargetTy, const Type *CurTy,
 /// TypeHasCycleThroughItself - Return true if the specified type has a cycle
 /// back to itself.
 static bool TypeHasCycleThroughItself(const Type *Ty) {
-  std::set<const Type*> VisitedTypes;
+  SmallPtrSet<const Type*, 128> VisitedTypes;
 
   if (Ty->isAbstract()) {  // Optimized case for abstract types.
     for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end();
@@ -901,7 +901,7 @@ public:
     // The old record is now out-of-date, because one of the children has been
     // updated.  Remove the obsolete entry from the map.
     unsigned NumErased = Map.erase(ValType::get(Ty));
-    assert(NumErased && "Element not found!");
+    assert(NumErased && "Element not found!"); NumErased = NumErased;
 
     // Remember the structural hash for the type before we start hacking on it,
     // in case we need it later.
@@ -1426,7 +1426,7 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) {
   while (!AbstractTypeUsers.empty() && NewTy != this) {
     AbstractTypeUser *User = AbstractTypeUsers.back();
 
-    unsigned OldSize = AbstractTypeUsers.size();
+    unsigned OldSize = AbstractTypeUsers.size(); OldSize=OldSize;
 #ifdef DEBUG_MERGE_TYPES
     DOUT << " REFINING user " << OldSize-1 << "[" << (void*)User
          << "] of abstract type [" << (void*)this << " "
@@ -1453,7 +1453,7 @@ void DerivedType::notifyUsesThatTypeBecameConcrete() {
   DOUT << "typeIsREFINED type: " << (void*)this << " " << *this << "\n";
 #endif
 
-  unsigned OldSize = AbstractTypeUsers.size();
+  unsigned OldSize = AbstractTypeUsers.size(); OldSize=OldSize;
   while (!AbstractTypeUsers.empty()) {
     AbstractTypeUser *ATU = AbstractTypeUsers.back();
     ATU->typeBecameConcrete(this);