[llvm] r372727 - SimplifyCFG - silence static analyzer dyn_cast<LandingPadInst> null dereference warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 04:17:13 PDT 2019


Author: rksimon
Date: Tue Sep 24 04:17:13 2019
New Revision: 372727

URL: http://llvm.org/viewvc/llvm-project?rev=372727&view=rev
Log:
SimplifyCFG - silence static analyzer dyn_cast<LandingPadInst> null dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we should be able to use cast<LandingPadInst> directly and if not assert will fire for us.

Modified:
    llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp

Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=372727&r1=372726&r2=372727&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Tue Sep 24 04:17:13 2019
@@ -3896,7 +3896,7 @@ bool SimplifyCFGOpt::SimplifyCommonResum
 // Simplify resume that is only used by a single (non-phi) landing pad.
 bool SimplifyCFGOpt::SimplifySingleResume(ResumeInst *RI) {
   BasicBlock *BB = RI->getParent();
-  LandingPadInst *LPInst = dyn_cast<LandingPadInst>(BB->getFirstNonPHI());
+  auto *LPInst = cast<LandingPadInst>(BB->getFirstNonPHI());
   assert(RI->getValue() == LPInst &&
          "Resume must unwind the exception that caused control to here");
 




More information about the llvm-commits mailing list