+2009-06-18 Martin Jambor <mjambor@suse.cz>
+
+ * tree-sra.c: Include statistics.h
+ (sra_stats): New variable.
+ (sra_initialize): Clear sra_stats.
+ (create_access_replacement): Increment sra_stats.replacements.
+ (get_access_replacement): Do not return twice.
+ (analyze_all_variable_accesses): Increment statistics counter by the
+ number of scalarized aggregates.
+ (generate_subtree_copies): Increment sra_stats.subtree_copies.
+ (sra_modify_expr): Increment sra_stats.exprs.
+ (load_assign_lhs_subreplacements): Increment sra_stats.subreplacements.
+ (sra_modify_assign): Increment sra_stats.exprs,
+ sra_stats.separate_lhs_rhs_handling and sra_stats.deleted.
+ (perform_intra_sra): Update statistics counters.
+ * Makefile.in (tree-sra.o): Add statistics.h to dependencies.
+
2009-06-18 Sandra Loosemore <sandra@codesourcery.com>
* config/arm/arm.c (TARGET_SCALAR_MODE_SUPPORTED_P): Redefine.
#include "gimple.h"
#include "tree-flow.h"
#include "diagnostic.h"
+#include "statistics.h"
#include "tree-dump.h"
#include "timevar.h"
#include "params.h"
representative fields are dumped, otherwise those which only describe the
individual access are. */
+static struct
+{
+ /* Number of created scalar replacements. */
+ int replacements;
+
+ /* Number of times sra_modify_expr or sra_modify_assign themselves changed an
+ expression. */
+ int exprs;
+
+ /* Number of statements created by generate_subtree_copies. */
+ int subtree_copies;
+
+ /* Number of statements created by load_assign_lhs_subreplacements. */
+ int subreplacements;
+
+ /* Number of times sra_modify_assign has deleted a statement. */
+ int deleted;
+
+ /* Number of times sra_modify_assign has to deal with subaccesses of LHS and
+ RHS reparately due to type conversions or nonexistent matching
+ references. */
+ int separate_lhs_rhs_handling;
+
+ /* Number of processed aggregates is readily available in
+ analyze_all_variable_accesses and so is not stored here. */
+} sra_stats;
+
static void
dump_access (FILE *f, struct access *access, bool grp)
{
access_pool = create_alloc_pool ("SRA accesses", sizeof (struct access), 16);
link_pool = create_alloc_pool ("SRA links", sizeof (struct assign_link), 16);
base_access_vec = pointer_map_create ();
+ memset (&sra_stats, 0, sizeof (sra_stats));
}
/* Hook fed to pointer_map_traverse, deallocate stored vectors. */
print_generic_expr (dump_file, repl, 0);
fprintf (dump_file, "\n");
}
+ sra_stats.replacements++;
return repl;
}
{
gcc_assert (access->grp_to_be_replaced);
- if (access->replacement_decl)
- return access->replacement_decl;
-
- access->replacement_decl = create_access_replacement (access);
+ if (!access->replacement_decl)
+ access->replacement_decl = create_access_replacement (access);
return access->replacement_decl;
}
{
tree var;
referenced_var_iterator rvi;
- bool res = false;
+ int res = 0;
FOR_EACH_REFERENCED_VAR (var, rvi)
if (bitmap_bit_p (candidate_bitmap, DECL_UID (var)))
if (analyze_access_trees (access))
{
- res = true;
+ res++;
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "\nAccess trees for ");
disqualify_candidate (var, "No scalar replacements to be created.");
}
- return res;
+ if (res)
+ {
+ statistics_counter_event (cfun, "Scalarized aggregates", res);
+ return true;
+ }
+ else
+ return false;
}
/* Return true iff a reference statement into aggregate AGG can be built for
insert_after ? GSI_NEW_STMT
: GSI_SAME_STMT);
stmt = gimple_build_assign (expr, repl);
+ sra_stats.subtree_copies++;
}
if (insert_after)
gcc_assert (useless_type_conversion_p (type, access->type));
*expr = repl;
}
+ sra_stats.exprs++;
}
if (access->first_child)
stmt = gimple_build_assign (get_access_replacement (lacc), rhs);
gsi_insert_after (new_gsi, stmt, GSI_NEW_STMT);
update_stmt (stmt);
+ sra_stats.subreplacements++;
}
else if (lacc->grp_read && !lacc->grp_covered && !*refreshed)
{
modify_this_stmt = true;
if (lacc->grp_partial_lhs)
force_gimple_rhs = true;
+ sra_stats.exprs++;
}
if (racc && racc->grp_to_be_replaced)
modify_this_stmt = true;
if (racc->grp_partial_lhs)
force_gimple_rhs = true;
+ sra_stats.exprs++;
}
if (modify_this_stmt)
if (access_has_children_p (lacc))
generate_subtree_copies (lacc->first_child, lacc->base, 0, 0, 0,
gsi, true, true);
+ sra_stats.separate_lhs_rhs_handling++;
}
else
{
unlink_stmt_vdef (*stmt);
gsi_remove (&orig_gsi, true);
+ sra_stats.deleted++;
return SRA_SA_REMOVED;
}
}
gcc_assert (*stmt == gsi_stmt (*gsi));
unlink_stmt_vdef (*stmt);
gsi_remove (gsi, true);
+ sra_stats.deleted++;
return SRA_SA_REMOVED;
}
else
scan_function (sra_modify_expr, sra_modify_assign, NULL,
false, NULL);
initialize_parameter_reductions ();
+
+ statistics_counter_event (cfun, "Scalar replacements created",
+ sra_stats.replacements);
+ statistics_counter_event (cfun, "Modified expressions", sra_stats.exprs);
+ statistics_counter_event (cfun, "Subtree copy stmts",
+ sra_stats.subtree_copies);
+ statistics_counter_event (cfun, "Subreplacement stmts",
+ sra_stats.subreplacements);
+ statistics_counter_event (cfun, "Deleted stmts", sra_stats.deleted);
+ statistics_counter_event (cfun, "Separate LHS and RHS handling",
+ sra_stats.separate_lhs_rhs_handling);
+
ret = TODO_update_ssa;
out: