From: Simon Pilgrim Date: Thu, 26 Sep 2019 10:56:07 +0000 (+0000) Subject: PGOMemOPSizeOpt - silence static analyzer dyn_cast null dereference... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=71dc0084d4385762412ede487d39c2905e18e96d;p=llvm PGOMemOPSizeOpt - silence static analyzer dyn_cast null dereference warning. NFCI. The static analyzer is warning about a potential null dereference, but we should be able to use cast directly and if not assert will fire for us. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372959 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp b/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp index ac78b4d993e..9f81bb16d0a 100644 --- a/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp +++ b/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp @@ -374,8 +374,8 @@ bool MemOPSizeOpt::perform(MemIntrinsic *MI) { Ctx, Twine("MemOP.Case.") + Twine(SizeId), &Func, DefaultBB); Instruction *NewInst = MI->clone(); // Fix the argument. - MemIntrinsic * MemI = dyn_cast(NewInst); - IntegerType *SizeType = dyn_cast(MemI->getLength()->getType()); + auto *MemI = cast(NewInst); + auto *SizeType = dyn_cast(MemI->getLength()->getType()); assert(SizeType && "Expected integer type size argument."); ConstantInt *CaseSizeId = ConstantInt::get(SizeType, SizeId); MemI->setLength(CaseSizeId);