[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
Wed Jun 11 09:46:01 PDT 2025
================
@@ -11609,6 +11617,25 @@ 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) {
+ unsigned Opc = N->getOpcode();
+ SDValue X, Y, Z;
+ if (sd_match(N, m_BitwiseLogic(m_Value(X),
+ m_Add(m_AllOf(m_Value(Y), m_Not(m_Value(Y))),
----------------
simonzgx wrote:
I'm not entirely sure... but if we just simply replace `m_Not(m_Value(Y))` with `m_Not(m_Deferred(Y))` here, wouldn't the pattern `m_AllOf(m_Value(Y), m_Not(m_Deferred(Y)))` always evaluate to false?
https://github.com/llvm/llvm-project/pull/141476
More information about the llvm-commits
mailing list