mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-16 14:31:59 +00:00
Unswitch a loop, add more assertions, eliminate use of removeUserFromConcrete.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24324 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d4f328e8c1
commit
7548590ecc
@ -736,7 +736,9 @@ public:
|
|||||||
/// The specified iterator tells us what the type USED to look like.
|
/// The specified iterator tells us what the type USED to look like.
|
||||||
void finishRefinement(TypeClass *Ty, const DerivedType *OldType,
|
void finishRefinement(TypeClass *Ty, const DerivedType *OldType,
|
||||||
const Type *NewType) {
|
const Type *NewType) {
|
||||||
assert((Ty->isAbstract() || !OldType->isAbstract()) &&
|
// Either NewTy == OldTy (in which case the specified type just became
|
||||||
|
// concrete) or they are different an the Ty is thought to be abstract.
|
||||||
|
assert((Ty->isAbstract() || OldType == NewType) &&
|
||||||
"Refining a non-abstract type!");
|
"Refining a non-abstract type!");
|
||||||
#ifdef DEBUG_MERGE_TYPES
|
#ifdef DEBUG_MERGE_TYPES
|
||||||
std::cerr << "refineAbstractTy(" << (void*)OldType << "[" << *OldType
|
std::cerr << "refineAbstractTy(" << (void*)OldType << "[" << *OldType
|
||||||
@ -755,19 +757,21 @@ public:
|
|||||||
// Remember the structural hash for the type before we start hacking on it,
|
// Remember the structural hash for the type before we start hacking on it,
|
||||||
// in case we need it later.
|
// in case we need it later.
|
||||||
unsigned OldTypeHash = ValType::hashTypeStructure(Ty);
|
unsigned OldTypeHash = ValType::hashTypeStructure(Ty);
|
||||||
unsigned NewTypeHash;
|
|
||||||
|
|
||||||
// Find the type element we are refining... and change it now!
|
// Find the type element we are refining... and change it now!
|
||||||
if (OldType != NewType || !OldType->isAbstract()) {
|
if (!OldType->isAbstract()) {
|
||||||
|
// If the element just became concrete, remove 'ty' from the abstract
|
||||||
|
// type user list for the type.
|
||||||
for (unsigned i = 0, e = Ty->ContainedTys.size(); i != e; ++i)
|
for (unsigned i = 0, e = Ty->ContainedTys.size(); i != e; ++i)
|
||||||
if (Ty->ContainedTys[i] == OldType) {
|
if (Ty->ContainedTys[i] == OldType)
|
||||||
Ty->ContainedTys[i].removeUserFromConcrete();
|
OldType->removeAbstractTypeUser(Ty);
|
||||||
|
} else {
|
||||||
|
assert(OldType != NewType && "Unknown case!");
|
||||||
|
for (unsigned i = 0, e = Ty->ContainedTys.size(); i != e; ++i)
|
||||||
|
if (Ty->ContainedTys[i] == OldType)
|
||||||
Ty->ContainedTys[i] = NewType;
|
Ty->ContainedTys[i] = NewType;
|
||||||
}
|
}
|
||||||
NewTypeHash = ValType::hashTypeStructure(Ty);
|
unsigned NewTypeHash = ValType::hashTypeStructure(Ty);
|
||||||
} else {
|
|
||||||
NewTypeHash = OldTypeHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are no cycles going through this node, we can do a simple,
|
// If there are no cycles going through this node, we can do a simple,
|
||||||
// efficient lookup in the map, instead of an inefficient nasty linear
|
// efficient lookup in the map, instead of an inefficient nasty linear
|
||||||
|
Loading…
x
Reference in New Issue
Block a user