1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

[IRVerifier] Prefer dyn_cast<> over isa<> + cast<>.

Thanks to Rafael for the suggestion!

llvm-svn: 265579
This commit is contained in:
Davide Italiano 2016-04-06 18:13:44 +00:00
parent 3ca438a215
commit 1eb7bb3604

View File

@ -4375,15 +4375,14 @@ void Verifier::verifyTypeRefs() {
// Visit all the compile units again to map the type references.
SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs;
for (auto *CU : CUs->operands())
if (isa<DICompileUnit>(CU))
if (auto Ts = cast<DICompileUnit>(CU)->getRetainedTypes())
for (DIType *Op : Ts)
if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
if (auto *S = T->getRawIdentifier()) {
UnresolvedTypeRefs.erase(S);
TypeRefs.insert(std::make_pair(S, T));
}
for (auto *MD : CUs->operands())
if (auto *CU = dyn_cast<DICompileUnit>(MD))
for (DIType *Op : CU->getRetainedTypes())
if (auto *T = dyn_cast_or_null<DICompositeType>(Op))
if (auto *S = T->getRawIdentifier()) {
UnresolvedTypeRefs.erase(S);
TypeRefs.insert(std::make_pair(S, T));
}
// Verify debug info intrinsic bit piece expressions. This needs a second
// pass through the intructions, since we haven't built TypeRefs yet when