[llvm-branch-commits] [llvm] [X86] Restore CCMP and SSE select codegen after demanded-bits folding (PR #230770)

Simon Pilgrim via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Oct 12 03:45:52 PDT 2026


================
@@ -53422,6 +53422,19 @@ static SDValue combineAnd(SDNode *N, SelectionDAG &DAG,
     }
   }
 
+  // SETCC only produces 0 or 1, so AND only observes the low bit of the NOT.
+  // Fold the inversion even if demanded bits changed XOR with 1 into NOT.
+  // Require one use of the NOT to avoid duplicating the inverted condition.
+  SDValue SetCC, OtherSetCC;
+  if (sd_match(N, m_And(m_OneUse(m_Not(
+                            m_Value(SetCC, m_SpecificOpc<X86ISD::SETCC>()))),
+                        m_Value(OtherSetCC, m_SpecificOpc<X86ISD::SETCC>())))) {
----------------
RKSimon wrote:

Why do you need OtherSetCC as well? Can't it be any node?

https://github.com/llvm/llvm-project/pull/230770


More information about the llvm-branch-commits mailing list