Author: Simon Pilgrim
Date: 2021-01-05T09:34:01Z
New Revision: 84d5768d97635602225f5056da96b058e588b2f5

URL: 
https://github.com/llvm/llvm-project/commit/84d5768d97635602225f5056da96b058e588b2f5
DIFF: 
https://github.com/llvm/llvm-project/commit/84d5768d97635602225f5056da96b058e588b2f5.diff

LOG: MemProfiler::insertDynamicShadowAtFunctionEntry - use cast<> instead of 
dyn_cast<> for dereferenced pointer. NFCI.

We're immediately dereferencing the casted pointer, so use cast<> which will 
assert instead of dyn_cast<> which can return null.

Fixes static analyzer warning.

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/MemProfiler.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp 
b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
index 56006bbc94c7..0e6a404a9e0b 100644
--- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
@@ -577,7 +577,7 @@ bool 
MemProfiler::insertDynamicShadowAtFunctionEntry(Function &F) {
   Value *GlobalDynamicAddress = F.getParent()->getOrInsertGlobal(
       MemProfShadowMemoryDynamicAddress, IntptrTy);
   if (F.getParent()->getPICLevel() == PICLevel::NotPIC)
-    dyn_cast<GlobalVariable>(GlobalDynamicAddress)->setDSOLocal(true);
+    cast<GlobalVariable>(GlobalDynamicAddress)->setDSOLocal(true);
   DynamicShadowOffset = IRB.CreateLoad(IntptrTy, GlobalDynamicAddress);
   return true;
 }


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to