[llvm] [TargetLowering] hasAndNotCompare should be checking for X, not Y (PR #146935)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 3 11:41:04 PDT 2025
https://github.com/AZero13 updated https://github.com/llvm/llvm-project/pull/146935
>From c62a05ab1e2203e6de02e0f8a931c14d16109e46 Mon Sep 17 00:00:00 2001
From: Rose <gfunni234 at gmail.com>
Date: Thu, 3 Jul 2025 13:56:28 -0400
Subject: [PATCH] [TargetLowering] hasAndNotCompare should be checking for X,
not Y
Y is the one being bitwise-not, so it should not be passed, as the other one should be passed instead.
---
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 000f8cc6786a5..49baea21aff2c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -4247,7 +4247,7 @@ SDValue TargetLowering::foldSetCCWithOr(EVT VT, SDValue N0, SDValue N1,
// (X | Y) == Y
// (X | Y) != Y
SDValue X;
- if (sd_match(N0, m_Or(m_Value(X), m_Specific(N1))) && hasAndNotCompare(N1)) {
+ if (sd_match(N0, m_Or(m_Value(X), m_Specific(N1))) && hasAndNotCompare(X)) {
// If the target supports an 'and-not' or 'and-complement' logic operation,
// try to use that to make a comparison operation more efficient.
More information about the llvm-commits
mailing list