Replace some heap vectors with stack vectors.

From http://gcc.gnu.org/ml/gcc-patches/2013-10/msg02735.html

This patch is pretty dull, it just replaces a bunch of things of the
form
vec<T> x;
x.create (N); // N is a constant
blah blah
x.release ();
by
stack_vec<T, N> x;
blah blah

2013-11-01  Trevor Saunders  <tsaunders@mozilla.com>

gcc/
	* function.c (reorder_blocks): Convert block_stack to a stack_vec.
	* gimplify.c (gimplify_compound_lval): Likewise.
	* graphite-clast-to-gimple.c (gloog): Likewise.
	* graphite-dependences.c (loop_is_parallel_p): Likewise.
	* graphite-scop-detection.c (scopdet_basic_block_info): Likewise.
	(limit_scop); Likewise.
	(build_scops): Likewise.
	(dot_scop): Likewise.
	* graphite-sese-to-poly.c (sese_dom_walker): Likewise.
	(build_scop_drs): Likewise.
	(insert_stmts): Likewise.
	(insert_out_of_ssa_copy): Likewise.
	(remove_phi): Likewise.
	(rewrite_commutative_reductions_out_of_ssa_close_phi): Likewise.
	* hw-doloop.c (discover_loop): Likewise.
	* tree-call-cdce.c (shrink_wrap_one_built_in_call): Likewise.
	* tree-dfa.c (dump_enumerated_decls): Likewise.
	* tree-if-conv.c (if_convertable_loop_p): Likewise.
	* tree-inline.c (tree_function_versioning): Likewise.
	* tree-loop-distribution.c (build_rdg): Likewise.
	(rdg_flag_vertex_and_dependent): Likewise.
	(distribute_loop): Likewise.
	* tree-parloops.c (loop_parallel_p): Likewise.
	(eliminate_local_variables): Likewise.
	(separate_decls_in_region): Likewise.
	* tree-predcom.c (tree_predictive_commoning_loop): Likewise.
	* tree-ssa-phiopt.c (cond_if_else_store_replacement): Likewise.
	* tree-ssa-uncprop.c (uncprop_dom_walker): Likewise.
	* tree-vect-loop.c (vect_analyze_scaler_cycles_1): Likewise.
	* tree-vect-patterns.c (vect_pattern_recog): Likewise.
	* tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise.
	(vectorizable_condition): Likewise.

gcc/cp/
	* semantics.c (build_anon_member_initialization): Convert fields to be
        a stack_vec.

From-SVN: r204301
This commit is contained in:
Trevor Saunders 2013-11-01 20:31:32 +00:00 committed by Diego Novillo
parent 654a6bb421
commit 07687835be
22 changed files with 89 additions and 173 deletions

View File

@ -1,3 +1,38 @@
2013-11-01 Trevor Saunders <tsaunders@mozilla.com>
* function.c (reorder_blocks): Convert block_stack to a stack_vec.
* gimplify.c (gimplify_compound_lval): Likewise.
* graphite-clast-to-gimple.c (gloog): Likewise.
* graphite-dependences.c (loop_is_parallel_p): Likewise.
* graphite-scop-detection.c (scopdet_basic_block_info): Likewise.
(limit_scop); Likewise.
(build_scops): Likewise.
(dot_scop): Likewise.
* graphite-sese-to-poly.c (sese_dom_walker): Likewise.
(build_scop_drs): Likewise.
(insert_stmts): Likewise.
(insert_out_of_ssa_copy): Likewise.
(remove_phi): Likewise.
(rewrite_commutative_reductions_out_of_ssa_close_phi): Likewise.
* hw-doloop.c (discover_loop): Likewise.
* tree-call-cdce.c (shrink_wrap_one_built_in_call): Likewise.
* tree-dfa.c (dump_enumerated_decls): Likewise.
* tree-if-conv.c (if_convertable_loop_p): Likewise.
* tree-inline.c (tree_function_versioning): Likewise.
* tree-loop-distribution.c (build_rdg): Likewise.
(rdg_flag_vertex_and_dependent): Likewise.
(distribute_loop): Likewise.
* tree-parloops.c (loop_parallel_p): Likewise.
(eliminate_local_variables): Likewise.
(separate_decls_in_region): Likewise.
* tree-predcom.c (tree_predictive_commoning_loop): Likewise.
* tree-ssa-phiopt.c (cond_if_else_store_replacement): Likewise.
* tree-ssa-uncprop.c (uncprop_dom_walker): Likewise.
* tree-vect-loop.c (vect_analyze_scaler_cycles_1): Likewise.
* tree-vect-patterns.c (vect_pattern_recog): Likewise.
* tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise.
(vectorizable_condition): Likewise.
2013-11-01 Uros Bizjak <ubizjak@gmail.com> 2013-11-01 Uros Bizjak <ubizjak@gmail.com>
* configure.ac (HAVE_AS_IX86_INTERUNIT_MOVQ): Always define as 0/1. * configure.ac (HAVE_AS_IX86_INTERUNIT_MOVQ): Always define as 0/1.

View File

@ -1,3 +1,8 @@
2013-11-01 Trevor Saunders <tsaunders@mozilla.com>
* semantics.c (build_anon_member_initialization): Convert fields to be
a stack_vec.
2013-11-01 Marc Glisse <marc.glisse@inria.fr> 2013-11-01 Marc Glisse <marc.glisse@inria.fr>
PR c++/58834 PR c++/58834

