[AArch64] AArch64StackTagging - Silence static analyzer dyn_cast<> null dereference...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 22 Sep 2019 13:43:12 +0000 (13:43 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 22 Sep 2019 13:43:12 +0000 (13:43 +0000)
The static analyzer is warning about potential null dereferences, but we should be able to use cast<> directly and if not assert will fire for us.

llvm-svn: 372507

llvm/lib/Target/AArch64/AArch64StackTagging.cpp

index 4dfe743bafa8e37eb41153f3b034a3bdd03c76fc..5942f61ca74d7c12c8e1262189ff42406f2b1a5a 100644 (file)
@@ -471,7 +471,7 @@ void AArch64StackTagging::alignAndPadAlloca(AllocaInfo &Info) {
       Info.AI->isArrayAllocation()
           ? ArrayType::get(
                 Info.AI->getAllocatedType(),
-                dyn_cast<ConstantInt>(Info.AI->getArraySize())->getZExtValue())
+                cast<ConstantInt>(Info.AI->getArraySize())->getZExtValue())
           : Info.AI->getAllocatedType();
   Type *PaddingType =
       ArrayType::get(Type::getInt8Ty(F->getContext()), AlignedSize - Size);