https://gcc.gnu.org/g:a4a4cf89f90bb1f618e97ae7deb59542a7421107

commit r16-977-ga4a4cf89f90bb1f618e97ae7deb59542a7421107
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Mon May 26 14:40:12 2025 -0700

    forwprop: Add stats for memcpy->memset
    
    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_apin...@quicinc.com>

Diff:
---
 gcc/tree-ssa-forwprop.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index e457a69ed489..81ea7d4195e9 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -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))

Reply via email to