Commit b6db991c by Richard Guenther Committed by Richard Biener

tree-ssa-loop-im.c (tree_ssa_lim_finalize): Properly free the affine expansion cache.

2012-08-21  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-loop-im.c (tree_ssa_lim_finalize): Properly free
	the affine expansion cache.
	* tree-ssa-dom.c (free_expr_hash_elt_contents): New function,
	split out from ...
	(free_expr_hash_elt): ... this one.
	(record_cond): Properly free a not needed hashtable element.
	(lookup_avail_expr): Likewise.
	* tree-into-ssa.c (init_ssa_renamer): Specify a free function
	for the var_infos hashtable.
	(update_ssa): Likewise.

From-SVN: r190560
parent 825c743c
2012-08-21 Richard Guenther <rguenther@suse.de> 2012-08-21 Richard Guenther <rguenther@suse.de>
* tree-ssa-loop-im.c (tree_ssa_lim_finalize): Properly free
the affine expansion cache.
* tree-ssa-dom.c (free_expr_hash_elt_contents): New function,
split out from ...
(free_expr_hash_elt): ... this one.
(record_cond): Properly free a not needed hashtable element.
(lookup_avail_expr): Likewise.
* tree-into-ssa.c (init_ssa_renamer): Specify a free function
for the var_infos hashtable.
(update_ssa): Likewise.
2012-08-21 Richard Guenther <rguenther@suse.de>
* alloc-pool.c (pool_alloc): Fix valgrind annotation. * alloc-pool.c (pool_alloc): Fix valgrind annotation.
* tree.h: Fix typo and complete flags documentation. * tree.h: Fix typo and complete flags documentation.
......
...@@ -2291,7 +2291,7 @@ init_ssa_renamer (void) ...@@ -2291,7 +2291,7 @@ init_ssa_renamer (void)
/* Allocate memory for the DEF_BLOCKS hash table. */ /* Allocate memory for the DEF_BLOCKS hash table. */
gcc_assert (var_infos == NULL); gcc_assert (var_infos == NULL);
var_infos = htab_create (VEC_length (tree, cfun->local_decls), var_infos = htab_create (VEC_length (tree, cfun->local_decls),
var_info_hash, var_info_eq, NULL); var_info_hash, var_info_eq, free);
bitmap_obstack_initialize (&update_ssa_obstack); bitmap_obstack_initialize (&update_ssa_obstack);
} }
...@@ -3170,7 +3170,7 @@ update_ssa (unsigned update_flags) ...@@ -3170,7 +3170,7 @@ update_ssa (unsigned update_flags)
{ {
/* If we rename bare symbols initialize the mapping to /* If we rename bare symbols initialize the mapping to
auxiliar info we need to keep track of. */ auxiliar info we need to keep track of. */
var_infos = htab_create (47, var_info_hash, var_info_eq, NULL); var_infos = htab_create (47, var_info_hash, var_info_eq, free);
/* If we have to rename some symbols from scratch, we need to /* If we have to rename some symbols from scratch, we need to
start the process at the root of the CFG. FIXME, it should start the process at the root of the CFG. FIXME, it should
......
...@@ -649,19 +649,24 @@ print_expr_hash_elt (FILE * stream, const struct expr_hash_elt *element) ...@@ -649,19 +649,24 @@ print_expr_hash_elt (FILE * stream, const struct expr_hash_elt *element)
} }
} }
/* Delete an expr_hash_elt and reclaim its storage. */ /* Delete variable sized pieces of the expr_hash_elt ELEMENT. */
static void static void
free_expr_hash_elt (void *elt) free_expr_hash_elt_contents (struct expr_hash_elt *element)
{ {
struct expr_hash_elt *element = ((struct expr_hash_elt *)elt);
if (element->expr.kind == EXPR_CALL) if (element->expr.kind == EXPR_CALL)
free (element->expr.ops.call.args); free (element->expr.ops.call.args);
else if (element->expr.kind == EXPR_PHI)
if (element->expr.kind == EXPR_PHI)
free (element->expr.ops.phi.args); free (element->expr.ops.phi.args);
}
/* Delete an expr_hash_elt and reclaim its storage. */
static void
free_expr_hash_elt (void *elt)
{
struct expr_hash_elt *element = ((struct expr_hash_elt *)elt);
free_expr_hash_elt_contents (element);
free (element); free (element);
} }
...@@ -1203,7 +1208,7 @@ record_cond (cond_equivalence *p) ...@@ -1203,7 +1208,7 @@ record_cond (cond_equivalence *p)
VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element); VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element);
} }
else else
free (element); free_expr_hash_elt (element);
} }
/* Build a cond_equivalence record indicating that the comparison /* Build a cond_equivalence record indicating that the comparison
...@@ -2404,9 +2409,11 @@ lookup_avail_expr (gimple stmt, bool insert) ...@@ -2404,9 +2409,11 @@ lookup_avail_expr (gimple stmt, bool insert)
slot = htab_find_slot_with_hash (avail_exprs, &element, element.hash, slot = htab_find_slot_with_hash (avail_exprs, &element, element.hash,
(insert ? INSERT : NO_INSERT)); (insert ? INSERT : NO_INSERT));
if (slot == NULL) if (slot == NULL)
return NULL_TREE; {
free_expr_hash_elt_contents (&element);
if (*slot == NULL) return NULL_TREE;
}
else if (*slot == NULL)
{ {
struct expr_hash_elt *element2 = XNEW (struct expr_hash_elt); struct expr_hash_elt *element2 = XNEW (struct expr_hash_elt);
*element2 = element; *element2 = element;
...@@ -2422,6 +2429,8 @@ lookup_avail_expr (gimple stmt, bool insert) ...@@ -2422,6 +2429,8 @@ lookup_avail_expr (gimple stmt, bool insert)
VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element2); VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element2);
return NULL_TREE; return NULL_TREE;
} }
else
free_expr_hash_elt_contents (&element);
/* Extract the LHS of the assignment so that it can be used as the current /* Extract the LHS of the assignment so that it can be used as the current
definition of another variable. */ definition of another variable. */
......
...@@ -2634,7 +2634,7 @@ tree_ssa_lim_finalize (void) ...@@ -2634,7 +2634,7 @@ tree_ssa_lim_finalize (void)
VEC_free (bitmap, heap, memory_accesses.all_refs_stored_in_loop); VEC_free (bitmap, heap, memory_accesses.all_refs_stored_in_loop);
if (memory_accesses.ttae_cache) if (memory_accesses.ttae_cache)
pointer_map_destroy (memory_accesses.ttae_cache); free_affine_expand_cache (&memory_accesses.ttae_cache);
} }
/* Moves invariants from loops. Only "expensive" invariants are moved out -- /* Moves invariants from loops. Only "expensive" invariants are moved out --
......
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