]> granicus.if.org Git - llvm/commitdiff
ConstantHoisting - Silence static analyzer dyn_cast<PointerType> null dereference...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 22 Sep 2019 17:45:05 +0000 (17:45 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 22 Sep 2019 17:45:05 +0000 (17:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372517 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ConstantHoisting.cpp

index ff9e6d94d859725df290a6f4f08fe36813a95e79..9f340afbf7c284957b07d2ec5f3d3963d7b5e6f8 100644 (file)
@@ -401,7 +401,7 @@ void ConstantHoistingPass::collectConstantCandidates(
     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);