summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-13 02:44:52 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-13 02:44:52 +0000
commite9258aee374f252f55be61f28bfac65006f73d41 (patch)
treeb23b2bc969495367f8ea5f18416b898c1494be56
parent8749fe3bf751d6cd152dd343f24a849cdcb0af57 (diff)
downloadgcc-e9258aee374f252f55be61f28bfac65006f73d41.tar.gz
use auto_vec for more local variables
gcc/c/ChangeLog: 2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * c-parser.c (c_parser_generic_selection): Make type of variable auto_vec. (c_parser_omp_declare_simd): Likewise. gcc/ChangeLog: 2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> * cfgexpand.c (expand_used_vars): Make the type of a local variable auto_vec. * genmatch.c (lower_for): Likewise. * haifa-sched.c (haifa_sched_init): Likewise. (add_to_speculative_block): Likewise. (create_check_block_twin): Likewise. * predict.c (handle_missing_profiles): Likewise. * tree-data-ref.c (loop_nest_has_data_refs): Likewise. * tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Likewise. * tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise. (maybe_lower_iteration_bound): Likewise. * tree-ssa-sccvn.c (DFS): Likewise. * tree-stdarg.c (reachable_at_most_once): Likewise. * tree-vect-stmts.c (vectorizable_conversion): Likewise. (vectorizable_store): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238285 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-parser.c22
-rw-r--r--gcc/cfgexpand.c3
-rw-r--r--gcc/genmatch.c12
-rw-r--r--gcc/haifa-sched.c15
-rw-r--r--gcc/predict.c4
-rw-r--r--gcc/tree-data-ref.c5
-rw-r--r--gcc/tree-diagnostic.c4
-rw-r--r--gcc/tree-ssa-loop-niter.c6
-rw-r--r--gcc/tree-ssa-sccvn.c16
-rw-r--r--gcc/tree-stdarg.c3
-rw-r--r--gcc/tree-vect-stmts.c8
13 files changed, 50 insertions, 71 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a488fd861dd..3a1fc40628a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,22 @@
2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+ * cfgexpand.c (expand_used_vars): Make the type of a local variable auto_vec.
+ * genmatch.c (lower_for): Likewise.
+ * haifa-sched.c (haifa_sched_init): Likewise.
+ (add_to_speculative_block): Likewise.
+ (create_check_block_twin): Likewise.
+ * predict.c (handle_missing_profiles): Likewise.
+ * tree-data-ref.c (loop_nest_has_data_refs): Likewise.
+ * tree-diagnostic.c (maybe_unwind_expanded_macro_loc): Likewise.
+ * tree-ssa-loop-niter.c (discover_iteration_bound_by_body_walk): Likewise.
+ (maybe_lower_iteration_bound): Likewise.
+ * tree-ssa-sccvn.c (DFS): Likewise.
+ * tree-stdarg.c (reachable_at_most_once): Likewise.
+ * tree-vect-stmts.c (vectorizable_conversion): Likewise.
+ (vectorizable_store): Likewise.
+
+2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
* tree-ssa-sccvn.c (sccvn_dom_walker::~sccvn_dom_walker): remove.
(sccvn_dom_walker): make cond_stack an auto_vec.
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 59b296c857a..96dbf6b922c 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,11 @@
2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+ * c-parser.c (c_parser_generic_selection): Make type of variable
+ auto_vec.
+ (c_parser_omp_declare_simd): Likewise.
+
+2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
* c-decl.c (struct c_struct_parse_info): Change member types
from vec to auto_vec.
(start_struct): Adjust.
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 1a50dea228b..8fb4e4dd14f 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -7243,7 +7243,6 @@ struct c_generic_association
static struct c_expr
c_parser_generic_selection (c_parser *parser)
{
- vec<c_generic_association> associations = vNULL;
struct c_expr selector, error_expr;
tree selector_type;
struct c_generic_association matched_assoc;
@@ -7300,6 +7299,7 @@ c_parser_generic_selection (c_parser *parser)
return error_expr;
}
+ auto_vec<c_generic_association> associations;
while (1)
{
struct c_generic_association assoc, *iter;
@@ -7320,13 +7320,13 @@ c_parser_generic_selection (c_parser *parser)
if (type_name == NULL)
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
- goto error_exit;
+ return error_expr;
}
assoc.type = groktypename (type_name, NULL, NULL);
if (assoc.type == error_mark_node)
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
- goto error_exit;
+ return error_expr;
}
if (TREE_CODE (assoc.type) == FUNCTION_TYPE)
@@ -7345,14 +7345,14 @@ c_parser_generic_selection (c_parser *parser)
if (!c_parser_require (parser, CPP_COLON, "expected %<:%>"))
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
- goto error_exit;
+ return error_expr;
}
assoc.expression = c_parser_expr_no_commas (parser, NULL);
if (assoc.expression.value == error_mark_node)
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
- goto error_exit;
+ return error_expr;
}
for (ix = 0; associations.iterate (ix, &iter); ++ix)
@@ -7408,8 +7408,6 @@ c_parser_generic_selection (c_parser *parser)
c_parser_consume_token (parser);
}
- associations.release ();
-
if (!c_parser_require (parser, CPP_CLOSE_PAREN, "expected %<)%>"))
{
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, NULL);
@@ -7425,10 +7423,6 @@ c_parser_generic_selection (c_parser *parser)
}
return matched_assoc.expression;
-
- error_exit:
- associations.release ();
- return error_expr;
}
/* Parse a postfix expression (C90 6.3.1-6.3.2, C99 6.5.1-6.5.2).
@@ -16366,14 +16360,13 @@ check_clauses:
static void
c_parser_omp_declare_simd (c_parser *parser, enum pragma_context context)
{
- vec<c_token> clauses = vNULL;
+ auto_vec<c_token> clauses;
while (c_parser_next_token_is_not (parser, CPP_PRAGMA_EOL))
{
c_token *token = c_parser_peek_token (parser);
if (token->type == CPP_EOF)
{
c_parser_skip_to_pragma_eol (parser);
- clauses.release ();
return;
}
clauses.safe_push (*token);
@@ -16395,7 +16388,6 @@ c_parser_omp_declare_simd (c_parser *parser, enum pragma_context context)
"%<#pragma omp declare simd%> must be followed by "
"function declaration or definition or another "
"%<#pragma omp declare simd%>");
- clauses.release ();
return;
}
c_parser_consume_pragma (parser);
@@ -16405,7 +16397,6 @@ c_parser_omp_declare_simd (c_parser *parser, enum pragma_context context)
if (token->type == CPP_EOF)
{
c_parser_skip_to_pragma_eol (parser);
- clauses.release ();
return;
}
clauses.safe_push (*token);
@@ -16477,7 +16468,6 @@ c_parser_omp_declare_simd (c_parser *parser, enum pragma_context context)
default:
gcc_unreachable ();
}
- clauses.release ();
}
/* Finalize #pragma omp declare simd clauses after FNDECL has been parsed,
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 93df01bd758..984ac4a0f22 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2012,7 +2012,7 @@ static rtx_insn *
expand_used_vars (void)
{
tree var, outer_block = DECL_INITIAL (current_function_decl);
- vec<tree> maybe_local_decls = vNULL;
+ auto_vec<tree> maybe_local_decls;
rtx_insn *var_end_seq = NULL;
unsigned i;
unsigned len;
@@ -2253,7 +2253,6 @@ expand_used_vars (void)
if (rtl && (MEM_P (rtl) || GET_CODE (rtl) == CONCAT))
add_local_decl (cfun, var);
}
- maybe_local_decls.release ();
/* If the target requires that FRAME_OFFSET be aligned, do it. */
if (STACK_ALIGNMENT_NEEDED)
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index f5aa29b72f5..02e945af71d 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -1416,8 +1416,7 @@ lower_for (simplify *sin, vec<simplify *>& simplifiers)
{
operand *match_op = s->match;
operand *result_op = s->result;
- vec<std::pair<user_id *, id_base *> > subst;
- subst.create (n_ids);
+ auto_vec<std::pair<user_id *, id_base *> > subst (n_ids);
bool skip = false;
for (unsigned i = 0; i < n_ids; ++i)
{
@@ -1437,18 +1436,15 @@ lower_for (simplify *sin, vec<simplify *>& simplifiers)
result_op = replace_id (result_op, id, oper);
}
if (skip)
- {
- subst.release ();
- continue;
- }
+ continue;
+
simplify *ns = new simplify (s->kind, match_op, result_op,
vNULL, s->capture_ids);
ns->for_subst_vec.safe_splice (s->for_subst_vec);
if (result_op
&& can_delay_subst)
ns->for_subst_vec.safe_splice (subst);
- else
- subst.release ();
+
worklist.safe_push (ns);
}
}
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 1f1e763ae36..95035762915 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -7416,20 +7416,16 @@ haifa_sched_init (void)
/* Initialize luids, dependency caches, target and h_i_d for the
whole function. */
{
- bb_vec_t bbs;
- bbs.create (n_basic_blocks_for_fn (cfun));
- basic_block bb;
-
sched_init_bbs ();
+ auto_vec<basic_block> bbs (n_basic_blocks_for_fn (cfun));
+ basic_block bb;
FOR_EACH_BB_FN (bb, cfun)
bbs.quick_push (bb);
sched_init_luids (bbs);
sched_deps_init (true);
sched_extend_target ();
haifa_init_h_i_d (bbs);
-
- bbs.release ();
}
sched_init_only_bb = haifa_init_only_bb;
@@ -7996,7 +7992,6 @@ add_to_speculative_block (rtx_insn *insn)
sd_iterator_def sd_it;
dep_t dep;
rtx_insn_list *twins = NULL;
- rtx_vec_t priorities_roots;
ts = TODO_SPEC (insn);
gcc_assert (!(ts & ~BE_IN_SPEC));
@@ -8029,7 +8024,7 @@ add_to_speculative_block (rtx_insn *insn)
sd_iterator_next (&sd_it);
}
- priorities_roots.create (0);
+ auto_vec<rtx_insn *> priorities_roots;
clear_priorities (insn, &priorities_roots);
while (1)
@@ -8124,7 +8119,6 @@ add_to_speculative_block (rtx_insn *insn)
}
calc_priorities (priorities_roots);
- priorities_roots.release ();
}
/* Extends and fills with zeros (only the new part) array pointed to by P. */
@@ -8620,11 +8614,10 @@ create_check_block_twin (rtx_insn *insn, bool mutate_p)
/* Fix priorities. If MUTATE_P is nonzero, this is not necessary,
because it'll be done later in add_to_speculative_block. */
{
- rtx_vec_t priorities_roots = rtx_vec_t ();
+ auto_vec<rtx_insn *> priorities_roots;
clear_priorities (twin, &priorities_roots);
calc_priorities (priorities_roots);
- priorities_roots.release ();
}
}
diff --git a/gcc/predict.c b/gcc/predict.c
index 66a88ab70bf..7fbd404de2e 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -3149,8 +3149,7 @@ handle_missing_profiles (void)
{
struct cgraph_node *node;
int unlikely_count_fraction = PARAM_VALUE (UNLIKELY_BB_COUNT_FRACTION);
- vec<struct cgraph_node *> worklist;
- worklist.create (64);
+ auto_vec<struct cgraph_node *, 64> worklist;
/* See if 0 count function has non-0 count callers. In this case we
lost some profile. Drop its function profile to PROFILE_GUESSED. */
@@ -3207,7 +3206,6 @@ handle_missing_profiles (void)
}
}
}
- worklist.release ();
}
/* Convert counts measured by profile driven feedback to frequencies.
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 522ac2c4dc6..44d5db0026d 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -3942,8 +3942,7 @@ bool
loop_nest_has_data_refs (loop_p loop)
{
basic_block *bbs = get_loop_body (loop);
- vec<data_ref_loc> references;
- references.create (3);
+ auto_vec<data_ref_loc, 3> references;
for (unsigned i = 0; i < loop->num_nodes; i++)
{
@@ -3957,13 +3956,11 @@ loop_nest_has_data_refs (loop_p loop)
if (references.length ())
{
free (bbs);
- references.release ();
return true;
}
}
}
free (bbs);
- references.release ();
if (loop->inner)
{
diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c
index 5377ec21a41..234d0fd0bc9 100644
--- a/gcc/tree-diagnostic.c
+++ b/gcc/tree-diagnostic.c
@@ -102,7 +102,7 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
source_location where)
{
const struct line_map *map;
- vec<loc_map_pair> loc_vec = vNULL;
+ auto_vec<loc_map_pair> loc_vec;
unsigned ix;
loc_map_pair loc, *iter;
@@ -219,8 +219,6 @@ maybe_unwind_expanded_macro_loc (diagnostic_context *context,
"in expansion of macro %qs",
linemap_map_get_macro_name (iter->map));
}
-
- loc_vec.release ();
}
/* This is a diagnostic finalizer implementation that is aware of
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index 0723752fbdc..732e06a3553 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -3438,7 +3438,7 @@ static void
discover_iteration_bound_by_body_walk (struct loop *loop)
{
struct nb_iter_bound *elt;
- vec<widest_int> bounds = vNULL;
+ auto_vec<widest_int> bounds;
vec<vec<basic_block> > queues = vNULL;
vec<basic_block> queue = vNULL;
ptrdiff_t queue_index;
@@ -3593,7 +3593,6 @@ discover_iteration_bound_by_body_walk (struct loop *loop)
}
queues.release ();
- bounds.release ();
}
/* See if every path cross the loop goes through a statement that is known
@@ -3606,7 +3605,7 @@ maybe_lower_iteration_bound (struct loop *loop)
hash_set<gimple *> *not_executed_last_iteration = NULL;
struct nb_iter_bound *elt;
bool found_exit = false;
- vec<basic_block> queue = vNULL;
+ auto_vec<basic_block> queue;
bitmap visited;
/* Collect all statements with interesting (i.e. lower than
@@ -3698,7 +3697,6 @@ maybe_lower_iteration_bound (struct loop *loop)
}
BITMAP_FREE (visited);
- queue.release ();
delete not_executed_last_iteration;
}
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 9bcbe52a298..9427bfc6062 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4120,8 +4120,8 @@ extract_and_process_scc_for_name (tree name)
static bool
DFS (tree name)
{
- vec<ssa_op_iter> itervec = vNULL;
- vec<tree> namevec = vNULL;
+ auto_vec<ssa_op_iter> itervec;
+ auto_vec<tree> namevec;
use_operand_p usep = NULL;
gimple *defstmt;
tree use;
@@ -4158,19 +4158,11 @@ start_over:
/* See if we found an SCC. */
if (VN_INFO (name)->low == VN_INFO (name)->dfsnum)
if (!extract_and_process_scc_for_name (name))
- {
- namevec.release ();
- itervec.release ();
- return false;
- }
+ return false;
/* Check if we are done. */
if (namevec.is_empty ())
- {
- namevec.release ();
- itervec.release ();
- return true;
- }
+ return true;
/* Restore the last use walker and continue walking there. */
use = name;
diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
index 13b92f05e00..81a380e36a5 100644
--- a/gcc/tree-stdarg.c
+++ b/gcc/tree-stdarg.c
@@ -53,7 +53,7 @@ along with GCC; see the file COPYING3. If not see
static bool
reachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb)
{
- vec<edge> stack = vNULL;
+ auto_vec<edge, 10> stack;
edge e;
edge_iterator ei;
sbitmap visited;
@@ -105,7 +105,6 @@ reachable_at_most_once (basic_block va_arg_bb, basic_block va_start_bb)
}
}
- stack.release ();
sbitmap_free (visited);
return ret;
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 8c77d7e43ea..87684f1e249 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3911,7 +3911,6 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi,
bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info);
vec_info *vinfo = stmt_info->vinfo;
int multi_step_cvt = 0;
- vec<tree> vec_dsts = vNULL;
vec<tree> interm_types = vNULL;
tree last_oprnd, intermediate_type, cvt_type = NULL_TREE;
int op_type;
@@ -4210,7 +4209,7 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi,
We create vector destinations for the intermediate type (TYPES) received
from supportable_*_operation, and store them in the correct order
for future use in vect_create_vectorized_*_stmts (). */
- vec_dsts.create (multi_step_cvt + 1);
+ auto_vec<tree> vec_dsts (multi_step_cvt + 1);
vec_dest = vect_create_destination_var (scalar_dest,
(cvt_type && modifier == WIDEN)
? cvt_type : vectype_out);
@@ -4461,7 +4460,6 @@ vectorizable_conversion (gimple *stmt, gimple_stmt_iterator *gsi,
vec_oprnds0.release ();
vec_oprnds1.release ();
- vec_dsts.release ();
interm_types.release ();
return true;
@@ -5469,7 +5467,6 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
gimple *next_stmt, *first_stmt;
bool grouped_store;
unsigned int group_size, i;
- vec<tree> dr_chain = vNULL;
vec<tree> oprnds = vNULL;
vec<tree> result_chain = vNULL;
bool inv_p;
@@ -5972,7 +5969,7 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
return true;
}
- dr_chain.create (group_size);
+ auto_vec<tree> dr_chain (group_size);
oprnds.create (group_size);
alignment_support_scheme = vect_supportable_dr_alignment (first_dr, false);
@@ -6246,7 +6243,6 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
}
}
- dr_chain.release ();
oprnds.release ();
result_chain.release ();
vec_oprnds.release ();