aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-09-08 05:46:15 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-09-08 05:46:15 +0000
commit8f5075b966114575cf0cb1f4875fdc82948ffc02 (patch)
tree0efa864f9b18bacdcb39e89fac3476b607c0ad7d
parent2c0a49c8cba8b7a6624d9c0b96f7d94231e10d22 (diff)
downloadexternal_llvm-8f5075b966114575cf0cb1f4875fdc82948ffc02.zip
external_llvm-8f5075b966114575cf0cb1f4875fdc82948ffc02.tar.gz
external_llvm-8f5075b966114575cf0cb1f4875fdc82948ffc02.tar.bz2
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
-rw-r--r--lib/VMCore/Verifier.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index c7e7179..5d9d7ad 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -1447,12 +1447,10 @@ void Verifier::visitInstruction(Instruction &I) {
/// VerifyType - Verify that a type is well formed.
///
void Verifier::VerifyType(const Type *Ty) {
- // We insert complex types into CheckedTypes even if they failed verification
- // to prevent emitting messages about them multiple times if
+ if (!CheckedTypes.insert(Ty)) return;
switch (Ty->getTypeID()) {
case Type::FunctionTyID: {
- if (!CheckedTypes.insert(Ty)) return;
const FunctionType *FTy = cast<FunctionType>(Ty);
const Type *RetTy = FTy->getReturnType();
@@ -1468,7 +1466,6 @@ void Verifier::VerifyType(const Type *Ty) {
}
} break;
case Type::StructTyID: {
- if (!CheckedTypes.insert(Ty)) return;
const StructType *STy = cast<StructType>(Ty);
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
const Type *ElTy = STy->getElementType(i);
@@ -1478,28 +1475,25 @@ void Verifier::VerifyType(const Type *Ty) {
}
} break;
case Type::ArrayTyID: {
- if (!CheckedTypes.insert(Ty)) return;
const ArrayType *ATy = cast<ArrayType>(Ty);
Assert1(ArrayType::isValidElementType(ATy->getElementType()),
"Array type with invalid element type", ATy);
VerifyType(ATy->getElementType());
} break;
case Type::PointerTyID: {
- if (!CheckedTypes.insert(Ty)) return;
const PointerType *PTy = cast<PointerType>(Ty);
Assert1(PointerType::isValidElementType(PTy->getElementType()),
"Pointer type with invalid element type", PTy);
VerifyType(PTy->getElementType());
- }
+ } break;
case Type::VectorTyID: {
- if (!CheckedTypes.insert(Ty)) return;
const VectorType *VTy = cast<VectorType>(Ty);
Assert1(VectorType::isValidElementType(VTy->getElementType()),
"Vector type with invalid element type", VTy);
VerifyType(VTy->getElementType());
- }
+ } break;
default:
- return;
+ break;
}
}