[llvm] c1f3bab - MainSwitch::isValidSelectInst - don't dereference dyn_cast<> results.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 20 06:31:28 PDT 2021


Author: Simon Pilgrim
Date: 2021-08-20T14:31:11+01:00
New Revision: c1f3bab23b57e0d59951f7d8b5d0a0da463d94e7

URL: https://github.com/llvm/llvm-project/commit/c1f3bab23b57e0d59951f7d8b5d0a0da463d94e7
DIFF: https://github.com/llvm/llvm-project/commit/c1f3bab23b57e0d59951f7d8b5d0a0da463d94e7.diff

LOG: MainSwitch::isValidSelectInst - don't dereference dyn_cast<> results.

We've already checked that the pointer isa<PHINode>, so we can use cast<Instruction> safely.

Fixes static analyser warning.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index 212c3899a496..111206b14641 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -531,7 +531,7 @@ struct MainSwitch {
       return false;
 
     if (isa<PHINode>(SIUse) &&
-        SIBB->getSingleSuccessor() != dyn_cast<Instruction>(SIUse)->getParent())
+        SIBB->getSingleSuccessor() != cast<Instruction>(SIUse)->getParent())
       return false;
 
     // If select will not be sunk during unfolding, and it is in the same basic


        


More information about the llvm-commits mailing list