From: Trevor Saunders <tbsaunde+...@tbsaunde.org>

gcc/c/ChangeLog:

2016-06-29  Trevor Saunders  <tbsaunde+...@tbsaunde.org>

        * c-parser.c (c_parser_generic_selection): Make type of variable
        auto_vec.
        (c_parser_omp_declare_simd): Likewise.

gcc/ChangeLog:

2016-06-29  Trevor Saunders  <tbsaunde+...@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.
---
 gcc/c/c-parser.c          | 22 ++++++----------------
 gcc/cfgexpand.c           |  3 +--
 gcc/genmatch.c            | 12 ++++--------
 gcc/haifa-sched.c         | 15 ++++-----------
 gcc/predict.c             |  4 +---
 gcc/tree-data-ref.c       |  5 +----
 gcc/tree-diagnostic.c     |  4 +---
 gcc/tree-ssa-loop-niter.c |  6 ++----
 gcc/tree-ssa-sccvn.c      | 16 ++++------------
 gcc/tree-stdarg.c         |  3 +--
 gcc/tree-vect-stmts.c     |  8 ++------
 11 files changed, 27 insertions(+), 71 deletions(-)

diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 7f491f1..18dc618 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).
@@ -16362,14 +16356,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);
@@ -16391,7 +16384,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);
@@ -16401,7 +16393,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);
@@ -16473,7 +16464,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 9750586..f270e76 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 f5aa29b..02e945a 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 1f1e763..9503576 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 d505d9c..32de2d9 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2966,8 +2966,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.  */
@@ -3024,7 +3023,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 ed28ca1..1a7a2ea 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 5377ec2..234d0fd 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 32fe2f9..7d52dd9 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 95306c5..184e062 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4109,8 +4109,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;
@@ -4147,19 +4147,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 13b92f0..81a380e 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 5c65502..3281860 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3633,7 +3633,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;
@@ -3932,7 +3931,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);
@@ -4183,7 +4182,6 @@ vectorizable_conversion (gimple *stmt, 
gimple_stmt_iterator *gsi,
 
   vec_oprnds0.release ();
   vec_oprnds1.release ();
-  vec_dsts.release ();
   interm_types.release ();
 
   return true;
@@ -5216,7 +5214,6 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator 
*gsi, gimple **vec_stmt,
   bool grouped_store = false;
   bool store_lanes_p = false;
   unsigned int group_size, i;
-  vec<tree> dr_chain = vNULL;
   vec<tree> oprnds = vNULL;
   vec<tree> result_chain = vNULL;
   bool inv_p;
@@ -5792,7 +5789,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);
@@ -6067,7 +6064,6 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator 
*gsi, gimple **vec_stmt,
        }
     }
 
-  dr_chain.release ();
   oprnds.release ();
   result_chain.release ();
   vec_oprnds.release ();
-- 
2.7.4

Reply via email to