[llvm] 3119945 - [DFAJumpThreading] Fix possible null dereference (#157461)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 11:15:09 PDT 2025


Author: Daniel Kuts
Date: 2025-09-09T02:15:06+08:00
New Revision: 31199459f4f3fae7df99c743807443381ea6ce2a

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

LOG: [DFAJumpThreading] Fix possible null dereference (#157461)

Fixes #157450

---------

Co-authored-by: Nikita Popov <github at npopov.com>

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 434b55868c99d..22cb385652644 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -521,7 +521,7 @@ struct MainSwitch {
 
     Instruction *SIUse = dyn_cast<Instruction>(SI->user_back());
     // The use of the select inst should be either a phi or another select.
-    if (!SIUse && !(isa<PHINode>(SIUse) || isa<SelectInst>(SIUse)))
+    if (!SIUse || !(isa<PHINode>(SIUse) || isa<SelectInst>(SIUse)))
       return false;
 
     BasicBlock *SIBB = SI->getParent();


        


More information about the llvm-commits mailing list