View File

@ -7439,8 +7439,7 @@ build_anon_member_initialization (tree member, tree init,
to build up the initializer from the outside in so that we can reuse to build up the initializer from the outside in so that we can reuse
previously built CONSTRUCTORs if this is, say, the second field in an previously built CONSTRUCTORs if this is, say, the second field in an
anonymous struct. So we use a vec as a stack. */ anonymous struct. So we use a vec as a stack. */
vec<tree> fields; stack_vec<tree, 2> fields;
fields.create (2);
do do
{ {
fields.safe_push (TREE_OPERAND (member, 1)); fields.safe_push (TREE_OPERAND (member, 1));
@ -7472,7 +7471,6 @@ build_anon_member_initialization (tree member, tree init,
/* Now we're at the innermost field, the one that isn't an anonymous /* Now we're at the innermost field, the one that isn't an anonymous
aggregate. Add its initializer to the CONSTRUCTOR and we're done. */ aggregate. Add its initializer to the CONSTRUCTOR and we're done. */
gcc_assert (fields.is_empty()); gcc_assert (fields.is_empty());
fields.release ();
CONSTRUCTOR_APPEND_ELT (*vec, field, init); CONSTRUCTOR_APPEND_ELT (*vec, field, init);
return true; return true;

View File

@ -4128,12 +4128,11 @@ void
reorder_blocks (void) reorder_blocks (void)
{ {
tree block = DECL_INITIAL (current_function_decl); tree block = DECL_INITIAL (current_function_decl);
vec<tree> block_stack;
if (block == NULL_TREE) if (block == NULL_TREE)
return; return;
block_stack.create (10); stack_vec<tree, 10> block_stack;
/* Reset the TREE_ASM_WRITTEN bit for all blocks. */ /* Reset the TREE_ASM_WRITTEN bit for all blocks. */
clear_block_marks (block); clear_block_marks (block);
@ -4145,8 +4144,6 @@ reorder_blocks (void)
/* Recreate the block tree from the note nesting. */ /* Recreate the block tree from the note nesting. */
reorder_blocks_1 (get_insns (), block, &block_stack); reorder_blocks_1 (get_insns (), block, &block_stack);
BLOCK_SUBBLOCKS (block) = blocks_nreverse_all (BLOCK_SUBBLOCKS (block)); BLOCK_SUBBLOCKS (block) = blocks_nreverse_all (BLOCK_SUBBLOCKS (block));
block_stack.release ();
} }
/* Helper function for reorder_blocks. Reset TREE_ASM_WRITTEN. */ /* Helper function for reorder_blocks. Reset TREE_ASM_WRITTEN. */

View File

@ -2142,7 +2142,6 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
fallback_t fallback) fallback_t fallback)
{ {
tree *p; tree *p;
vec<tree> expr_stack;
enum gimplify_status ret = GS_ALL_DONE, tret; enum gimplify_status ret = GS_ALL_DONE, tret;
int i; int i;
location_t loc = EXPR_LOCATION (*expr_p); location_t loc = EXPR_LOCATION (*expr_p);
@ -2150,7 +2149,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
/* Create a stack of the subexpressions so later we can walk them in /* Create a stack of the subexpressions so later we can walk them in
order from inner to outer. */ order from inner to outer. */
expr_stack.create (10); stack_vec<tree, 10> expr_stack;
/* We can handle anything that get_inner_reference can deal with. */ /* We can handle anything that get_inner_reference can deal with. */
for (p = expr_p; ; p = &TREE_OPERAND (*p, 0)) for (p = expr_p; ; p = &TREE_OPERAND (*p, 0))

View File

@ -1652,8 +1652,7 @@ debug_generated_program (scop_p scop)
bool bool
gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping) gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping)
{ {
vec<tree> newivs; stack_vec<tree, 10> newivs;
newivs.create (10);
loop_p context_loop; loop_p context_loop;
sese region = SCOP_REGION (scop); sese region = SCOP_REGION (scop);
ifsese if_region = NULL; ifsese if_region = NULL;
@ -1711,7 +1710,6 @@ gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping)
newivs_index.dispose (); newivs_index.dispose ();
params_index.dispose (); params_index.dispose ();
newivs.release ();
cloog_clast_free (clast); cloog_clast_free (clast);
timevar_pop (TV_GRAPHITE_CODE_GEN); timevar_pop (TV_GRAPHITE_CODE_GEN);

View File

@ -585,13 +585,11 @@ loop_is_parallel_p (loop_p loop, bb_pbb_htab_type bb_pbb_mapping, int depth)
{ {
bool dependences; bool dependences;
scop_p scop; scop_p scop;
vec<poly_bb_p> body;
body.create (3);
timevar_push (TV_GRAPHITE_DATA_DEPS); timevar_push (TV_GRAPHITE_DATA_DEPS);
stack_vec<poly_bb_p, 3> body;
scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body); scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body);
dependences = loop_level_carries_dependences (scop, body, depth); dependences = loop_level_carries_dependences (scop, body, depth);
body.release ();
timevar_pop (TV_GRAPHITE_DATA_DEPS); timevar_pop (TV_GRAPHITE_DATA_DEPS);
return !dependences; return !dependences;

View File

@ -475,8 +475,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
case GBB_LOOP_SING_EXIT_HEADER: case GBB_LOOP_SING_EXIT_HEADER:
{ {
vec<sd_region> regions; stack_vec<sd_region, 3> regions;
regions.create (3);
struct scopdet_info sinfo; struct scopdet_info sinfo;
edge exit_e = single_exit (loop); edge exit_e = single_exit (loop);
@ -541,8 +540,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
{ {
/* XXX: For now we just do not join loops with multiple exits. If the /* XXX: For now we just do not join loops with multiple exits. If the
exits lead to the same bb it may be possible to join the loop. */ exits lead to the same bb it may be possible to join the loop. */
vec<sd_region> regions; stack_vec<sd_region, 3> regions;
regions.create (3);
vec<edge> exits = get_loop_exit_edges (loop); vec<edge> exits = get_loop_exit_edges (loop);
edge e; edge e;
int i; int i;
@ -585,8 +583,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
} }
case GBB_COND_HEADER: case GBB_COND_HEADER:
{ {
vec<sd_region> regions; stack_vec<sd_region, 3> regions;
regions.create (3);
struct scopdet_info sinfo; struct scopdet_info sinfo;
vec<basic_block> dominated; vec<basic_block> dominated;
int i; int i;
@ -1189,8 +1186,7 @@ print_graphite_statistics (FILE* file, vec<scop_p> scops)
static void static void
limit_scops (vec<scop_p> *scops) limit_scops (vec<scop_p> *scops)
{ {
vec<sd_region> regions; stack_vec<sd_region, 3> regions;
regions.create (3);
int i; int i;
scop_p scop; scop_p scop;
@ -1225,7 +1221,6 @@ limit_scops (vec<scop_p> *scops)
create_sese_edges (regions); create_sese_edges (regions);
build_graphite_scops (regions, scops); build_graphite_scops (regions, scops);
regions.release ();
} }
/* Returns true when P1 and P2 are close phis with the same /* Returns true when P1 and P2 are close phis with the same
@ -1404,8 +1399,7 @@ void
build_scops (vec<scop_p> *scops) build_scops (vec<scop_p> *scops)
{ {
struct loop *loop = current_loops->tree_root; struct loop *loop = current_loops->tree_root;
vec<sd_region> regions; stack_vec<sd_region, 3> regions;
regions.create (3);
canonicalize_loop_closed_ssa_form (); canonicalize_loop_closed_ssa_form ();
build_scops_1 (single_succ (ENTRY_BLOCK_PTR), ENTRY_BLOCK_PTR->loop_father, build_scops_1 (single_succ (ENTRY_BLOCK_PTR), ENTRY_BLOCK_PTR->loop_father,
@ -1595,7 +1589,7 @@ dot_all_scops (vec<scop_p> scops)
DEBUG_FUNCTION void DEBUG_FUNCTION void
dot_scop (scop_p scop) dot_scop (scop_p scop)
{ {
vec<scop_p> scops = vNULL; stack_vec<scop_p, 1> scops;
if (scop) if (scop)
scops.safe_push (scop); scops.safe_push (scop);
@ -1615,8 +1609,6 @@ dot_scop (scop_p scop)
#else #else
dot_all_scops_1 (stderr, scops); dot_all_scops_1 (stderr, scops);
#endif #endif
scops.release ();
} }
#endif #endif

View File

@ -1231,27 +1231,18 @@ class sese_dom_walker : public dom_walker
{ {
public: public:
sese_dom_walker (cdi_direction, sese); sese_dom_walker (cdi_direction, sese);
~sese_dom_walker ();
virtual void before_dom_children (basic_block); virtual void before_dom_children (basic_block);
virtual void after_dom_children (basic_block); virtual void after_dom_children (basic_block);
private: private:
vec<gimple> m_conditions, m_cases; stack_vec<gimple, 3> m_conditions, m_cases;
sese m_region; sese m_region;
}; };
sese_dom_walker::sese_dom_walker (cdi_direction direction, sese region) sese_dom_walker::sese_dom_walker (cdi_direction direction, sese region)
: dom_walker (direction), m_region (region) : dom_walker (direction), m_region (region)
{ {
m_conditions.create (3);
m_cases.create (3);
}
sese_dom_walker::~sese_dom_walker ()
{
m_conditions.release ();
m_cases.release ();
} }
/* Call-back for dom_walk executed before visiting the dominated /* Call-back for dom_walk executed before visiting the dominated
@ -1890,8 +1881,7 @@ build_scop_drs (scop_p scop)
int i, j; int i, j;
poly_bb_p pbb; poly_bb_p pbb;
data_reference_p dr; data_reference_p dr;
vec<data_reference_p> drs; stack_vec<data_reference_p, 3> drs;
drs.create (3);
/* Remove all the PBBs that do not have data references: these basic /* Remove all the PBBs that do not have data references: these basic
blocks are not handled in the polyhedral representation. */ blocks are not handled in the polyhedral representation. */
@ -1989,8 +1979,7 @@ insert_stmts (scop_p scop, gimple stmt, gimple_seq stmts,
gimple_stmt_iterator insert_gsi) gimple_stmt_iterator insert_gsi)
{ {
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
vec<gimple> x; stack_vec<gimple, 3> x;
x.create (3);
gimple_seq_add_stmt (&stmts, stmt); gimple_seq_add_stmt (&stmts, stmt);
for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
@ -1998,7 +1987,6 @@ insert_stmts (scop_p scop, gimple stmt, gimple_seq stmts,
gsi_insert_seq_before (&insert_gsi, stmts, GSI_SAME_STMT); gsi_insert_seq_before (&insert_gsi, stmts, GSI_SAME_STMT);
analyze_drs_in_stmts (scop, gsi_bb (insert_gsi), x); analyze_drs_in_stmts (scop, gsi_bb (insert_gsi), x);
x.release ();
} }
/* Insert the assignment "RES := EXPR" just after AFTER_STMT. */ /* Insert the assignment "RES := EXPR" just after AFTER_STMT. */
@ -2010,8 +1998,7 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt)
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE); tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (unshare_expr (res), var); gimple stmt = gimple_build_assign (unshare_expr (res), var);
vec<gimple> x; stack_vec<gimple, 3> x;
x.create (3);
gimple_seq_add_stmt (&stmts, stmt); gimple_seq_add_stmt (&stmts, stmt);
for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
@ -2029,7 +2016,6 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt)
} }
analyze_drs_in_stmts (scop, gimple_bb (after_stmt), x); analyze_drs_in_stmts (scop, gimple_bb (after_stmt), x);
x.release ();
} }
/* Creates a poly_bb_p for basic_block BB from the existing PBB. */ /* Creates a poly_bb_p for basic_block BB from the existing PBB. */
@ -2067,8 +2053,7 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr)
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE); tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (unshare_expr (res), var); gimple stmt = gimple_build_assign (unshare_expr (res), var);
basic_block bb; basic_block bb;
vec<gimple> x; stack_vec<gimple, 3> x;
x.create (3);
gimple_seq_add_stmt (&stmts, stmt); gimple_seq_add_stmt (&stmts, stmt);
for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start (stmts); !gsi_end_p (gsi); gsi_next (&gsi))
@ -2085,7 +2070,6 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr)
new_pbb_from_pbb (scop, pbb_from_bb (e->src), bb); new_pbb_from_pbb (scop, pbb_from_bb (e->src), bb);
analyze_drs_in_stmts (scop, bb, x); analyze_drs_in_stmts (scop, bb, x);
x.release ();
} }
/* Creates a zero dimension array of the same type as VAR. */ /* Creates a zero dimension array of the same type as VAR. */
@ -2881,8 +2865,7 @@ remove_phi (gimple phi)
tree def; tree def;
use_operand_p use_p; use_operand_p use_p;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
vec<gimple> update; stack_vec<gimple, 3> update;
update.create (3);
unsigned int i; unsigned int i;
gimple stmt; gimple stmt;
@ -2901,8 +2884,6 @@ remove_phi (gimple phi)
FOR_EACH_VEC_ELT (update, i, stmt) FOR_EACH_VEC_ELT (update, i, stmt)
update_stmt (stmt); update_stmt (stmt);
update.release ();
gsi = gsi_for_phi_node (phi); gsi = gsi_for_phi_node (phi);
remove_phi_node (&gsi, false); remove_phi_node (&gsi, false);
} }
@ -3042,18 +3023,14 @@ rewrite_commutative_reductions_out_of_ssa_close_phi (scop_p scop,
gimple close_phi) gimple close_phi)
{ {
bool res; bool res;
vec<gimple> in; stack_vec<gimple, 10> in;
in.create (10); stack_vec<gimple, 10> out;
vec<gimple> out;
out.create (10);
detect_commutative_reduction (scop, close_phi, &in, &out); detect_commutative_reduction (scop, close_phi, &in, &out);
res = in.length () > 1; res = in.length () > 1;
if (res) if (res)
translate_scalar_reduction_to_array (scop, in, out); translate_scalar_reduction_to_array (scop, in, out);
in.release ();
out.release ();
return res; return res;
} }

