mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-18 12:09:38 +00:00
Hoist out the test+insert to CheckedTypes. This doesn't seem to affect
performance. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81193 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2c0a49c8cb
commit
8f5075b966
@ -1447,12 +1447,10 @@ void Verifier::visitInstruction(Instruction &I) {
|
|||||||
/// VerifyType - Verify that a type is well formed.
|
/// VerifyType - Verify that a type is well formed.
|
||||||
///
|
///
|
||||||
void Verifier::VerifyType(const Type *Ty) {
|
void Verifier::VerifyType(const Type *Ty) {
|
||||||
// We insert complex types into CheckedTypes even if they failed verification
|
if (!CheckedTypes.insert(Ty)) return;
|
||||||
// to prevent emitting messages about them multiple times if
|
|
||||||
|
|
||||||
switch (Ty->getTypeID()) {
|
switch (Ty->getTypeID()) {
|
||||||
case Type::FunctionTyID: {
|
case Type::FunctionTyID: {
|
||||||
if (!CheckedTypes.insert(Ty)) return;
|
|
||||||
const FunctionType *FTy = cast<FunctionType>(Ty);
|
const FunctionType *FTy = cast<FunctionType>(Ty);
|
||||||
|
|
||||||
const Type *RetTy = FTy->getReturnType();
|
const Type *RetTy = FTy->getReturnType();
|
||||||
@ -1468,7 +1466,6 @@ void Verifier::VerifyType(const Type *Ty) {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Type::StructTyID: {
|
case Type::StructTyID: {
|
||||||
if (!CheckedTypes.insert(Ty)) return;
|
|
||||||
const StructType *STy = cast<StructType>(Ty);
|
const StructType *STy = cast<StructType>(Ty);
|
||||||
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
||||||
const Type *ElTy = STy->getElementType(i);
|
const Type *ElTy = STy->getElementType(i);
|
||||||
@ -1478,28 +1475,25 @@ void Verifier::VerifyType(const Type *Ty) {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Type::ArrayTyID: {
|
case Type::ArrayTyID: {
|
||||||
if (!CheckedTypes.insert(Ty)) return;
|
|
||||||
const ArrayType *ATy = cast<ArrayType>(Ty);
|
const ArrayType *ATy = cast<ArrayType>(Ty);
|
||||||
Assert1(ArrayType::isValidElementType(ATy->getElementType()),
|
Assert1(ArrayType::isValidElementType(ATy->getElementType()),
|
||||||
"Array type with invalid element type", ATy);
|
"Array type with invalid element type", ATy);
|
||||||
VerifyType(ATy->getElementType());
|
VerifyType(ATy->getElementType());
|
||||||
} break;
|
} break;
|
||||||
case Type::PointerTyID: {
|
case Type::PointerTyID: {
|
||||||
if (!CheckedTypes.insert(Ty)) return;
|
|
||||||
const PointerType *PTy = cast<PointerType>(Ty);
|
const PointerType *PTy = cast<PointerType>(Ty);
|
||||||
Assert1(PointerType::isValidElementType(PTy->getElementType()),
|
Assert1(PointerType::isValidElementType(PTy->getElementType()),
|
||||||
"Pointer type with invalid element type", PTy);
|
"Pointer type with invalid element type", PTy);
|
||||||
VerifyType(PTy->getElementType());
|
VerifyType(PTy->getElementType());
|
||||||
}
|
} break;
|
||||||
case Type::VectorTyID: {
|
case Type::VectorTyID: {
|
||||||
if (!CheckedTypes.insert(Ty)) return;
|
|
||||||
const VectorType *VTy = cast<VectorType>(Ty);
|
const VectorType *VTy = cast<VectorType>(Ty);
|
||||||
Assert1(VectorType::isValidElementType(VTy->getElementType()),
|
Assert1(VectorType::isValidElementType(VTy->getElementType()),
|
||||||
"Vector type with invalid element type", VTy);
|
"Vector type with invalid element type", VTy);
|
||||||
VerifyType(VTy->getElementType());
|
VerifyType(VTy->getElementType());
|
||||||
}
|
} break;
|
||||||
default:
|
default:
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user