From: Simon Pilgrim Date: Mon, 16 Sep 2019 15:19:11 +0000 (+0000) Subject: [ExecutionEngine] Don't dereference a dyn_cast result. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4ee527f9a9866438e9767ba04ebab6f9c84d28c;p=llvm [ExecutionEngine] Don't dereference a dyn_cast result. NFCI. The static analyzer is warning about potential null dereferences of dyn_cast<> results - in these cases we can safely use cast<> directly as we know that these cases should all be the correct type, which is why its working atm and anyway cast<> will assert if they aren't. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371998 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ExecutionEngine/ExecutionEngine.cpp b/lib/ExecutionEngine/ExecutionEngine.cpp index a425c612108..ee7a7cb60bc 100644 --- a/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/lib/ExecutionEngine/ExecutionEngine.cpp @@ -626,7 +626,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { break; case Type::VectorTyID: // if the whole vector is 'undef' just reserve memory for the value. - auto* VTy = dyn_cast(C->getType()); + auto* VTy = cast(C->getType()); Type *ElemTy = VTy->getElementType(); unsigned int elemNum = VTy->getNumElements(); Result.AggregateVal.resize(elemNum); @@ -925,7 +925,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) { elemNum = CDV->getNumElements(); ElemTy = CDV->getElementType(); } else if (CV || CAZ) { - VectorType* VTy = dyn_cast(C->getType()); + auto* VTy = cast(C->getType()); elemNum = VTy->getNumElements(); ElemTy = VTy->getElementType(); } else {