[llvm] r371998 - [ExecutionEngine] Don't dereference a dyn_cast result. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 08:19:12 PDT 2019
Author: rksimon
Date: Mon Sep 16 08:19:11 2019
New Revision: 371998
URL: http://llvm.org/viewvc/llvm-project?rev=371998&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=371998&r1=371997&r2=371998&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Mon Sep 16 08:19:11 2019
@@ -626,7 +626,7 @@ GenericValue ExecutionEngine::getConstan
break;
case Type::VectorTyID:
// if the whole vector is 'undef' just reserve memory for the value.
- auto* VTy = dyn_cast<VectorType>(C->getType());
+ auto* VTy = cast<VectorType>(C->getType());
Type *ElemTy = VTy->getElementType();
unsigned int elemNum = VTy->getNumElements();
Result.AggregateVal.resize(elemNum);
@@ -925,7 +925,7 @@ GenericValue ExecutionEngine::getConstan
elemNum = CDV->getNumElements();
ElemTy = CDV->getElementType();
} else if (CV || CAZ) {
- VectorType* VTy = dyn_cast<VectorType>(C->getType());
+ auto* VTy = cast<VectorType>(C->getType());
elemNum = VTy->getNumElements();
ElemTy = VTy->getElementType();
} else {
More information about the llvm-commits
mailing list