Skip to content

Commit 91cc33f

Browse files
authored
[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.
1 parent 1b13682 commit 91cc33f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4247,7 +4247,7 @@ SDValue TargetLowering::foldSetCCWithOr(EVT VT, SDValue N0, SDValue N1,
42474247
// (X | Y) == Y
42484248
// (X | Y) != Y
42494249
SDValue X;
4250-
if (sd_match(N0, m_Or(m_Value(X), m_Specific(N1))) && hasAndNotCompare(N1)) {
4250+
if (sd_match(N0, m_Or(m_Value(X), m_Specific(N1))) && hasAndNotCompare(X)) {
42514251
// If the target supports an 'and-not' or 'and-complement' logic operation,
42524252
// try to use that to make a comparison operation more efficient.
42534253

0 commit comments

Comments
 (0)