diff options
author | Chris Lattner <sabre@nondot.org> | 2003-09-02 22:15:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-09-02 22:15:15 +0000 |
commit | 1bb626387b4e3493543464e73808848378f3b7f2 (patch) | |
tree | 4269916731b3cd299420b9ea9d583eb612709f97 | |
parent | bc4846d76c4b3319bdfe24daa7f341133aea89d3 (diff) |
Another optimization, speed up the testcase to 2.7s
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8333 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Type.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 97a6647127..5475a57188 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -208,8 +208,8 @@ static std::string getTypeDescription(const Type *Ty, TypeStack.pop_back(); // Remove self from stack... - // In order to reduce the amount of repeated computation, we cache the computd - // value for later. + // In order to reduce the amount of repeated computation, we cache the + // computed value for later. if (Ty->isAbstract()) AbstractTypeDescriptions[Ty] = Result; else @@ -348,6 +348,7 @@ FunctionType::FunctionType(const Type *Result, for (unsigned i = 0; i < Params.size(); ++i) ParamTys.push_back(PATypeHandle(Params[i], this)); + setAbstract(true); setDerivedTypeProperties(); } @@ -358,16 +359,19 @@ StructType::StructType(const std::vector<const Type*> &Types) assert(Types[i] != Type::VoidTy && "Void type in method prototype!!"); ETypes.push_back(PATypeHandle(Types[i], this)); } + setAbstract(true); setDerivedTypeProperties(); } ArrayType::ArrayType(const Type *ElType, unsigned NumEl) : SequentialType(ArrayTyID, ElType) { NumElements = NumEl; + setAbstract(true); setDerivedTypeProperties(); } PointerType::PointerType(const Type *E) : SequentialType(PointerTyID, E) { + setAbstract(true); setDerivedTypeProperties(); } @@ -408,8 +412,8 @@ bool Type::isTypeAbstract() { for (Type::subtype_iterator I = subtype_begin(), E = subtype_end(); I != E; ++I) if (const_cast<Type*>(*I)->isTypeAbstract()) { - setAbstract(true); - return true; + setAbstract(true); // Restore the abstract bit. + return true; // This type is abstract if subtype is abstract! } // Restore the abstract bit. @@ -424,6 +428,8 @@ bool Type::isTypeAbstract() { // setting for a type. The getTypeProps function does all the dirty work. // void DerivedType::setDerivedTypeProperties() { + // If the type is currently thought to be abstract, rescan all of our subtypes + // to see if the type has just become concrete! setAbstract(true); setAbstract(isTypeAbstract()); } |