[llvm] [DAGCombiner] Add generic DAG combine for ISD::PARTIAL_REDUCE_MLA (PR #127083)

James Chesterman via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 07:19:40 PST 2025


================
@@ -12497,6 +12501,50 @@ SDValue DAGCombiner::visitMHISTOGRAM(SDNode *N) {
   return SDValue();
 }
 
+SDValue DAGCombiner::visitPARTIAL_REDUCE_MLA(SDNode *N) {
+  // Makes PARTIAL_REDUCE_MLA(Acc, MUL(EXT(MulOpLHS), EXT(MulOpRHS)), Splat(1))
+  // into PARTIAL_REDUCE_MLA(Acc, MulOpLHS, MulOpRHS)
----------------
JamesChesterman wrote:

Done.
Added a condition that checks whether the type combination for the Partial Reduction operation is Legal or Custom. The DAG combines will only be done if this is true.
This is to prevent the DAG combines from happening just for the resulting DAG to be expanded, as this leads to worse code gen. 
For now, the combines will not be performed This is because setting the partial reduction action to Legal / Custom for certain types will make instruction selection happen, which is not implemented yet, so an error occurs.

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


More information about the llvm-commits mailing list