summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-distribution.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-23 16:25:52 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-12-23 16:25:52 +0000
commita8af2e868d6e2eb08b40066e4fc888d8ca2424ab (patch)
tree560661198b65a199d12abbb757c1a4560e199292 /gcc/tree-loop-distribution.c
parent12319e0aa5f1770ecf35d6064037d8da8e1a3460 (diff)
downloadgcc-a8af2e868d6e2eb08b40066e4fc888d8ca2424ab.tar.gz
Fix PR47002: memory leaks.
2010-12-23 Sebastian Pop <sebastian.pop@amd.com> 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168210 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r--gcc/tree-loop-distribution.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index a9ee67ff9cd..d1a499b951c 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -653,6 +653,8 @@ rdg_flag_loop_exits (struct graph *rdg, bitmap loops, bitmap partition,
BITMAP_FREE (new_loops);
}
+
+ VEC_free (gimple, heap, conds);
}
/* Returns a bitmap in which all the statements needed for computing
@@ -693,6 +695,8 @@ free_rdg_components (VEC (rdgc, heap) *components)
VEC_free (int, heap, x->vertices);
free (x);
}
+
+ VEC_free (rdgc, heap, components);
}
/* Build the COMPONENTS vector with the strongly connected components
@@ -1146,6 +1150,9 @@ distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
gimple s;
unsigned i;
VEC (int, heap) *vertices;
+ VEC (ddr_p, heap) *dependence_relations;
+ VEC (data_reference_p, heap) *datarefs;
+ VEC (loop_p, heap) *loop_nest;
if (loop->num_nodes > 2)
{
@@ -1157,7 +1164,10 @@ distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
return res;
}
- rdg = build_rdg (loop);
+ datarefs = VEC_alloc (data_reference_p, heap, 10);
+ dependence_relations = VEC_alloc (ddr_p, heap, 100);
+ loop_nest = VEC_alloc (loop_p, heap, 3);
+ rdg = build_rdg (loop, &loop_nest, &dependence_relations, &datarefs);
if (!rdg)
{
@@ -1166,6 +1176,9 @@ distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
"FIXME: Loop %d not distributed: failed to build the RDG.\n",
loop->num);
+ free_dependence_relations (dependence_relations);
+ free_data_refs (datarefs);
+ VEC_free (loop_p, heap, loop_nest);
return res;
}
@@ -1191,7 +1204,9 @@ distribute_loop (struct loop *loop, VEC (gimple, heap) *stmts)
res = ldist_gen (loop, rdg, vertices);
VEC_free (int, heap, vertices);
free_rdg (rdg);
-
+ free_dependence_relations (dependence_relations);
+ free_data_refs (datarefs);
+ VEC_free (loop_p, heap, loop_nest);
return res;
}