]> granicus.if.org Git - llvm/commitdiff
GVNHoist - silence static analyzer dyn_cast<> null dereference warning in hasEHOrLoad...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 21 Oct 2019 17:15:49 +0000 (17:15 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 21 Oct 2019 17:15:49 +0000 (17:15 +0000)
The static analyzer is warning about a potential null dereference, but we should be able to use cast<> directly and if not assert will fire for us.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375429 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GVNHoist.cpp

index 1f01ba2fbfc6c37d5642db39ca363f76dfcfe683..c87e41484b132f0e369b29c6d820a8541179cd5f 100644 (file)
@@ -539,7 +539,7 @@ private:
 
     // Check for unsafe hoistings due to side effects.
     if (K == InsKind::Store) {
-      if (hasEHOrLoadsOnPath(NewPt, dyn_cast<MemoryDef>(U), NBBsOnAllPaths))
+      if (hasEHOrLoadsOnPath(NewPt, cast<MemoryDef>(U), NBBsOnAllPaths))
         return false;
     } else if (hasEHOnPath(NewBB, OldBB, NBBsOnAllPaths))
       return false;