aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-11-09 16:47:01 +0100
committerMartin Liska <marxin@gcc.gnu.org>2015-11-09 15:47:01 +0000
commitc34311917ff87b75ea589afff6868437fc53c001 (patch)
treeee35222d10eb23fd0c96ddb2b91ecec097a19a90 /gcc
parentaf121e828eb03233d731b25b590d1f7c5dd2693d (diff)
Fix memory leaks in IPA.
* ipa-inline-analysis.c (estimate_function_body_sizes): Call body_info release function. * ipa-prop.c (ipa_release_body_info): New function. (ipa_analyze_node): Call the function. (ipa_node_params::~ipa_node_params): Release known_csts. * ipa-prop.h (ipa_release_body_info): Declare. From-SVN: r230028
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/ipa-inline-analysis.c2
-rw-r--r--gcc/ipa-prop.c20
-rw-r--r--gcc/ipa-prop.h2
4 files changed, 26 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1d60b7084e0..bc9dbf1f440 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2015-11-09 Martin Liska <mliska@suse.cz>
+ * ipa-inline-analysis.c (estimate_function_body_sizes): Call
+ body_info release function.
+ * ipa-prop.c (ipa_release_body_info): New function.
+ (ipa_analyze_node): Call the function.
+ (ipa_node_params::~ipa_node_params): Release known_csts.
+ * ipa-prop.h (ipa_release_body_info): Declare.
+
+2015-11-09 Martin Liska <mliska@suse.cz>
+
* gcc.c (record_temp_file): Release name string.
* ifcvt.c (noce_convert_multiple_sets): Use auto_vec instead
of vec.
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index c07b0da9007..8c8b8e3af84 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2853,7 +2853,7 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
inline_summaries->get (node)->self_time = time;
inline_summaries->get (node)->self_size = size;
nonconstant_names.release ();
- fbi.bb_infos.release ();
+ ipa_release_body_info (&fbi);
if (opt_for_fn (node->decl, optimize))
{
if (!early)
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index d15f0ebed56..f379ea73909 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -2258,6 +2258,19 @@ analysis_dom_walker::before_dom_children (basic_block bb)
ipa_compute_jump_functions_for_bb (m_fbi, bb);
}
+/* Release body info FBI. */
+
+void
+ipa_release_body_info (struct ipa_func_body_info *fbi)
+{
+ int i;
+ struct ipa_bb_info *bi;
+
+ FOR_EACH_VEC_ELT (fbi->bb_infos, i, bi)
+ free_ipa_bb_info (bi);
+ fbi->bb_infos.release ();
+}
+
/* Initialize the array describing properties of formal parameters
of NODE, analyze their uses and compute jump functions associated
with actual arguments of calls from within NODE. */
@@ -2313,11 +2326,7 @@ ipa_analyze_node (struct cgraph_node *node)
analysis_dom_walker (&fbi).walk (ENTRY_BLOCK_PTR_FOR_FN (cfun));
- int i;
- struct ipa_bb_info *bi;
- FOR_EACH_VEC_ELT (fbi.bb_infos, i, bi)
- free_ipa_bb_info (bi);
- fbi.bb_infos.release ();
+ ipa_release_body_info (&fbi);
free_dominance_info (CDI_DOMINATORS);
pop_cfun ();
}
@@ -3306,6 +3315,7 @@ ipa_node_params::~ipa_node_params ()
free (lattices);
/* Lattice values and their sources are deallocated with their alocation
pool. */
+ known_csts.release ();
known_contexts.release ();
lattices = NULL;
diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h
index b69ee8ab745..2fe824d35cf 100644
--- a/gcc/ipa-prop.h
+++ b/gcc/ipa-prop.h
@@ -775,7 +775,7 @@ bool ipa_modify_expr (tree *, bool, ipa_parm_adjustment_vec);
ipa_parm_adjustment *ipa_get_adjustment_candidate (tree **, bool *,
ipa_parm_adjustment_vec,
bool);
-
+void ipa_release_body_info (struct ipa_func_body_info *);
/* From tree-sra.c: */
tree build_ref_for_offset (location_t, tree, HOST_WIDE_INT, bool, tree,