[llvm] 91cc33f - [TargetLowering] hasAndNotCompare should be checking for X, not Y (#146935)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 6 22:54:32 PDT 2025
Author: AZero13
Date: 2025-07-07T14:54:29+09:00
New Revision: 91cc33f3219c4b3e219430340f6b2820f0a419f3
URL: https://github.com/llvm/llvm-project/commit/91cc33f3219c4b3e219430340f6b2820f0a419f3
DIFF: https://github.com/llvm/llvm-project/commit/91cc33f3219c4b3e219430340f6b2820f0a419f3.diff
LOG: [TargetLowering] hasAndNotCompare should be checking for X, not Y (#146935)
Y is the one being bitwise-not, so it should not be passed, as the other
one should be passed instead.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
Removed:
################################################################################
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