From 01be8516aa6411606f2629cdc19c6acf62511ca6 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 23 Dec 2010 16:25:52 +0000 Subject: Fix PR47002: memory leaks. 2010-12-23 Sebastian Pop PR tree-optimization/47002 * tree-data-ref.c (compute_data_dependences_for_loop): Pass in a pointer to the loop_nest. (analyze_all_data_dependences): Initialize and free the loop_nest. (free_dependence_relations): Do not free loop_nest. (build_rdg): Pass in the loop_nest, datarefs, and dependence_relations. (free_rdg): Also free the data on edges. * tree-data-ref.h (build_rdg): Update declaration. (compute_data_dependences_for_loop): Same. * tree-if-conv.c (if_convertible_loop_p_1): Pass in the loop_nest. (if_convertible_loop_p): Allocate and free loop_nest. * tree-loop-distribution.c (rdg_flag_loop_exits): Free conds. (free_rdg_components): VEC_free components. (distribute_loop): Update call to build_rdg. Allocate and free loop_nest, datarefs, and dependence_relations. * tree-loop-linear.c (linear_transform_loops): Allocate and free loop_nest. * tree-parloops.c (loop_parallel_p): Same. * tree-predcom.c (tree_predictive_commoning_loop): Same. * tree-vect-data-refs.c (vect_analyze_data_refs): Pass to compute_data_dependences_for_loop a pointer to LOOP_VINFO_LOOP_NEST. * tree-vect-loop.c (new_loop_vec_info): Initialize LOOP_VINFO_LOOP_NEST. (destroy_loop_vec_info): Free LOOP_VINFO_MAY_ALIAS_DDRS and LOOP_VINFO_LOOP_NEST. * tree-vect-slp.c (destroy_bb_vec_info): Call free_data_refs and free_dependence_relations. * tree-vectorizer.h (struct _loop_vec_info): Add a field loop_nest. (LOOP_VINFO_LOOP_NEST): New. From-SVN: r168210 --- gcc/tree-parloops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/tree-parloops.c') diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index ea1911a8..aba70c8 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -252,7 +252,8 @@ name_to_copy_elt_hash (const void *aa) static bool loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack) { - VEC (ddr_p, heap) * dependence_relations; + VEC (loop_p, heap) *loop_nest; + VEC (ddr_p, heap) *dependence_relations; VEC (data_reference_p, heap) *datarefs; lambda_trans_matrix trans; bool ret = false; @@ -270,7 +271,8 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack) the iterations are independent. */ datarefs = VEC_alloc (data_reference_p, heap, 10); dependence_relations = VEC_alloc (ddr_p, heap, 10 * 10); - compute_data_dependences_for_loop (loop, true, &datarefs, + loop_nest = VEC_alloc (loop_p, heap, 3); + compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs, &dependence_relations); if (dump_file && (dump_flags & TDF_DETAILS)) dump_data_dependence_relations (dump_file, dependence_relations); @@ -288,6 +290,7 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack) fprintf (dump_file, " FAILED: data dependencies exist across iterations\n"); + VEC_free (loop_p, heap, loop_nest); free_dependence_relations (dependence_relations); free_data_refs (datarefs); -- cgit v1.1