On Wed, May 15, 2013 at 2:07 PM, Marek Polacek <pola...@redhat.com> wrote:
> This is an attempt to add more dumping to scev_cprop.  I don't know what 
> exactly
> would you want to see in there, so now it prints e.g.:
>
> (replace_stmt
>   (virtual_p_1 with 0)
> )
>
> and
>
> (final_value_replacement
>   o__lsm.3_2 = PHI <_6(4)>
>   with
>   o__lsm.3_2 = pretmp_10 + 20;
> )
>
> Comments?  Maybe that first hunk isn't really neccessary.
>
> 2013-05-15  Marek Polacek  <pola...@redhat.com>
>
>         * tree-scalar-evolution.c (scev_const_prop): Add more dumps.
>
> --- gcc/tree-scalar-evolution.c.mp      2013-05-15 13:43:31.020698846 +0200
> +++ gcc/tree-scalar-evolution.c 2013-05-15 13:43:58.080788354 +0200
> @@ -3295,7 +3295,17 @@ scev_const_prop (void)
>
>           /* Replace the uses of the name.  */
>           if (name != ev)
> -           replace_uses_by (name, ev);
> +           {
> +             replace_uses_by (name, ev);
> +             if (dump_file && (dump_flags & TDF_SCEV))

should be without dump_flags checking

> +               {
> +                 fprintf (dump_file, "(replace_stmt \n  (");
> +                 print_generic_expr (dump_file, name, 0);
> +                 fprintf (dump_file, " with ");
> +                 print_generic_expr (dump_file, ev, 0);
> +                 fprintf (dump_file, ")\n) \n");

and no need to do it the LISP-y way ;)

> +               }
> +            }
>
>           if (!ssa_names_to_remove)
>             ssa_names_to_remove = BITMAP_ALLOC (NULL);
> @@ -3391,6 +3401,12 @@ scev_const_prop (void)
>
>           /* Eliminate the PHI node and replace it by a computation outside
>              the loop.  */
> +         if (dump_file && (dump_flags & TDF_SCEV))
> +           {

Likewise.

> +             fprintf (dump_file, "(final_value_replacement \n  ");
> +             print_gimple_stmt (dump_file, phi, 0, 0);
> +             fprintf (dump_file, "  with \n  ");
> +           }
>           def = unshare_expr (def);
>           remove_phi_node (&psi, false);
>
> @@ -3398,6 +3414,11 @@ scev_const_prop (void)
>                                           true, GSI_SAME_STMT);
>           ass = gimple_build_assign (rslt, def);
>           gsi_insert_before (&bsi, ass, GSI_SAME_STMT);
> +         if (dump_file && (dump_flags & TDF_SCEV))

Likewise.

> +           {
> +             print_gimple_stmt (dump_file, ass, 0, 0);
> +             fprintf (dump_file, ") \n");
> +           }
>         }
>      }
>    return 0;

I would have liked to see failed attempts as well, then with TDF_DETAILS.
Failed attempts for the "real" final value replacement stuff (I'm not sure
the constant propagation part is worth keeping ... how often does it trigger?)

Thanks,
Richard.

>         Marek

Reply via email to