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

commit r16-699-gead0a713aa6c7657b18c684aefb8fb97bd3fe017
Author: Andrew Pinski <quic_apin...@quicinc.com>
Date:   Wed May 14 20:41:22 2025 -0700

    Forwprop: add a debug dump after propagate into comparison does something
    
    I noticed that fowprop does not dump when forward_propagate_into_comparison
    did a change to the assign statement.
    I am actually using it to help guide changing/improving/add match patterns
    instead of depending on doing a tree "combiner" here.
    
    Bootstrapped and tested on x86_64-linux-gnu.
    
    gcc/ChangeLog:
    
            * tree-ssa-forwprop.cc (forward_propagate_into_comparison): Dump
            when replacing statement.
    
    Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>

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

diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index 0f52e8fe6efc..4c048a9a2986 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -523,6 +523,14 @@ forward_propagate_into_comparison (gimple_stmt_iterator 
*gsi)
                                             type, rhs1, rhs2);
   if (tmp && useless_type_conversion_p (type, TREE_TYPE (tmp)))
     {
+      if (dump_file)
+       {
+         fprintf (dump_file, "  Replaced '");
+         print_gimple_expr (dump_file, stmt, 0);
+         fprintf (dump_file, "' with '");
+         print_generic_expr (dump_file, tmp);
+         fprintf (dump_file, "'\n");
+       }
       gimple_assign_set_rhs_from_tree (gsi, tmp);
       fold_stmt (gsi);
       update_stmt (gsi_stmt (*gsi));

Reply via email to