View File

@ -237,7 +237,6 @@ discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg)
bool found_tail; bool found_tail;
unsigned dwork = 0; unsigned dwork = 0;
basic_block bb; basic_block bb;
vec<basic_block> works;
loop->tail = tail_bb; loop->tail = tail_bb;
loop->loop_end = tail_insn; loop->loop_end = tail_insn;
@ -253,7 +252,7 @@ discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg)
loop->head = BRANCH_EDGE (tail_bb)->dest; loop->head = BRANCH_EDGE (tail_bb)->dest;
loop->successor = FALLTHRU_EDGE (tail_bb)->dest; loop->successor = FALLTHRU_EDGE (tail_bb)->dest;
works.create (20); stack_vec<basic_block, 20> works;
works.safe_push (loop->head); works.safe_push (loop->head);
found_tail = false; found_tail = false;
@ -340,8 +339,6 @@ discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg)
} }
} }
} }
works.release ();
} }
/* Analyze the structure of the loops in the current function. Use /* Analyze the structure of the loops in the current function. Use

View File

@ -713,7 +713,6 @@ shrink_wrap_one_built_in_call (gimple bi_call)
basic_block bi_call_bb, join_tgt_bb, guard_bb, guard_bb0; basic_block bi_call_bb, join_tgt_bb, guard_bb, guard_bb0;
edge join_tgt_in_edge_from_call, join_tgt_in_edge_fall_thru; edge join_tgt_in_edge_from_call, join_tgt_in_edge_fall_thru;
edge bi_call_in_edge0, guard_bb_in_edge; edge bi_call_in_edge0, guard_bb_in_edge;
vec<gimple> conds;
unsigned tn_cond_stmts, nconds; unsigned tn_cond_stmts, nconds;
unsigned ci; unsigned ci;
gimple cond_expr = NULL; gimple cond_expr = NULL;
@ -721,7 +720,7 @@ shrink_wrap_one_built_in_call (gimple bi_call)
tree bi_call_label_decl; tree bi_call_label_decl;
gimple bi_call_label; gimple bi_call_label;
conds.create (12); stack_vec<gimple, 12> conds;
gen_shrink_wrap_conditions (bi_call, conds, &nconds); gen_shrink_wrap_conditions (bi_call, conds, &nconds);
/* This can happen if the condition generator decides /* This can happen if the condition generator decides
@ -729,10 +728,7 @@ shrink_wrap_one_built_in_call (gimple bi_call)
return false and do not do any transformation for return false and do not do any transformation for
the call. */ the call. */
if (nconds == 0) if (nconds == 0)
{ return false;
conds.release ();
return false;
}
bi_call_bb = gimple_bb (bi_call); bi_call_bb = gimple_bb (bi_call);
@ -743,10 +739,7 @@ shrink_wrap_one_built_in_call (gimple bi_call)
it could e.g. have EH edges. */ it could e.g. have EH edges. */
join_tgt_in_edge_from_call = find_fallthru_edge (bi_call_bb->succs); join_tgt_in_edge_from_call = find_fallthru_edge (bi_call_bb->succs);
if (join_tgt_in_edge_from_call == NULL) if (join_tgt_in_edge_from_call == NULL)
{ return false;
conds.release ();
return false;
}
} }
else else
join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call); join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call);
@ -832,7 +825,6 @@ shrink_wrap_one_built_in_call (gimple bi_call)
guard_bb_in_edge->count = guard_bb->count - bi_call_in_edge->count; guard_bb_in_edge->count = guard_bb->count - bi_call_in_edge->count;
} }
conds.release ();
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
location_t loc; location_t loc;

View File

@ -743,8 +743,7 @@ dump_enumerated_decls (FILE *file, int flags)
{ {
basic_block bb; basic_block bb;
struct walk_stmt_info wi; struct walk_stmt_info wi;
vec<numbered_tree> decl_list; stack_vec<numbered_tree, 40> decl_list;
decl_list.create (40);
memset (&wi, '\0', sizeof (wi)); memset (&wi, '\0', sizeof (wi));
wi.info = (void *) &decl_list; wi.info = (void *) &decl_list;
@ -775,5 +774,4 @@ dump_enumerated_decls (FILE *file, int flags)
last = ntp->t; last = ntp->t;
} }
} }
decl_list.release ();
} }

View File

@ -1165,7 +1165,6 @@ if_convertible_loop_p (struct loop *loop)
bool res = false; bool res = false;
vec<data_reference_p> refs; vec<data_reference_p> refs;
vec<ddr_p> ddrs; vec<ddr_p> ddrs;
vec<loop_p> loop_nest;
/* Handle only innermost loop. */ /* Handle only innermost loop. */
if (!loop || loop->inner) if (!loop || loop->inner)
@ -1199,7 +1198,7 @@ if_convertible_loop_p (struct loop *loop)
refs.create (5); refs.create (5);
ddrs.create (25); ddrs.create (25);
loop_nest.create (3); stack_vec<loop_p, 3> loop_nest;
res = if_convertible_loop_p_1 (loop, &loop_nest, &refs, &ddrs); res = if_convertible_loop_p_1 (loop, &loop_nest, &refs, &ddrs);
if (flag_tree_loop_if_convert_stores) if (flag_tree_loop_if_convert_stores)

