[PATCH] Add SCEV cprop dump
Marek Polacek
polacek@redhat.com
Wed May 15 12:07:00 GMT 2013
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 <polacek@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))
+ {
+ 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");
+ }
+ }
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))
+ {
+ 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))
+ {
+ print_gimple_stmt (dump_file, ass, 0, 0);
+ fprintf (dump_file, ") \n");
+ }
}
}
return 0;
Marek
More information about the Gcc-patches
mailing list