diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-02-28 22:20:26 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-02-28 22:20:26 +0100 |
commit | 37b5ec8fcd07999ed4d6dc0126fc4880aed36ef1 (patch) | |
tree | 897ae70d6d0e70bf7f7d7013342324fa45972e27 /gcc | |
parent | 4b3bb3f347116edf9a2badd3ad3f461686583b33 (diff) | |
download | gcc-37b5ec8fcd07999ed4d6dc0126fc4880aed36ef1.zip gcc-37b5ec8fcd07999ed4d6dc0126fc4880aed36ef1.tar.gz gcc-37b5ec8fcd07999ed4d6dc0126fc4880aed36ef1.tar.bz2 |
re PR middle-end/56461 (GCC is leaking lots of memory)
PR middle-end/56461
* tree-vectorizer.h (vect_get_slp_defs): Change 3rd argument
type to vec<vec<tree> > *.
* tree-vect-slp.c (vect_get_slp_defs): Likewise. Change vec_defs
to be vec<tree> instead of vec<tree> *, set vec_defs
to vNULL and call vec_defs.create (number_of_vects), adjust other
uses of vec_defs.
* tree-vect-stmts.c (vect_get_vec_defs, vectorizable_call,
vectorizable_condition): Adjust vect_get_slp_defs callers.
From-SVN: r196360
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/tree-vect-slp.c | 13 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 32 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 2 |
4 files changed, 36 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 213aa88..833ca4e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2013-02-28 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/56461 + * tree-vectorizer.h (vect_get_slp_defs): Change 3rd argument + type to vec<vec<tree> > *. + * tree-vect-slp.c (vect_get_slp_defs): Likewise. Change vec_defs + to be vec<tree> instead of vec<tree> *, set vec_defs + to vNULL and call vec_defs.create (number_of_vects), adjust other + uses of vec_defs. + * tree-vect-stmts.c (vect_get_vec_defs, vectorizable_call, + vectorizable_condition): Adjust vect_get_slp_defs callers. + 2013-02-28 James Greenhalgh <james.greenhalgh@arm.com> * config/aarch64/aarch64.c diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 36f8129..873c18e 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2614,14 +2614,14 @@ vect_get_slp_vect_defs (slp_tree slp_node, vec<tree> *vec_oprnds) void vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, - vec<slp_void_p> *vec_oprnds, int reduc_index) + vec<vec<tree> > *vec_oprnds, int reduc_index) { gimple first_stmt; int number_of_vects = 0, i; unsigned int child_index = 0; HOST_WIDE_INT lhs_size_unit, rhs_size_unit; slp_tree child = NULL; - vec<tree> *vec_defs; + vec<tree> vec_defs; tree oprnd; bool vectorized_defs; @@ -2676,19 +2676,20 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node, } /* Allocate memory for vectorized defs. */ - vec_alloc (vec_defs, number_of_vects); + vec_defs = vNULL; + vec_defs.create (number_of_vects); /* For reduction defs we call vect_get_constant_vectors (), since we are looking for initial loop invariant values. */ if (vectorized_defs && reduc_index == -1) /* The defs are already vectorized. */ - vect_get_slp_vect_defs (child, vec_defs); + vect_get_slp_vect_defs (child, &vec_defs); else /* Build vectors from scalar defs. */ - vect_get_constant_vectors (oprnd, slp_node, vec_defs, i, + vect_get_constant_vectors (oprnd, slp_node, &vec_defs, i, number_of_vects, reduc_index); - vec_oprnds->quick_push ((slp_void_p) vec_defs); + vec_oprnds->quick_push (vec_defs); /* For reductions, we only need initial values. */ if (reduc_index != -1) diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 37f2423..7ba76cd 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -1583,7 +1583,7 @@ vect_get_vec_defs (tree op0, tree op1, gimple stmt, int nops = (op1 == NULL_TREE) ? 1 : 2; vec<tree> ops; ops.create (nops); - vec<slp_void_p> vec_defs; + vec<vec<tree> > vec_defs; vec_defs.create (nops); ops.quick_push (op0); @@ -1592,9 +1592,9 @@ vect_get_vec_defs (tree op0, tree op1, gimple stmt, vect_get_slp_defs (ops, slp_node, &vec_defs, reduc_index); - *vec_oprnds0 = *((vec<tree> *) vec_defs[0]); + *vec_oprnds0 = vec_defs[0]; if (op1) - *vec_oprnds1 = *((vec<tree> *) vec_defs[1]); + *vec_oprnds1 = vec_defs[1]; ops.release (); vec_defs.release (); @@ -1882,14 +1882,14 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (slp_node) { - vec<slp_void_p> vec_defs; + vec<vec<tree> > vec_defs; vec_defs.create (nargs); vec<tree> vec_oprnds0; for (i = 0; i < nargs; i++) vargs.quick_push (gimple_call_arg (stmt, i)); vect_get_slp_defs (vargs, slp_node, &vec_defs, -1); - vec_oprnds0 = *((vec<tree> *) vec_defs[0]); + vec_oprnds0 = vec_defs[0]; /* Arguments are ready. Create the new vector stmt. */ FOR_EACH_VEC_ELT (vec_oprnds0, i, vec_oprnd0) @@ -1897,7 +1897,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, size_t k; for (k = 0; k < nargs; k++) { - vec<tree> vec_oprndsk = *((vec<tree> *) vec_defs[k]); + vec<tree> vec_oprndsk = vec_defs[k]; vargs[k] = vec_oprndsk[i]; } new_stmt = gimple_build_call_vec (fndecl, vargs); @@ -1909,7 +1909,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, for (i = 0; i < nargs; i++) { - vec<tree> vec_oprndsi = *((vec<tree> *) vec_defs[i]); + vec<tree> vec_oprndsi = vec_defs[i]; vec_oprndsi.release (); } vec_defs.release (); @@ -1958,14 +1958,14 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (slp_node) { - vec<slp_void_p> vec_defs; + vec<vec<tree> > vec_defs; vec_defs.create (nargs); vec<tree> vec_oprnds0; for (i = 0; i < nargs; i++) vargs.quick_push (gimple_call_arg (stmt, i)); vect_get_slp_defs (vargs, slp_node, &vec_defs, -1); - vec_oprnds0 = *((vec<tree> *) vec_defs[0]); + vec_oprnds0 = vec_defs[0]; /* Arguments are ready. Create the new vector stmt. */ for (i = 0; vec_oprnds0.iterate (i, &vec_oprnd0); i += 2) @@ -1974,7 +1974,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, vargs.truncate (0); for (k = 0; k < nargs; k++) { - vec<tree> vec_oprndsk = *((vec<tree> *) vec_defs[k]); + vec<tree> vec_oprndsk = vec_defs[k]; vargs.quick_push (vec_oprndsk[i]); vargs.quick_push (vec_oprndsk[i + 1]); } @@ -1987,7 +1987,7 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, for (i = 0; i < nargs; i++) { - vec<tree> vec_oprndsi = *((vec<tree> *) vec_defs[i]); + vec<tree> vec_oprndsi = vec_defs[i]; vec_oprndsi.release (); } vec_defs.release (); @@ -5392,7 +5392,7 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi, { vec<tree> ops; ops.create (4); - vec<slp_void_p> vec_defs; + vec<vec<tree> > vec_defs; vec_defs.create (4); ops.safe_push (TREE_OPERAND (cond_expr, 0)); @@ -5400,10 +5400,10 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi, ops.safe_push (then_clause); ops.safe_push (else_clause); vect_get_slp_defs (ops, slp_node, &vec_defs, -1); - vec_oprnds3 = *((vec<tree> *) vec_defs.pop ()); - vec_oprnds2 = *((vec<tree> *) vec_defs.pop ()); - vec_oprnds1 = *((vec<tree> *) vec_defs.pop ()); - vec_oprnds0 = *((vec<tree> *) vec_defs.pop ()); + vec_oprnds3 = vec_defs.pop (); + vec_oprnds2 = vec_defs.pop (); + vec_oprnds1 = vec_defs.pop (); + vec_oprnds0 = vec_defs.pop (); ops.release (); vec_defs.release (); diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index 8d3a3de..f2ec713 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -978,7 +978,7 @@ extern bool vect_analyze_slp (loop_vec_info, bb_vec_info); extern bool vect_make_slp_decision (loop_vec_info); extern void vect_detect_hybrid_slp (loop_vec_info); extern void vect_get_slp_defs (vec<tree> , slp_tree, - vec<slp_void_p> *, int); + vec<vec<tree> > *, int); extern LOC find_bb_location (basic_block); extern bb_vec_info vect_slp_analyze_bb (basic_block); |