View File

@ -5187,8 +5187,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
unsigned i; unsigned i;
struct ipa_replace_map *replace_info; struct ipa_replace_map *replace_info;
basic_block old_entry_block, bb; basic_block old_entry_block, bb;
vec<gimple> init_stmts; stack_vec<gimple, 10> init_stmts;
init_stmts.create (10);
tree vars = NULL_TREE; tree vars = NULL_TREE;
gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL
@ -5446,7 +5445,6 @@ tree_function_versioning (tree old_decl, tree new_decl,
free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS);
gcc_assert (!id.debug_stmts.exists ()); gcc_assert (!id.debug_stmts.exists ());
init_stmts.release ();
pop_cfun (); pop_cfun ();
return; return;
} }

View File

@ -436,17 +436,15 @@ static struct graph *
build_rdg (vec<loop_p> loop_nest, control_dependences *cd) build_rdg (vec<loop_p> loop_nest, control_dependences *cd)
{ {
struct graph *rdg; struct graph *rdg;
vec<gimple> stmts;
vec<data_reference_p> datarefs; vec<data_reference_p> datarefs;
/* Create the RDG vertices from the stmts of the loop nest. */ /* Create the RDG vertices from the stmts of the loop nest. */
stmts.create (10); stack_vec<gimple, 10> stmts;
stmts_from_loop (loop_nest[0], &stmts); stmts_from_loop (loop_nest[0], &stmts);
rdg = new_graph (stmts.length ()); rdg = new_graph (stmts.length ());
datarefs.create (10); datarefs.create (10);
if (!create_rdg_vertices (rdg, stmts, loop_nest[0], &datarefs)) if (!create_rdg_vertices (rdg, stmts, loop_nest[0], &datarefs))
{ {
stmts.release ();
datarefs.release (); datarefs.release ();
free_rdg (rdg); free_rdg (rdg);
return NULL; return NULL;
@ -951,11 +949,10 @@ static partition_t
build_rdg_partition_for_vertex (struct graph *rdg, int v) build_rdg_partition_for_vertex (struct graph *rdg, int v)
{ {
partition_t partition = partition_alloc (NULL, NULL); partition_t partition = partition_alloc (NULL, NULL);
vec<int> nodes; stack_vec<int, 3> nodes;
unsigned i; unsigned i;
int x; int x;
nodes.create (3);
graphds_dfs (rdg, &v, 1, &nodes, false, NULL); graphds_dfs (rdg, &v, 1, &nodes, false, NULL);
FOR_EACH_VEC_ELT (nodes, i, x) FOR_EACH_VEC_ELT (nodes, i, x)
@ -965,7 +962,6 @@ build_rdg_partition_for_vertex (struct graph *rdg, int v)
loop_containing_stmt (RDG_STMT (rdg, x))->num); loop_containing_stmt (RDG_STMT (rdg, x))->num);
} }
nodes.release ();
return partition; return partition;
} }
@ -1388,7 +1384,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
control_dependences *cd, int *nb_calls) control_dependences *cd, int *nb_calls)
{ {
struct graph *rdg; struct graph *rdg;
vec<loop_p> loop_nest;
vec<partition_t> partitions; vec<partition_t> partitions;
partition_t partition; partition_t partition;
bool any_builtin; bool any_builtin;
@ -1397,12 +1392,9 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
int num_sccs = 1; int num_sccs = 1;
*nb_calls = 0; *nb_calls = 0;
loop_nest.create (3); stack_vec<loop_p, 3> loop_nest;
if (!find_loop_nest (loop, &loop_nest)) if (!find_loop_nest (loop, &loop_nest))
{ return 0;
loop_nest.release ();
return 0;
}
rdg = build_rdg (loop_nest, cd); rdg = build_rdg (loop_nest, cd);
if (!rdg) if (!rdg)
@ -1412,7 +1404,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
"Loop %d not distributed: failed to build the RDG.\n", "Loop %d not distributed: failed to build the RDG.\n",
loop->num); loop->num);
loop_nest.release ();
return 0; return 0;
} }
@ -1648,7 +1639,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
partitions.release (); partitions.release ();
free_rdg (rdg); free_rdg (rdg);
loop_nest.release ();
return nbp - *nb_calls; return nbp - *nb_calls;
} }

