[InstCombine] Don't simplify `icmp eq/ne OneUse(A ^ Cst1), Cst2` in foldICmpEquality

This special case will be handled in foldICmpXorConstant later.
See also commit e9cb50a1e351e90be1a8e4ac1a4564cfc44a984b.

GitOrigin-RevId: c4e2fcff788025415b523486efdbdac4f2b08c1e
diff --git a/lib/Transforms/InstCombine/InstCombineCompares.cpp b/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 768dc95..9f034ab 100644
--- a/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5450,16 +5450,8 @@
   Constant *Cst;
   if (match(&I, m_c_ICmp(PredUnused,
                          m_OneUse(m_Xor(m_Value(A), m_ImmConstant(Cst))),
-                         m_Value(B)))) {
-    // Special case:
-    // icmp eq/ne OneUse(A ^ Cst1), Cst2 --> icmp eq/ne A, Cst1 ^ Cst2
-    // We handle this to avoid infinite loops.
-    if (match(B, m_ImmConstant())) {
-      if (Value *V = simplifyXorInst(B, Cst, SQ.getWithInstruction(&I)))
-        return new ICmpInst(Pred, A, V);
-    } else
-      return new ICmpInst(Pred, Builder.CreateXor(A, B), Cst);
-  }
+                         m_CombineAnd(m_Value(B), m_Unless(m_ImmConstant())))))
+    return new ICmpInst(Pred, Builder.CreateXor(A, B), Cst);
 
   return nullptr;
 }
diff --git a/test/Transforms/InstCombine/icmp-equality-xor.ll b/test/Transforms/InstCombine/icmp-equality-xor.ll
index f9ba74b..f5d5ef3 100644
--- a/test/Transforms/InstCombine/icmp-equality-xor.ll
+++ b/test/Transforms/InstCombine/icmp-equality-xor.ll
@@ -136,7 +136,8 @@
 define <2 x i1> @foo3(<2 x i8> %x) {
 ; CHECK-LABEL: @foo3(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <2 x i8> [[X:%.*]], <i8 -9, i8 -80>
+; CHECK-NEXT:    [[XOR:%.*]] = xor <2 x i8> [[X:%.*]], <i8 -2, i8 -1>
+; CHECK-NEXT:    [[CMP:%.*]] = icmp ne <2 x i8> [[XOR]], <i8 9, i8 79>
 ; CHECK-NEXT:    ret <2 x i1> [[CMP]]
 ;
 entry: