diff options
| author | Davide Italiano <davide@freebsd.org> | 2016-04-08 00:01:32 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2016-04-08 00:01:32 +0000 |
| commit | 08f8f21b91e4a805ea71f48c1b04795a14da0f75 (patch) | |
| tree | 5db2769995aa8934d92dde7be79de99ddf89c871 /llvm/lib | |
| parent | 25c36fd61bbbc85632273d91ecb473fd4c472d0f (diff) | |
| download | bcm5719-llvm-08f8f21b91e4a805ea71f48c1b04795a14da0f75.tar.gz bcm5719-llvm-08f8f21b91e4a805ea71f48c1b04795a14da0f75.zip | |
[IR/Verifier] Fix (yet another) crash.
We need to check that if we reference a retainedType from
DICompileUnit we're actually referencing a DICompositeType.
llvm-svn: 265752
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Verifier.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index fc9cc7d27d5..abb0e9b32a9 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -4380,14 +4380,20 @@ void Verifier::verifyTypeRefs() { // Visit all the compile units again to map the type references. SmallDenseMap<const MDString *, const DIType *, 32> TypeRefs; - 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)); - } + for (auto *MD : CUs->operands()) { + auto *CU = dyn_cast<DICompileUnit>(MD); + if (!CU) + continue; + auto *Array = CU->getRawRetainedTypes(); + if (!Array || !isa<MDTuple>(Array)) + continue; + 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 |

