On Thu, May 15, 2025 at 8:22 PM Andrew Pinski <quic_apin...@quicinc.com> wrote:
>
> 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.

OK.

> gcc/ChangeLog:
>
>         * tree-ssa-forwprop.cc (forward_propagate_into_comparison): Dump
>         when there is a change to the statement happened.
>
> Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>
> ---
>  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 3187314390f..9986799da3b 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));
> --
> 2.43.0
>

Reply via email to