summaryrefslogtreecommitdiff
path: root/gcc/tree-ssanames.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-11 16:50:32 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-11 16:50:32 +0000
commit49290934bff05cf0dff6c6268e56b944d8b6578d (patch)
treeb4875a136a081b16613b2c91b41d60c5a6882b7c /gcc/tree-ssanames.c
parent9398d12b1ec956d2bc15d2e49d9e4c997fc974d1 (diff)
downloadgcc-49290934bff05cf0dff6c6268e56b944d8b6578d.tar.gz
PR tree-optimization/1046
* tree-tailcall.c (suitable_for_tail_call_opt_p): Use TREE_ADDRESSABLE when alias info is not ready. (pass_tail_recursion): Do not require aliasing. * tree-ssa-copyrename.c (pass_rename_ssa_cop): Likewise. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Likewise. * tree-ssa-copy.c (pass_copy_prop): Likewise. * tree-ssa-forwprop.c (pass_forwprop): Likewise. * tree-ssa-dce.c (pass_dce, pass_dce_loop, pass_cd_dce): Likewise. * passes.c (init_optimization_passes): Execute rename_ssa_copies, ccp, forwprop, copy_prop, merge_phi, copy_prop, dce and tail recursion before inlining. * tree-ssa-operands.c (add_virtual_operand, get_indirect_ref_operand): When aliasing is not build, mark statement as volatile. * gcc.dg/tree-ssa/tailrecursion-4.c: Update dump file. * gcc.dg/tree-ssa/tailrecursion-1.c: Update dump file. * gcc.dg/tree-ssa/tailrecursion-2.c: Update dump file. * gcc.dg/tree-ssa/tailrecursion-3.c: Update dump file. * gcc.dg/tree-ssa/pr21658.c: Likewise. * gcc.dg/tree-ssa/pr15349.c: Likewise. * gcc.dg/tree-ssa/pr25501.c: Likewise. * gcc.dg/tree-ssa/vrp11.c: Make more complex so it still test transformation in question. * gcc.dg/tree-ssa/vrp05.c: Likewise. * gcc.dg/tree-ssa/pr20701.c: Likewise. * gcc.dg/always_inline3.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120681 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssanames.c')
-rw-r--r--gcc/tree-ssanames.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 5404edded82..9cbe3523f23 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -26,6 +26,7 @@ Boston, MA 02110-1301, USA. */
#include "varray.h"
#include "ggc.h"
#include "tree-flow.h"
+#include "tree-pass.h"
/* Rewriting a function into SSA form can create a huge number of SSA_NAMEs,
many of which may be thrown away shortly after their creation if jumps
@@ -304,3 +305,48 @@ replace_ssa_name_symbol (tree ssa_name, tree sym)
SSA_NAME_VAR (ssa_name) = sym;
TREE_TYPE (ssa_name) = TREE_TYPE (sym);
}
+
+/* Return SSA names that are unused to GGC memory. This is used to keep
+ footprint of compiler during interprocedural optimization.
+ As a side effect the SSA_NAME_VERSION number reuse is reduced
+ so this function should not be used too often. */
+static unsigned int
+release_dead_ssa_names (void)
+{
+ tree t, next;
+ int n = 0;
+ referenced_var_iterator rvi;
+
+ /* Current defs point to various dead SSA names that in turn points to dead
+ statements so bunch of dead memory is holded from releasing. */
+ FOR_EACH_REFERENCED_VAR (t, rvi)
+ set_current_def (t, NULL);
+ /* Now release the freelist. */
+ for (t = FREE_SSANAMES (cfun); t; t = next)
+ {
+ next = TREE_CHAIN (t);
+ ggc_free (t);
+ n++;
+ }
+ FREE_SSANAMES (cfun) = NULL;
+ if (dump_file)
+ fprintf (dump_file, "Released %i names, %.2f%%\n", n, n * 100.0 / num_ssa_names);
+ return 0;
+}
+
+struct tree_opt_pass pass_release_ssa_names =
+{
+ "release_ssa", /* name */
+ NULL, /* gate */
+ release_dead_ssa_names, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ 0 /* letter */
+};