]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
forwprop: Add stats for memcpy->memset
authorAndrew Pinski <quic_apinski@quicinc.com>
Mon, 26 May 2025 21:40:12 +0000 (14:40 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Thu, 29 May 2025 21:11:54 +0000 (14:11 -0700)
As part of the review of copy prop for aggregates, it was
mentioned there should be some statistics added, and I noticed
the memcpy->memset was missing the statistics too. So this adds
that.

gcc/ChangeLog:

* tree-ssa-forwprop.cc (optimize_memcpy_to_memset): Adds
statistics when the statement changed.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/tree-ssa-forwprop.cc

index e457a69ed489ae5334d2b611b8683d7b60ccb98b..81ea7d4195e92367292bfffdc256fc360f284f7e 100644 (file)
@@ -1324,6 +1324,7 @@ optimize_memcpy_to_memset (gimple_stmt_iterator *gsip, tree dest, tree src, tree
       tree ctor = build_constructor (TREE_TYPE (dest), NULL);
       gimple_assign_set_rhs_from_tree (gsip, ctor);
       update_stmt (stmt);
+      statistics_counter_event (cfun, "copy zeroing propagation of aggregate", 1);
     }
   else /* If stmt is memcpy, transform it into memset.  */
     {
@@ -1333,6 +1334,7 @@ optimize_memcpy_to_memset (gimple_stmt_iterator *gsip, tree dest, tree src, tree
       gimple_call_set_fntype (call, TREE_TYPE (fndecl));
       gimple_call_set_arg (call, 1, val);
       update_stmt (stmt);
+      statistics_counter_event (cfun, "memcpy to memset changed", 1);
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS))