[llvm] r372507 - [AArch64] AArch64StackTagging - Silence static analyzer dyn_cast<> null dereference warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 06:43:12 PDT 2019


Author: rksimon
Date: Sun Sep 22 06:43:12 2019
New Revision: 372507

URL: http://llvm.org/viewvc/llvm-project?rev=372507&view=rev
Log:
[AArch64] AArch64StackTagging - Silence static analyzer dyn_cast<> null dereference warning. NFCI.

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.

Modified:
    llvm/trunk/lib/Target/AArch64/AArch64StackTagging.cpp

Modified: llvm/trunk/lib/Target/AArch64/AArch64StackTagging.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64StackTagging.cpp?rev=372507&r1=372506&r2=372507&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64StackTagging.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64StackTagging.cpp Sun Sep 22 06:43:12 2019
@@ -471,7 +471,7 @@ void AArch64StackTagging::alignAndPadAll
       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);




More information about the llvm-commits mailing list