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

Xu Zhang via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 07:50:27 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)))
----------------
simonzgx wrote:

Are there any functions I can use to check TLI `hasOrNot` and `hasXorNot`? Or should I just remove the folding for ORNOT and XORNOT?

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


More information about the llvm-commits mailing list