View File

@ -395,7 +395,6 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
static bool static bool
loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack) loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack)
{ {
vec<loop_p> loop_nest;
vec<ddr_p> dependence_relations; vec<ddr_p> dependence_relations;
vec<data_reference_p> datarefs; vec<data_reference_p> datarefs;
lambda_trans_matrix trans; lambda_trans_matrix trans;
@ -412,9 +411,9 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack)
/* Check for problems with dependences. If the loop can be reversed, /* Check for problems with dependences. If the loop can be reversed,
the iterations are independent. */ the iterations are independent. */
stack_vec<loop_p, 3> loop_nest;
datarefs.create (10); datarefs.create (10);
dependence_relations.create (10 * 10); dependence_relations.create (100);
loop_nest.create (3);
if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs, if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
&dependence_relations)) &dependence_relations))
{ {
@ -440,7 +439,6 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack)
" FAILED: data dependencies exist across iterations\n"); " FAILED: data dependencies exist across iterations\n");
end: end:
loop_nest.release ();
free_dependence_relations (dependence_relations); free_dependence_relations (dependence_relations);
free_data_refs (datarefs); free_data_refs (datarefs);
@ -741,8 +739,7 @@ static void
eliminate_local_variables (edge entry, edge exit) eliminate_local_variables (edge entry, edge exit)
{ {
basic_block bb; basic_block bb;
vec<basic_block> body; stack_vec<basic_block, 3> body;
body.create (3);
unsigned i; unsigned i;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
bool has_debug_stmt = false; bool has_debug_stmt = false;
@ -772,7 +769,6 @@ eliminate_local_variables (edge entry, edge exit)
eliminate_local_variables_stmt (entry, &gsi, decl_address); eliminate_local_variables_stmt (entry, &gsi, decl_address);
decl_address.dispose (); decl_address.dispose ();
body.release ();
} }
/* Returns true if expression EXPR is not defined between ENTRY and /* Returns true if expression EXPR is not defined between ENTRY and
@ -1297,8 +1293,7 @@ separate_decls_in_region (edge entry, edge exit,
tree type, type_name, nvar; tree type, type_name, nvar;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
struct clsn_data clsn_data; struct clsn_data clsn_data;
vec<basic_block> body; stack_vec<basic_block, 3> body;
body.create (3);
basic_block bb; basic_block bb;
basic_block entry_bb = bb1; basic_block entry_bb = bb1;
basic_block exit_bb = exit->dest; basic_block exit_bb = exit->dest;
@ -1356,8 +1351,6 @@ separate_decls_in_region (edge entry, edge exit,
} }
} }
body.release ();
if (name_copies.elements () == 0 && reduction_list.elements () == 0) if (name_copies.elements () == 0 && reduction_list.elements () == 0)
{ {
/* It may happen that there is nothing to copy (if there are only /* It may happen that there is nothing to copy (if there are only

View File

@ -2421,7 +2421,6 @@ prepare_initializers (struct loop *loop, vec<chain_p> chains)
static bool static bool
tree_predictive_commoning_loop (struct loop *loop) tree_predictive_commoning_loop (struct loop *loop)
{ {
vec<loop_p> loop_nest;
vec<data_reference_p> datarefs; vec<data_reference_p> datarefs;
vec<ddr_p> dependences; vec<ddr_p> dependences;
struct component *components; struct component *components;
@ -2437,15 +2436,14 @@ tree_predictive_commoning_loop (struct loop *loop)
/* Find the data references and split them into components according to their /* Find the data references and split them into components according to their
dependence relations. */ dependence relations. */
datarefs.create (10); stack_vec<loop_p, 3> loop_nest;
dependences.create (10); dependences.create (10);
loop_nest.create (3); datarefs.create (10);
if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs, if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
&dependences)) &dependences))
{ {
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Cannot analyze data dependencies\n"); fprintf (dump_file, "Cannot analyze data dependencies\n");
loop_nest.release ();
free_data_refs (datarefs); free_data_refs (datarefs);
free_dependence_relations (dependences); free_dependence_relations (dependences);
return false; return false;

View File

@ -1680,7 +1680,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
data_reference_p then_dr, else_dr; data_reference_p then_dr, else_dr;
int i, j; int i, j;
tree then_lhs, else_lhs; tree then_lhs, else_lhs;
vec<gimple> then_stores, else_stores;
basic_block blocks[3]; basic_block blocks[3];
if (MAX_STORES_TO_SINK == 0) if (MAX_STORES_TO_SINK == 0)
@ -1707,8 +1706,7 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
} }
/* Find pairs of stores with equal LHS. */ /* Find pairs of stores with equal LHS. */
then_stores.create (1); stack_vec<gimple, 1> then_stores, else_stores;
else_stores.create (1);
FOR_EACH_VEC_ELT (then_datarefs, i, then_dr) FOR_EACH_VEC_ELT (then_datarefs, i, then_dr)
{ {
if (DR_IS_READ (then_dr)) if (DR_IS_READ (then_dr))
@ -1746,8 +1744,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
{ {
free_data_refs (then_datarefs); free_data_refs (then_datarefs);
free_data_refs (else_datarefs); free_data_refs (else_datarefs);
then_stores.release ();
else_stores.release ();
return false; return false;
} }
@ -1763,8 +1759,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
free_dependence_relations (else_ddrs); free_dependence_relations (else_ddrs);
free_data_refs (then_datarefs); free_data_refs (then_datarefs);
free_data_refs (else_datarefs); free_data_refs (else_datarefs);
then_stores.release ();
else_stores.release ();
return false; return false;
} }
blocks[0] = then_bb; blocks[0] = then_bb;
@ -1790,8 +1784,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
free_dependence_relations (else_ddrs); free_dependence_relations (else_ddrs);
free_data_refs (then_datarefs); free_data_refs (then_datarefs);
free_data_refs (else_datarefs); free_data_refs (else_datarefs);
then_stores.release ();
else_stores.release ();
return false; return false;
} }
} }
@ -1814,8 +1806,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
free_dependence_relations (else_ddrs); free_dependence_relations (else_ddrs);
free_data_refs (then_datarefs); free_data_refs (then_datarefs);
free_data_refs (else_datarefs); free_data_refs (else_datarefs);
then_stores.release ();
else_stores.release ();
return false; return false;
} }
} }
@ -1833,8 +1823,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
free_dependence_relations (else_ddrs); free_dependence_relations (else_ddrs);
free_data_refs (then_datarefs); free_data_refs (then_datarefs);
free_data_refs (else_datarefs); free_data_refs (else_datarefs);
then_stores.release ();
else_stores.release ();
return ok; return ok;
} }

