[llvm-commits] CVS: llvm/lib/VMCore/Type.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Mar 9 09:34:44 PST 2005



Changes in directory llvm/lib/VMCore:

Type.cpp updated: 1.122 -> 1.123
---
Log message:

correct the computation of the isAbstract bit for types.


---
Diffs of the changes:  (+8 -3)

 Type.cpp |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)


Index: llvm/lib/VMCore/Type.cpp
diff -u llvm/lib/VMCore/Type.cpp:1.122 llvm/lib/VMCore/Type.cpp:1.123
--- llvm/lib/VMCore/Type.cpp:1.122	Tue Mar  1 21:54:43 2005
+++ llvm/lib/VMCore/Type.cpp	Wed Mar  9 11:34:27 2005
@@ -481,8 +481,6 @@
 // PromoteAbstractToConcrete - This is a recursive function that walks a type
 // graph calculating whether or not a type is abstract.
 //
-// This method returns true if the type is found to still be abstract.
-//
 void Type::PromoteAbstractToConcrete() {
   if (!isAbstract()) return;
 
@@ -505,7 +503,10 @@
         for (Type::subtype_iterator CI = SCC[i]->subtype_begin(),
                E = SCC[i]->subtype_end(); CI != E; ++CI)
           if ((*CI)->isAbstract())
-            return;               // Not going to be concrete, sorry.
+            // If the child type is in our SCC, it doesn't make the entire SCC
+            // abstract unless there is a non-SCC abstract type.
+            if (std::find(SCC.begin(), SCC.end(), *CI) == SCC.end())
+              return;               // Not going to be concrete, sorry.
       
       // Okay, we just discovered this whole SCC is now concrete, mark it as
       // such!
@@ -513,6 +514,10 @@
         assert(SCC[i]->isAbstract() && "Why are we processing concrete types?");
         
         SCC[i]->setAbstract(false);
+      }
+
+      for (unsigned i = 0, e = SCC.size(); i != e; ++i) {
+        assert(!SCC[i]->isAbstract() && "Concrete type became abstract?");
         // The type just became concrete, notify all users!
         cast<DerivedType>(SCC[i])->notifyUsesThatTypeBecameConcrete();
       }






More information about the llvm-commits mailing list