containsEquivalent never returns its argument

llvm-svn: 8353
This commit is contained in:
Chris Lattner 2003-09-04 23:49:53 +00:00
parent b4520603a4
commit e4fdce4235
1 changed files with 5 additions and 9 deletions

View File

@ -503,7 +503,7 @@ public:
inline const TypeClass *containsEquivalent(const TypeClass *Ty) { inline const TypeClass *containsEquivalent(const TypeClass *Ty) {
for (typename MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I) for (typename MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
if (I->second.get() != Ty && TypesEqual(Ty, I->second.get())) if (I->second.get() != Ty && TypesEqual(Ty, I->second.get()))
return (TypeClass*)I->second.get(); // FIXME TODO when types not const return (TypeClass*)I->second.get();
return 0; return 0;
} }
@ -1065,8 +1065,7 @@ void FunctionType::refineAbstractType(const DerivedType *OldType,
ParamTys[i] = NewType; ParamTys[i] = NewType;
} }
const FunctionType *MT = FunctionTypes.containsEquivalent(this); if (const FunctionType *MT = FunctionTypes.containsEquivalent(this)) {
if (MT && MT != this) {
refineAbstractTypeTo(MT); // Different type altogether... refineAbstractTypeTo(MT); // Different type altogether...
} else { } else {
// If the type is currently thought to be abstract, rescan all of our // If the type is currently thought to be abstract, rescan all of our
@ -1093,8 +1092,7 @@ void ArrayType::refineAbstractType(const DerivedType *OldType,
ElementType.removeUserFromConcrete(); ElementType.removeUserFromConcrete();
ElementType = NewType; ElementType = NewType;
const ArrayType *AT = ArrayTypes.containsEquivalent(this); if (const ArrayType *AT = ArrayTypes.containsEquivalent(this)) {
if (AT && AT != this) {
refineAbstractTypeTo(AT); // Different type altogether... refineAbstractTypeTo(AT); // Different type altogether...
} else { } else {
// If the type is currently thought to be abstract, rescan all of our // If the type is currently thought to be abstract, rescan all of our
@ -1124,8 +1122,7 @@ void StructType::refineAbstractType(const DerivedType *OldType,
ETypes[i] = NewType; ETypes[i] = NewType;
} }
const StructType *ST = StructTypes.containsEquivalent(this); if (const StructType *ST = StructTypes.containsEquivalent(this)) {
if (ST && ST != this) {
refineAbstractTypeTo(ST); // Different type altogether... refineAbstractTypeTo(ST); // Different type altogether...
} else { } else {
// If the type is currently thought to be abstract, rescan all of our // If the type is currently thought to be abstract, rescan all of our
@ -1151,8 +1148,7 @@ void PointerType::refineAbstractType(const DerivedType *OldType,
ElementType.removeUserFromConcrete(); ElementType.removeUserFromConcrete();
ElementType = NewType; ElementType = NewType;
const PointerType *PT = PointerTypes.containsEquivalent(this); if (const PointerType *PT = PointerTypes.containsEquivalent(this)) {
if (PT && PT != this) {
refineAbstractTypeTo(PT); // Different type altogether... refineAbstractTypeTo(PT); // Different type altogether...
} else { } else {
// If the type is currently thought to be abstract, rescan all of our // If the type is currently thought to be abstract, rescan all of our