[llvm] [llvm] Fix possible null dereference in Transforms/Scalar (PR #157461)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 06:29:09 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Daniel Kuts (apach301)

<details>
<summary>Changes</summary>

Fixes #<!-- -->157450

---
Full diff: https://github.com/llvm/llvm-project/pull/157461.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index 434b55868c99d..33f06e2abe801 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();

``````````

</details>


https://github.com/llvm/llvm-project/pull/157461


More information about the llvm-commits mailing list