[llvm] [SelectionDAG] Make `(a & x) | (~a & y) -> (a & (x ^ y)) ^ y` available for all targets (PR #137641)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 06:13:52 PDT 2025


================
@@ -8286,6 +8334,10 @@ SDValue DAGCombiner::visitOR(SDNode *N) {
     if (SDValue R = foldLogicTreeOfShifts(N, N0, N1, DAG))
       return R;
 
+  if (!TLI.hasAndNot(SDValue(N, 0)) && VT.isScalarInteger() && VT != MVT::i1)
----------------
arsenm wrote:

Check the simpler conditions first. could sink the hasAndNot after the pattern checks inside foldMaskedMerge

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


More information about the llvm-commits mailing list