It's possible for a global variable to be optimized out of a metadata object. So
we should allow a "null" with this dyn_cast.
llvm-svn: 83573
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index 1436aa9..81d0ddb 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/lib/Analysis/DebugInfo.cpp
@@ -116,7 +116,7 @@
return 0;
if (Elt < DbgNode->getNumElements())
- return dyn_cast<GlobalVariable>(DbgNode->getElement(Elt));
+ return dyn_cast_or_null<GlobalVariable>(DbgNode->getElement(Elt));
return 0;
}