SimplifyCFG - silence static analyzer dyn_cast<LandingPadInst> null dereference warni...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 24 Sep 2019 11:17:13 +0000 (11:17 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Tue, 24 Sep 2019 11:17:13 +0000 (11:17 +0000)
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.

llvm-svn: 372727

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

index 9b14aa843d69dbb6cd63ddc6ba12cb0fb2bce7da..839cb9b5c2a66d5da926da9fb05f3f4b4d940540 100644 (file)
@@ -3896,7 +3896,7 @@ bool SimplifyCFGOpt::SimplifyCommonResume(ResumeInst *RI) {
 // 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");