+/* 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;
+ int n = VEC_length (tree, FREE_SSANAMES (cfun));
+ referenced_var_iterator rvi;
+
+ /* Current defs point to various dead SSA names that in turn point to
+ eventually dead variables so a bunch of memory is held live. */
+ FOR_EACH_REFERENCED_VAR (cfun, t, rvi)
+ set_current_def (t, NULL);
+ /* Now release the freelist. */
+ VEC_free (tree, gc, FREE_SSANAMES (cfun));
+ FREE_SSANAMES (cfun) = NULL;
+
+ statistics_counter_event (cfun, "SSA names released", n);
+ if (dump_file)
+ fprintf (dump_file, "Released %i names, %.2f%%\n",
+ n, n * 100.0 / num_ssa_names);
+ return 0;
+}
+
+struct gimple_opt_pass pass_release_ssa_names =
+{
+ {
+ GIMPLE_PASS,
+ "release_ssa", /* name */
+ NULL, /* gate */
+ release_dead_ssa_names, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_TREE_SSA_OTHER, /* tv_id */
+ PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+ }
+};