From: Trevor Saunders <tsaunders@mozilla.com>
To: Diego Novillo <dnovillo@google.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] use stack vectors more
Date: Fri, 01 Nov 2013 19:33:00 -0000 [thread overview]
Message-ID: <20131101193337.GA2102@tsaunders-iceball.corp.tor1.mozilla.com> (raw)
In-Reply-To: <CAD_=9DTY6Qy_n_SH1doeyA8Zzjo5+ERNKPDoREYE=05nKrb=uQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
> The patch is OK, but it did not completely apply in my tree. Mind
> sending an updated version (or point me at a git repo I can pull it
> from).
interesting, I just pulled and rebased it onto r204296 without any manual
merging. Patch against r204296 attached (obviously haven't tested it
against that rev yet).
Trev
>
>
> Thanks. Diego.
[-- Attachment #2: 0001-use-stack-vectors-more.patch --]
[-- Type: text/x-diff, Size: 30611 bytes --]
From 3e9b030811d3ff4f5605227171d33561ce59453e Mon Sep 17 00:00:00 2001
From: Trevor Saunders <tsaunders@mozilla.com>
Date: Wed, 9 Oct 2013 14:19:29 -0400
Subject: [PATCH] use stack vectors more
---
gcc/cp/semantics.c | 4 +---
gcc/function.c | 5 +----
gcc/gimplify.c | 3 +--
gcc/graphite-clast-to-gimple.c | 4 +---
gcc/graphite-dependences.c | 4 +---
gcc/graphite-scop-detection.c | 20 ++++++--------------
gcc/graphite-sese-to-poly.c | 39 ++++++++-------------------------------
gcc/hw-doloop.c | 5 +----
gcc/tree-call-cdce.c | 14 +++-----------
gcc/tree-dfa.c | 4 +---
gcc/tree-if-conv.c | 3 +--
gcc/tree-inline.c | 4 +---
gcc/tree-loop-distribution.c | 18 ++++--------------
gcc/tree-parloops.c | 15 ++++-----------
gcc/tree-predcom.c | 6 ++----
gcc/tree-ssa-phiopt.c | 14 +-------------
gcc/tree-ssa-uncprop.c | 12 ++----------
gcc/tree-vect-loop.c | 5 +----
gcc/tree-vect-patterns.c | 5 +----
gcc/tree-vect-stmts.c | 38 ++++++++------------------------------
20 files changed, 49 insertions(+), 173 deletions(-)
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6c560c6..366756f 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -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
previously built CONSTRUCTORs if this is, say, the second field in an
anonymous struct. So we use a vec as a stack. */
- vec<tree> fields;
- fields.create (2);
+ stack_vec<tree, 2> fields;
do
{
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
aggregate. Add its initializer to the CONSTRUCTOR and we're done. */
gcc_assert (fields.is_empty());
- fields.release ();
CONSTRUCTOR_APPEND_ELT (*vec, field, init);
return true;
diff --git a/gcc/function.c b/gcc/function.c
index eb8aca9..21ab691 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4128,12 +4128,11 @@ void
reorder_blocks (void)
{
tree block = DECL_INITIAL (current_function_decl);
- vec<tree> block_stack;
if (block == NULL_TREE)
return;
- block_stack.create (10);
+ stack_vec<tree, 10> block_stack;
/* Reset the TREE_ASM_WRITTEN bit for all blocks. */
clear_block_marks (block);
@@ -4145,8 +4144,6 @@ reorder_blocks (void)
/* Recreate the block tree from the note nesting. */
reorder_blocks_1 (get_insns (), block, &block_stack);
BLOCK_SUBBLOCKS (block) = blocks_nreverse_all (BLOCK_SUBBLOCKS (block));
-
- block_stack.release ();
}
/* Helper function for reorder_blocks. Reset TREE_ASM_WRITTEN. */
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 1f18466..0723027 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2142,7 +2142,6 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
fallback_t fallback)
{
tree *p;
- vec<tree> expr_stack;
enum gimplify_status ret = GS_ALL_DONE, tret;
int i;
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
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. */
for (p = expr_p; ; p = &TREE_OPERAND (*p, 0))
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 04c23c5..ec4c1d1 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1652,8 +1652,7 @@ debug_generated_program (scop_p scop)
bool
gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping)
{
- vec<tree> newivs;
- newivs.create (10);
+ stack_vec<tree, 10> newivs;
loop_p context_loop;
sese region = SCOP_REGION (scop);
ifsese if_region = NULL;
@@ -1711,7 +1710,6 @@ gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping)
newivs_index.dispose ();
params_index.dispose ();
- newivs.release ();
cloog_clast_free (clast);
timevar_pop (TV_GRAPHITE_CODE_GEN);
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 545881b..417ea2c 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -585,13 +585,11 @@ loop_is_parallel_p (loop_p loop, bb_pbb_htab_type bb_pbb_mapping, int depth)
{
bool dependences;
scop_p scop;
- vec<poly_bb_p> body;
- body.create (3);
timevar_push (TV_GRAPHITE_DATA_DEPS);
+ stack_vec<poly_bb_p, 3> body;
scop = get_loop_body_pbbs (loop, bb_pbb_mapping, &body);
dependences = loop_level_carries_dependences (scop, body, depth);
- body.release ();
timevar_pop (TV_GRAPHITE_DATA_DEPS);
return !dependences;
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 38fe92b..e73a349 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -475,8 +475,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
case GBB_LOOP_SING_EXIT_HEADER:
{
- vec<sd_region> regions;
- regions.create (3);
+ stack_vec<sd_region, 3> regions;
struct scopdet_info sinfo;
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
exits lead to the same bb it may be possible to join the loop. */
- vec<sd_region> regions;
- regions.create (3);
+ stack_vec<sd_region, 3> regions;
vec<edge> exits = get_loop_exit_edges (loop);
edge e;
int i;
@@ -585,8 +583,7 @@ scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
}
case GBB_COND_HEADER:
{
- vec<sd_region> regions;
- regions.create (3);
+ stack_vec<sd_region, 3> regions;
struct scopdet_info sinfo;
vec<basic_block> dominated;
int i;
@@ -1189,8 +1186,7 @@ print_graphite_statistics (FILE* file, vec<scop_p> scops)
static void
limit_scops (vec<scop_p> *scops)
{
- vec<sd_region> regions;
- regions.create (3);
+ stack_vec<sd_region, 3> regions;
int i;
scop_p scop;
@@ -1225,7 +1221,6 @@ limit_scops (vec<scop_p> *scops)
create_sese_edges (regions);
build_graphite_scops (regions, scops);
- regions.release ();
}
/* Returns true when P1 and P2 are close phis with the same
@@ -1404,8 +1399,7 @@ void
build_scops (vec<scop_p> *scops)
{
struct loop *loop = current_loops->tree_root;
- vec<sd_region> regions;
- regions.create (3);
+ stack_vec<sd_region, 3> regions;
canonicalize_loop_closed_ssa_form ();
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
dot_scop (scop_p scop)
{
- vec<scop_p> scops = vNULL;
+ stack_vec<scop_p, 1> scops;
if (scop)
scops.safe_push (scop);
@@ -1615,8 +1609,6 @@ dot_scop (scop_p scop)
#else
dot_all_scops_1 (stderr, scops);
#endif
-
- scops.release ();
}
#endif
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 7d4796e..6c2ac41 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1231,27 +1231,18 @@ class sese_dom_walker : public dom_walker
{
public:
sese_dom_walker (cdi_direction, sese);
- ~sese_dom_walker ();
virtual void before_dom_children (basic_block);
virtual void after_dom_children (basic_block);
private:
- vec<gimple> m_conditions, m_cases;
+ stack_vec<gimple, 3> m_conditions, m_cases;
sese m_region;
};
sese_dom_walker::sese_dom_walker (cdi_direction direction, sese 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
@@ -1890,8 +1881,7 @@ build_scop_drs (scop_p scop)
int i, j;
poly_bb_p pbb;
data_reference_p dr;
- vec<data_reference_p> drs;
- drs.create (3);
+ stack_vec<data_reference_p, 3> drs;
/* Remove all the PBBs that do not have data references: these basic
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 gsi;
- vec<gimple> x;
- x.create (3);
+ stack_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
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);
analyze_drs_in_stmts (scop, gsi_bb (insert_gsi), x);
- x.release ();
}
/* 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;
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (unshare_expr (res), var);
- vec<gimple> x;
- x.create (3);
+ stack_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
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);
- x.release ();
}
/* 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);
gimple stmt = gimple_build_assign (unshare_expr (res), var);
basic_block bb;
- vec<gimple> x;
- x.create (3);
+ stack_vec<gimple, 3> x;
gimple_seq_add_stmt (&stmts, stmt);
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);
analyze_drs_in_stmts (scop, bb, x);
- x.release ();
}
/* Creates a zero dimension array of the same type as VAR. */
@@ -2881,8 +2865,7 @@ remove_phi (gimple phi)
tree def;
use_operand_p use_p;
gimple_stmt_iterator gsi;
- vec<gimple> update;
- update.create (3);
+ stack_vec<gimple, 3> update;
unsigned int i;
gimple stmt;
@@ -2901,8 +2884,6 @@ remove_phi (gimple phi)
FOR_EACH_VEC_ELT (update, i, stmt)
update_stmt (stmt);
- update.release ();
-
gsi = gsi_for_phi_node (phi);
remove_phi_node (&gsi, false);
}
@@ -3042,18 +3023,14 @@ rewrite_commutative_reductions_out_of_ssa_close_phi (scop_p scop,
gimple close_phi)
{
bool res;
- vec<gimple> in;
- in.create (10);
- vec<gimple> out;
- out.create (10);
+ stack_vec<gimple, 10> in;
+ stack_vec<gimple, 10> out;
detect_commutative_reduction (scop, close_phi, &in, &out);
res = in.length () > 1;
if (res)
translate_scalar_reduction_to_array (scop, in, out);
- in.release ();
- out.release ();
return res;
}
diff --git a/gcc/hw-doloop.c b/gcc/hw-doloop.c
index 9b59f5d..5d26638 100644
--- a/gcc/hw-doloop.c
+++ b/gcc/hw-doloop.c
@@ -237,7 +237,6 @@ discover_loop (hwloop_info loop, basic_block tail_bb, rtx tail_insn, rtx reg)
bool found_tail;
unsigned dwork = 0;
basic_block bb;
- vec<basic_block> works;
loop->tail = tail_bb;
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->successor = FALLTHRU_EDGE (tail_bb)->dest;
- works.create (20);
+ stack_vec<basic_block, 20> works;
works.safe_push (loop->head);
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
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 578b211..eec1b0fb 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -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;
edge join_tgt_in_edge_from_call, join_tgt_in_edge_fall_thru;
edge bi_call_in_edge0, guard_bb_in_edge;
- vec<gimple> conds;
unsigned tn_cond_stmts, nconds;
unsigned ci;
gimple cond_expr = NULL;
@@ -721,7 +720,7 @@ shrink_wrap_one_built_in_call (gimple bi_call)
tree bi_call_label_decl;
gimple bi_call_label;
- conds.create (12);
+ stack_vec<gimple, 12> conds;
gen_shrink_wrap_conditions (bi_call, conds, &nconds);
/* 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
the call. */
if (nconds == 0)
- {
- conds.release ();
- return false;
- }
+ return false;
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. */
join_tgt_in_edge_from_call = find_fallthru_edge (bi_call_bb->succs);
if (join_tgt_in_edge_from_call == NULL)
- {
- conds.release ();
- return false;
- }
+ return false;
}
else
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;
}
- conds.release ();
if (dump_file && (dump_flags & TDF_DETAILS))
{
location_t loc;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 238438e..a44cfe8 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -743,8 +743,7 @@ dump_enumerated_decls (FILE *file, int flags)
{
basic_block bb;
struct walk_stmt_info wi;
- vec<numbered_tree> decl_list;
- decl_list.create (40);
+ stack_vec<numbered_tree, 40> decl_list;
memset (&wi, '\0', sizeof (wi));
wi.info = (void *) &decl_list;
@@ -775,5 +774,4 @@ dump_enumerated_decls (FILE *file, int flags)
last = ntp->t;
}
}
- decl_list.release ();
}
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index feb51de..31994b7 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -1165,7 +1165,6 @@ if_convertible_loop_p (struct loop *loop)
bool res = false;
vec<data_reference_p> refs;
vec<ddr_p> ddrs;
- vec<loop_p> loop_nest;
/* Handle only innermost loop. */
if (!loop || loop->inner)
@@ -1199,7 +1198,7 @@ if_convertible_loop_p (struct loop *loop)
refs.create (5);
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);
if (flag_tree_loop_if_convert_stores)
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 74f333b..77013b3 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -5187,8 +5187,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
unsigned i;
struct ipa_replace_map *replace_info;
basic_block old_entry_block, bb;
- vec<gimple> init_stmts;
- init_stmts.create (10);
+ stack_vec<gimple, 10> init_stmts;
tree vars = NULL_TREE;
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);
gcc_assert (!id.debug_stmts.exists ());
- init_stmts.release ();
pop_cfun ();
return;
}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 353ce24..79884bf 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -436,17 +436,15 @@ static struct graph *
build_rdg (vec<loop_p> loop_nest, control_dependences *cd)
{
struct graph *rdg;
- vec<gimple> stmts;
vec<data_reference_p> datarefs;
/* 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);
rdg = new_graph (stmts.length ());
datarefs.create (10);
if (!create_rdg_vertices (rdg, stmts, loop_nest[0], &datarefs))
{
- stmts.release ();
datarefs.release ();
free_rdg (rdg);
return NULL;
@@ -951,11 +949,10 @@ static partition_t
build_rdg_partition_for_vertex (struct graph *rdg, int v)
{
partition_t partition = partition_alloc (NULL, NULL);
- vec<int> nodes;
+ stack_vec<int, 3> nodes;
unsigned i;
int x;
- nodes.create (3);
graphds_dfs (rdg, &v, 1, &nodes, false, NULL);
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);
}
- nodes.release ();
return partition;
}
@@ -1388,7 +1384,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
control_dependences *cd, int *nb_calls)
{
struct graph *rdg;
- vec<loop_p> loop_nest;
vec<partition_t> partitions;
partition_t partition;
bool any_builtin;
@@ -1397,12 +1392,9 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
int num_sccs = 1;
*nb_calls = 0;
- loop_nest.create (3);
+ stack_vec<loop_p, 3> loop_nest;
if (!find_loop_nest (loop, &loop_nest))
- {
- loop_nest.release ();
- return 0;
- }
+ return 0;
rdg = build_rdg (loop_nest, cd);
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->num);
- loop_nest.release ();
return 0;
}
@@ -1648,7 +1639,6 @@ distribute_loop (struct loop *loop, vec<gimple> stmts,
partitions.release ();
free_rdg (rdg);
- loop_nest.release ();
return nbp - *nb_calls;
}
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index b843fe5..25a0f0a 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -395,7 +395,6 @@ lambda_transform_legal_p (lambda_trans_matrix trans,
static bool
loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack)
{
- vec<loop_p> loop_nest;
vec<ddr_p> dependence_relations;
vec<data_reference_p> datarefs;
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,
the iterations are independent. */
+ stack_vec<loop_p, 3> loop_nest;
datarefs.create (10);
- dependence_relations.create (10 * 10);
- loop_nest.create (3);
+ dependence_relations.create (100);
if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
&dependence_relations))
{
@@ -440,7 +439,6 @@ loop_parallel_p (struct loop *loop, struct obstack * parloop_obstack)
" FAILED: data dependencies exist across iterations\n");
end:
- loop_nest.release ();
free_dependence_relations (dependence_relations);
free_data_refs (datarefs);
@@ -741,8 +739,7 @@ static void
eliminate_local_variables (edge entry, edge exit)
{
basic_block bb;
- vec<basic_block> body;
- body.create (3);
+ stack_vec<basic_block, 3> body;
unsigned i;
gimple_stmt_iterator gsi;
bool has_debug_stmt = false;
@@ -772,7 +769,6 @@ eliminate_local_variables (edge entry, edge exit)
eliminate_local_variables_stmt (entry, &gsi, decl_address);
decl_address.dispose ();
- body.release ();
}
/* 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;
gimple_stmt_iterator gsi;
struct clsn_data clsn_data;
- vec<basic_block> body;
- body.create (3);
+ stack_vec<basic_block, 3> body;
basic_block bb;
basic_block entry_bb = bb1;
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)
{
/* It may happen that there is nothing to copy (if there are only
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 4eead11..1005e78 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -2421,7 +2421,6 @@ prepare_initializers (struct loop *loop, vec<chain_p> chains)
static bool
tree_predictive_commoning_loop (struct loop *loop)
{
- vec<loop_p> loop_nest;
vec<data_reference_p> datarefs;
vec<ddr_p> dependences;
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
dependence relations. */
- datarefs.create (10);
+ stack_vec<loop_p, 3> loop_nest;
dependences.create (10);
- loop_nest.create (3);
+ datarefs.create (10);
if (! compute_data_dependences_for_loop (loop, true, &loop_nest, &datarefs,
&dependences))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Cannot analyze data dependencies\n");
- loop_nest.release ();
free_data_refs (datarefs);
free_dependence_relations (dependences);
return false;
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 87aa28c..ef114a0 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -1680,7 +1680,6 @@ cond_if_else_store_replacement (basic_block then_bb, basic_block else_bb,
data_reference_p then_dr, else_dr;
int i, j;
tree then_lhs, else_lhs;
- vec<gimple> then_stores, else_stores;
basic_block blocks[3];
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. */
- then_stores.create (1);
- else_stores.create (1);
+ stack_vec<gimple, 1> then_stores, else_stores;
FOR_EACH_VEC_ELT (then_datarefs, i, 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 (else_datarefs);
- then_stores.release ();
- else_stores.release ();
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_data_refs (then_datarefs);
free_data_refs (else_datarefs);
- then_stores.release ();
- else_stores.release ();
return false;
}
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_data_refs (then_datarefs);
free_data_refs (else_datarefs);
- then_stores.release ();
- else_stores.release ();
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_data_refs (then_datarefs);
free_data_refs (else_datarefs);
- then_stores.release ();
- else_stores.release ();
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_data_refs (then_datarefs);
free_data_refs (else_datarefs);
- then_stores.release ();
- else_stores.release ();
return ok;
}
diff --git a/gcc/tree-ssa-uncprop.c b/gcc/tree-ssa-uncprop.c
index 71c1f5d..5255d7fb 100644
--- a/gcc/tree-ssa-uncprop.c
+++ b/gcc/tree-ssa-uncprop.c
@@ -361,15 +361,7 @@ record_equiv (tree value, tree equivalence)
class uncprop_dom_walker : public dom_walker
{
public:
- uncprop_dom_walker (cdi_direction direction)
- : dom_walker (direction)
- {
- m_equiv_stack.create (2);
- }
- ~uncprop_dom_walker ()
- {
- m_equiv_stack.release ();
- }
+ uncprop_dom_walker (cdi_direction direction) : dom_walker (direction) {}
virtual void before_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
record NULL. These equivalences are live until we leave the dominator
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. */
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 1da87c7..d5f86ad 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -591,8 +591,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
{
basic_block bb = loop->header;
tree init, step;
- vec<gimple> worklist;
- worklist.create (64);
+ stack_vec<gimple, 64> worklist;
gimple_stmt_iterator gsi;
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,
"Unknown def-use cycle pattern.\n");
}
-
- worklist.release ();
}
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 8d9aaa2..0998804 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -3207,8 +3207,7 @@ vect_pattern_recog (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo)
gimple_stmt_iterator si;
unsigned int i, j;
vect_recog_func_ptr vect_recog_func;
- vec<gimple> stmts_to_replace;
- stmts_to_replace.create (1);
+ stack_vec<gimple, 1> stmts_to_replace;
gimple stmt;
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 ();
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 9516e76..c1ba3c7 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -580,7 +580,6 @@ process_use (gimple stmt, tree use, loop_vec_info loop_vinfo, bool live_p,
bool
vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
{
- vec<gimple> worklist;
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
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,
"=== vect_mark_stmts_to_be_vectorized ===\n");
- worklist.create (64);
+ stack_vec<gimple, 64> worklist;
/* 1. Init worklist. */
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 ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"unsupported use of reduction.\n");
- worklist.release ();
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,
"unsupported use of nested cycle.\n");
- worklist.release ();
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,
"unsupported use of double reduction.\n");
- worklist.release ();
return false;
}
@@ -747,10 +743,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
live_p, relevant, &worklist, false)
|| !process_use (stmt, TREE_OPERAND (op, 1), loop_vinfo,
live_p, relevant, &worklist, false))
- {
- worklist.release ();
- return false;
- }
+ return false;
i = 2;
}
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);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
&worklist, false))
- {
- worklist.release ();
- return false;
- }
+ return false;
}
}
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);
if (!process_use (stmt, arg, loop_vinfo, live_p, relevant,
&worklist, false))
- {
- worklist.release ();
- return false;
- }
+ return false;
}
}
}
@@ -784,10 +771,7 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
tree op = USE_FROM_PTR (use_p);
if (!process_use (stmt, op, loop_vinfo, live_p, relevant,
&worklist, false))
- {
- worklist.release ();
- return false;
- }
+ return false;
}
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);
if (!process_use (stmt, off, loop_vinfo, live_p, relevant,
&worklist, true))
- {
- worklist.release ();
- return false;
- }
+ return false;
}
} /* while worklist */
- worklist.release ();
return true;
}
@@ -5552,11 +5532,9 @@ vectorizable_condition (gimple stmt, gimple_stmt_iterator *gsi,
{
if (slp_node)
{
- vec<tree> ops;
- ops.create (4);
- vec<vec<tree> > vec_defs;
+ stack_vec<tree, 4> ops;
+ stack_vec<vec<tree>, 4> vec_defs;
- vec_defs.create (4);
ops.safe_push (TREE_OPERAND (cond_expr, 0));
ops.safe_push (TREE_OPERAND (cond_expr, 1));
ops.safe_push (then_clause);
--
1.8.4.2
next prev parent reply other threads:[~2013-11-01 19:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1383263300-10532-1-git-send-email-tsaunders@mozilla.com>
2013-11-01 19:17 ` Diego Novillo
2013-11-01 19:33 ` Trevor Saunders [this message]
2013-11-01 19:51 ` Diego Novillo
2013-11-01 20:32 ` Diego Novillo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131101193337.GA2102@tsaunders-iceball.corp.tor1.mozilla.com \
--to=tsaunders@mozilla.com \
--cc=dnovillo@google.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).