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

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


================
@@ -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)))
----------------
nikic wrote:

I'm pretty sure this was supposed to be:
```suggestion
    if (!SIUse || !(isa<PHINode>(SIUse) || isa<SelectInst>(SIUse)))
```

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


More information about the llvm-commits mailing list