From 3f873d194c7bd0bfb09c8c3024b2e0d2e843a64e Mon Sep 17 00:00:00 2001 From: Daniil Kutz Date: Mon, 8 Sep 2025 16:13:34 +0300 Subject: [PATCH 1/2] [llvm] Fix possible null dereference in Transforms/Scalar --- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(SI->user_back()); // The use of the select inst should be either a phi or another select. - if (!SIUse && !(isa(SIUse) || isa(SIUse))) + if (SIUse && !(isa(SIUse) || isa(SIUse))) return false; BasicBlock *SIBB = SI->getParent(); From 59eae88284c2ef925038e60ceade38f1017e4784 Mon Sep 17 00:00:00 2001 From: Daniel Kuts Date: Mon, 8 Sep 2025 16:34:45 +0300 Subject: [PATCH 2/2] Update llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp Co-authored-by: Nikita Popov --- llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp index 33f06e2abe801..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(SI->user_back()); // The use of the select inst should be either a phi or another select. - if (SIUse && !(isa(SIUse) || isa(SIUse))) + if (!SIUse || !(isa(SIUse) || isa(SIUse))) return false; BasicBlock *SIBB = SI->getParent();