LowerExpectIntrinsic handlePhiDef - silence static analyzer dyn_cast<PHINode> null...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 2 Oct 2019 16:03:45 +0000 (16:03 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 2 Oct 2019 16:03:45 +0000 (16:03 +0000)
The static analyzer is warning about a potential null dereference, but we should be able to use cast<PHINode> directly and if not assert will fire for us.

llvm-svn: 373481

llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp

index cdb1d79..d85f20b 100644 (file)
@@ -161,7 +161,7 @@ static void handlePhiDef(CallInst *Expect) {
     return Result;
   };
 
-  auto *PhiDef = dyn_cast<PHINode>(V);
+  auto *PhiDef = cast<PHINode>(V);
 
   // Get the first dominating conditional branch of the operand
   // i's incoming block.