[llvm] [DAGCombine]Fold (fadd A, Splat(fneg(B))) -> (fsub A, Splat(B)) (PR #173967)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 7 04:13:40 PST 2026


================
@@ -17965,6 +17965,17 @@ SDValue DAGCombiner::visitFADD(SDNode *N) {
             N0, DAG, LegalOperations, ForCodeSize))
       return DAG.getNode(ISD::FSUB, DL, VT, N1, NegN0);
 
+  // fold (fadd A, Splat(fneg(B))) -> (fsub A, Splat(B))
----------------
RKSimon wrote:

add a TODO to move ISD::SPLAT_VECTOR handling inside getCheaperNegatedExpression

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


More information about the llvm-commits mailing list