[llvm] [DAG] Fold (bitwiseop X, (add (not Y), Z)) -> (bitwiseop X, (not (sub Y, Z))). (PR #141476)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 1 10:32:06 PDT 2025


================
@@ -11609,6 +11625,28 @@ SDValue DAGCombiner::foldShiftToAvg(SDNode *N) {
   return DAG.getNode(FloorISD, SDLoc(N), N->getValueType(0), {A, B});
 }
 
+SDValue DAGCombiner::foldBitwiseOpWithNeg(SDNode *N, const SDLoc &DL, EVT VT) {
+  if (!TLI.hasAndNot(SDValue(N, 0)))
----------------
RKSimon wrote:

We're checking for ANDNOT instructions but we're also folding to ORNOT and XORNOT patterns?

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


More information about the llvm-commits mailing list