aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorAndreas Jonson <andjo403@hotmail.com>2025-09-08 19:16:41 +0200
committerGitHub <noreply@github.com>2025-09-08 19:16:41 +0200
commite11f93e9fdacae6e7003b6d34b32007fd3fc081c (patch)
treea32721f98c8b17ed9e58688b6abd1b7bf4f34e06 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent879f40ab041b31fa73b9b25e4ec9e06e810bc767 (diff)
downloadllvm-e11f93e9fdacae6e7003b6d34b32007fd3fc081c.zip
llvm-e11f93e9fdacae6e7003b6d34b32007fd3fc081c.tar.gz
llvm-e11f93e9fdacae6e7003b6d34b32007fd3fc081c.tar.bz2
[SimplifyCFG] Support not in chain of comparisons. (#156497)
Proof: https://alive2.llvm.org/ce/z/cpXuCb
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 86d4750..39edc4d 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -612,6 +612,9 @@ private:
/// If CompValue is already set, the function is expected to fail if a match
/// is found but the value compared to is different.
bool matchInstruction(Instruction *I, bool isEQ) {
+ if (match(I, m_Not(m_Instruction(I))))
+ isEQ = !isEQ;
+
Value *Val;
if (match(I, m_NUWTrunc(m_Value(Val)))) {
// If we already have a value for the switch, it has to match!