[llvm] r373095 - SCCP - silence static analyzer dyn_cast<StructType> null dereference warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 08:49:10 PDT 2019
Author: rksimon
Date: Fri Sep 27 08:49:10 2019
New Revision: 373095
URL: http://llvm.org/viewvc/llvm-project?rev=373095&view=rev
Log:
SCCP - silence static analyzer dyn_cast<StructType> null dereference warning. NFCI.
The static analyzer is warning about a potential null dereference, but we should be able to use cast<StructType> directly and if not assert will fire for us.
Modified:
llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=373095&r1=373094&r2=373095&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Fri Sep 27 08:49:10 2019
@@ -1757,7 +1757,7 @@ static bool tryToReplaceWithConstant(SCC
[](const LatticeVal &LV) { return LV.isOverdefined(); }))
return false;
std::vector<Constant *> ConstVals;
- auto *ST = dyn_cast<StructType>(V->getType());
+ auto *ST = cast<StructType>(V->getType());
for (unsigned i = 0, e = ST->getNumElements(); i != e; ++i) {
LatticeVal V = IVs[i];
ConstVals.push_back(V.isConstant()
More information about the llvm-commits
mailing list