[llvm] r372517 - ConstantHoisting - Silence static analyzer dyn_cast<PointerType> null dereference warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 10:45:05 PDT 2019


Author: rksimon
Date: Sun Sep 22 10:45:05 2019
New Revision: 372517

URL: http://llvm.org/viewvc/llvm-project?rev=372517&view=rev
Log:
ConstantHoisting - Silence static analyzer dyn_cast<PointerType> null dereference warning. NFCI.

Modified:
    llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp?rev=372517&r1=372516&r2=372517&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ConstantHoisting.cpp Sun Sep 22 10:45:05 2019
@@ -401,7 +401,7 @@ void ConstantHoistingPass::collectConsta
     return;
 
   // Get offset from the base GV.
-  PointerType *GVPtrTy = dyn_cast<PointerType>(BaseGV->getType());
+  PointerType *GVPtrTy = cast<PointerType>(BaseGV->getType());
   IntegerType *PtrIntTy = DL->getIntPtrType(*Ctx, GVPtrTy->getAddressSpace());
   APInt Offset(DL->getTypeSizeInBits(PtrIntTy), /*val*/0, /*isSigned*/true);
   auto *GEPO = cast<GEPOperator>(ConstExpr);




More information about the llvm-commits mailing list