Commit 14f60a5a by Richard Guenther Committed by Richard Biener

tree-ssanames.c (release_dead_ssa_names): Compact the SSA version namespace as…

tree-ssanames.c (release_dead_ssa_names): Compact the SSA version namespace as we release the freelist.

2012-04-05  Richard Guenther  <rguenther@suse.de>

	* tree-ssanames.c (release_dead_ssa_names): Compact the SSA
	version namespace as we release the freelist.

From-SVN: r186162
parent 0e74b5a2
2012-04-05 Richard Guenther <rguenther@suse.de> 2012-04-05 Richard Guenther <rguenther@suse.de>
* tree-ssanames.c (release_dead_ssa_names): Compact the SSA
version namespace as we release the freelist.
2012-04-05 Richard Guenther <rguenther@suse.de>
* tree-nrv.c (tree_nrv): Release VDEFs. * tree-nrv.c (tree_nrv): Release VDEFs.
* tree-sra.c (sra_modify_constructor_assign): Likewise. * tree-sra.c (sra_modify_constructor_assign): Likewise.
(sra_modify_assign): Likewise. (sra_modify_assign): Likewise.
......
...@@ -325,14 +325,14 @@ replace_ssa_name_symbol (tree ssa_name, tree sym) ...@@ -325,14 +325,14 @@ replace_ssa_name_symbol (tree ssa_name, tree sym)
TREE_TYPE (ssa_name) = TREE_TYPE (sym); TREE_TYPE (ssa_name) = TREE_TYPE (sym);
} }
/* Return SSA names that are unused to GGC memory. This is used to keep /* Return SSA names that are unused to GGC memory and compact the SSA
footprint of compiler during interprocedural optimization. version namespace. This is used to keep footprint of compiler during
As a side effect the SSA_NAME_VERSION number reuse is reduced interprocedural optimization. */
so this function should not be used too often. */
static unsigned int static unsigned int
release_dead_ssa_names (void) release_dead_ssa_names (void)
{ {
tree t; tree t;
unsigned i, j;
int n = VEC_length (tree, FREE_SSANAMES (cfun)); int n = VEC_length (tree, FREE_SSANAMES (cfun));
referenced_var_iterator rvi; referenced_var_iterator rvi;
...@@ -340,14 +340,33 @@ release_dead_ssa_names (void) ...@@ -340,14 +340,33 @@ release_dead_ssa_names (void)
eventually dead variables so a bunch of memory is held live. */ eventually dead variables so a bunch of memory is held live. */
FOR_EACH_REFERENCED_VAR (cfun, t, rvi) FOR_EACH_REFERENCED_VAR (cfun, t, rvi)
set_current_def (t, NULL); set_current_def (t, NULL);
/* Now release the freelist. */ /* Now release the freelist. */
VEC_free (tree, gc, FREE_SSANAMES (cfun)); VEC_free (tree, gc, FREE_SSANAMES (cfun));
FREE_SSANAMES (cfun) = NULL; FREE_SSANAMES (cfun) = NULL;
/* And compact the SSA number space. We make sure to not change the
relative order of SSA versions. */
for (i = 1, j = 1; i < VEC_length (tree, cfun->gimple_df->ssa_names); ++i)
{
tree name = ssa_name (i);
if (name)
{
if (i != j)
{
SSA_NAME_VERSION (name) = j;
VEC_replace (tree, cfun->gimple_df->ssa_names, j, name);
}
j++;
}
}
VEC_truncate (tree, cfun->gimple_df->ssa_names, j);
statistics_counter_event (cfun, "SSA names released", n); statistics_counter_event (cfun, "SSA names released", n);
statistics_counter_event (cfun, "SSA name holes removed", i - j);
if (dump_file) if (dump_file)
fprintf (dump_file, "Released %i names, %.2f%%\n", fprintf (dump_file, "Released %i names, %.2f%%, removed %i holes\n",
n, n * 100.0 / num_ssa_names); n, n * 100.0 / num_ssa_names, i - j);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment