[llvm] [X86] Add DAG combiner for X86ISD::XOR to eliminate redundant XORs (PR #216134)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 11:47:24 PDT 2026
================
@@ -59394,6 +59394,26 @@ static SDValue combineCMP(SDNode *N, SelectionDAG &DAG,
return Op.getValue(1);
}
+/// If a matching generic opcode node exists, replace its uses with the value
+/// of the target-specific node N.
+static void matchGenericOp(unsigned Opc, SDNode *N, SDValue N0, SDValue N1,
+ SelectionDAG &DAG,
+ TargetLowering::DAGCombinerInfo &DCI,
+ bool Negate = false) {
+ SDValue Ops[] = {N0, N1};
+ SDVTList VTs = DAG.getVTList(N->getValueType(0));
+ if (SDNode *Generic = DAG.getNodeIfExists(Opc, VTs, Ops)) {
+ SDValue Op(N, 0);
+ if (Negate) {
+ // Bail if this is only used by a user of the x86 node.
+ if (Generic->hasOneUse() && Generic->user_begin()->isOnlyUserOf(N))
+ return;
+ Op = DAG.getNegative(Op, SDLoc(N), N->getSimpleValueType(0));
----------------
AZero13 wrote:
And I did.
https://github.com/llvm/llvm-project/pull/216134
More information about the llvm-commits
mailing list