[llvm] 274359c - [OpenMPOpt] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 8 05:51:30 PST 2022


Author: Simon Pilgrim
Date: 2022-01-08T13:47:35Z
New Revision: 274359cf099407172fee7f0bd704b8ff41d826ec

URL: https://github.com/llvm/llvm-project/commit/274359cf099407172fee7f0bd704b8ff41d826ec
DIFF: https://github.com/llvm/llvm-project/commit/274359cf099407172fee7f0bd704b8ff41d826ec.diff

LOG: [OpenMPOpt] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr. NFC

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index a28c850f8c5be..2b29a0c93faa2 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -2754,7 +2754,7 @@ struct AAHeapToSharedFunction : public AAHeapToShared {
       if (FreeCalls.size() != 1)
         continue;
 
-      ConstantInt *AllocSize = dyn_cast<ConstantInt>(CB->getArgOperand(0));
+      auto *AllocSize = cast<ConstantInt>(CB->getArgOperand(0));
 
       LLVM_DEBUG(dbgs() << TAG << "Replace globalization call " << *CB
                         << " with " << AllocSize->getZExtValue()


        


More information about the llvm-commits mailing list