View File

@ -361,15 +361,7 @@ record_equiv (tree value, tree equivalence)
class uncprop_dom_walker : public dom_walker class uncprop_dom_walker : public dom_walker
{ {
public: public:
uncprop_dom_walker (cdi_direction direction) uncprop_dom_walker (cdi_direction direction) : dom_walker (direction) {}
: dom_walker (direction)
{
m_equiv_stack.create (2);
}
~uncprop_dom_walker ()
{
m_equiv_stack.release ();
}
virtual void before_dom_children (basic_block); virtual void before_dom_children (basic_block);
virtual void after_dom_children (basic_block); virtual void after_dom_children (basic_block);
@ -380,7 +372,7 @@ private:
leading to this block. If no such edge equivalency exists, then we leading to this block. If no such edge equivalency exists, then we
record NULL. These equivalences are live until we leave the dominator record NULL. These equivalences are live until we leave the dominator
subtree rooted at the block where we record the equivalency. */ subtree rooted at the block where we record the equivalency. */
vec<tree> m_equiv_stack; stack_vec<tree, 2> m_equiv_stack;
}; };
/* Main driver for un-cprop. */ /* Main driver for un-cprop. */

View File

@ -591,8 +591,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{ {
basic_block bb = loop->header; basic_block bb = loop->header;
tree init, step; tree init, step;
vec<gimple> worklist; stack_vec<gimple, 64> worklist;
worklist.create (64);
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
bool double_reduc; bool double_reduc;
@ -723,8 +722,6 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Unknown def-use cycle pattern.\n"); "Unknown def-use cycle pattern.\n");
} }
worklist.release ();
} }

