[llvm] 0ff1ab4 - Use cast<> instead of dyn_cast<> as we dereference the pointer immediately. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 30 07:33:42 PDT 2020


Author: Simon Pilgrim
Date: 2020-10-30T14:33:20Z
New Revision: 0ff1ab42f23d4efc043821ec447da5e553cd893e

URL: https://github.com/llvm/llvm-project/commit/0ff1ab42f23d4efc043821ec447da5e553cd893e
DIFF: https://github.com/llvm/llvm-project/commit/0ff1ab42f23d4efc043821ec447da5e553cd893e.diff

LOG: Use cast<> instead of dyn_cast<> as we dereference the pointer immediately. NFCI.

Fix clang static analyzer warning - we know that the arg should be ConstantInt and we're better off relying on cast<> asserting on failure rather than a null dereference crash.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index ac25a0aeb41b..c8ec7efb15ab 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -658,7 +658,7 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
       IntrinsicInst *Start = Info.LifetimeStart[0];
       IntrinsicInst *End = Info.LifetimeEnd[0];
       uint64_t Size =
-          dyn_cast<ConstantInt>(Start->getArgOperand(0))->getZExtValue();
+          cast<ConstantInt>(Start->getArgOperand(0))->getZExtValue();
       Size = alignTo(Size, kTagGranuleSize);
       tagAlloca(AI, Start->getNextNode(), Start->getArgOperand(1), Size);
       // We need to ensure that if we tag some object, we certainly untag it


        


More information about the llvm-commits mailing list