aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-08-21 11:48:42 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-08-21 11:48:42 +0000
commitb6db991c9585c615212f7019484e6d288883ade0 (patch)
tree1a86ea46dfeb996cb6319c790537e709944defa5 /gcc/tree-ssa-dom.c
parent825c743c8705689b8c9541da47e201fd02f66cf6 (diff)
downloadgcc-b6db991c9585c615212f7019484e6d288883ade0.zip
gcc-b6db991c9585c615212f7019484e6d288883ade0.tar.gz
gcc-b6db991c9585c615212f7019484e6d288883ade0.tar.bz2
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
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index d3795be..4a89df2 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -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
-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)
free (element->expr.ops.call.args);
-
- if (element->expr.kind == EXPR_PHI)
+ else if (element->expr.kind == EXPR_PHI)
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);
}
@@ -1203,7 +1208,7 @@ record_cond (cond_equivalence *p)
VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element);
}
else
- free (element);
+ free_expr_hash_elt (element);
}
/* Build a cond_equivalence record indicating that the comparison
@@ -2404,9 +2409,11 @@ lookup_avail_expr (gimple stmt, bool insert)
slot = htab_find_slot_with_hash (avail_exprs, &element, element.hash,
(insert ? INSERT : NO_INSERT));
if (slot == NULL)
- return NULL_TREE;
-
- if (*slot == NULL)
+ {
+ free_expr_hash_elt_contents (&element);
+ return NULL_TREE;
+ }
+ else if (*slot == NULL)
{
struct expr_hash_elt *element2 = XNEW (struct expr_hash_elt);
*element2 = element;
@@ -2422,6 +2429,8 @@ lookup_avail_expr (gimple stmt, bool insert)
VEC_safe_push (expr_hash_elt_t, heap, avail_exprs_stack, element2);
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
definition of another variable. */