View File

@ -3207,8 +3207,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
gimple_stmt_iterator si; gimple_stmt_iterator si;
unsigned int i, j; unsigned int i, j;
vect_recog_func_ptr vect_recog_func; vect_recog_func_ptr vect_recog_func;
vec<gimple> stmts_to_replace; stack_vec<gimple, 1> stmts_to_replace;
stmts_to_replace.create (1);
gimple stmt; gimple stmt;
if (dump_enabled_p ()) if (dump_enabled_p ())
@ -3248,6 +3247,4 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
} }
} }
} }
stmts_to_replace.release ();
} }

View File

@ -580,7 +580,6 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
bool bool
vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo) vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{ {
vec<gimple> worklist;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo); basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
unsigned int nbbs = loop->num_nodes; unsigned int nbbs = loop->num_nodes;
@ -598,7 +597,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_NOTE, vect_location, dump_printf_loc (MSG_NOTE, vect_location,
"=== vect_mark_stmts_to_be_vectorized ===\n"); "=== vect_mark_stmts_to_be_vectorized ===\n");
worklist.create (64); stack_vec<gimple, 64> worklist;
/* 1. Init worklist. */ /* 1. Init worklist. */
for (i = 0; i < nbbs; i++) for (i = 0; i < nbbs; i++)
@ -688,7 +687,6 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
if (dump_enabled_p ()) if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"unsupported use of reduction.\n"); "unsupported use of reduction.\n");
worklist.release ();
return false; return false;
} }
@ -704,7 +702,6 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"unsupported use of nested cycle.\n"); "unsupported use of nested cycle.\n");
worklist.release ();
return false; return false;
} }
@ -719,7 +716,6 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"unsupported use of double reduction.\n"); "unsupported use of double reduction.\n");
worklist.release ();
return false; return false;
} }
@ -747,10 +743,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
live_p, relevant, &worklist, false) live_p, relevant, &worklist, false)
|| !process_use (stmt, TREE_OPERAND (op, 1), loop_vinfo, || !process_use (stmt, TREE_OPERAND (op, 1), loop_vinfo,
live_p, relevant, &worklist, false)) live_p, relevant, &worklist, false))
{ return false;
worklist.release ();
return false;
}
i = 2; i = 2;
} }
for (; i < gimple_num_ops (stmt); i++) for (; i < gimple_num_ops (stmt); i++)
@ -758,10 +751,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
op = gimple_op (stmt, i); op = gimple_op (stmt, i);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant, if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
&worklist, false)) &worklist, false))
{ return false;
worklist.release ();
return false;
}
} }
} }
else if (is_gimple_call (stmt)) else if (is_gimple_call (stmt))
@ -771,10 +761,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
tree arg = gimple_call_arg (stmt, i); tree arg = gimple_call_arg (stmt, i);
if (!process_use (stmt, arg, loop_vinfo, live_p, relevant, if (!process_use (stmt, arg, loop_vinfo, live_p, relevant,
&worklist, false)) &worklist, false))
{ return false;
worklist.release ();
return false;
}
} }
} }
} }
@ -784,10 +771,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
tree op = USE_FROM_PTR (use_p); tree op = USE_FROM_PTR (use_p);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant, if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
&worklist, false)) &worklist, false))
{ return false;
worklist.release ();
return false;
}
} }
if (STMT_VINFO_GATHER_P (stmt_vinfo)) if (STMT_VINFO_GATHER_P (stmt_vinfo))
@ -797,14 +781,10 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
gcc_assert (decl); gcc_assert (decl);
if (!process_use (stmt, off, loop_vinfo, live_p, relevant, if (!process_use (stmt, off, loop_vinfo, live_p, relevant,
&worklist, true)) &worklist, true))
{ return false;
worklist.release ();
return false;
}
} }
} /* while worklist */ } /* while worklist */
worklist.release ();
return true; return true;
} }
@ -5552,11 +5532,9 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
{ {
if (slp_node) if (slp_node)
{ {
vec<tree> ops; stack_vec<tree, 4> ops;
ops.create (4); stack_vec<vec<tree>, 4> vec_defs;
vec<vec<tree> > vec_defs;
vec_defs.create (4);
ops.safe_push (TREE_OPERAND (cond_expr, 0)); ops.safe_push (TREE_OPERAND (cond_expr, 0));
ops.safe_push (TREE_OPERAND (cond_expr, 1)); ops.safe_push (TREE_OPERAND (cond_expr, 1));
ops.safe_push (then_clause); ops.safe_push (then_clause);