From: Jakub Jelinek Date: Mon, 16 Mar 2015 16:10:58 +0000 (+0100) Subject: omp-low.c (expand_omp_target): Use auto_vec instead of vec * with... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9410d9b20aae8c15ac96d85bc3b8873fedde527a;p=gcc.git omp-low.c (expand_omp_target): Use auto_vec instead of vec * with vec_alloc and release for args. * omp-low.c (expand_omp_target): Use auto_vec instead of vec * with vec_alloc and release for args. Adjust all users. From-SVN: r221460 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6af257e434b..528e8974727 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2015-03-16 Jakub Jelinek + * omp-low.c (expand_omp_target): Use auto_vec + instead of vec * with vec_alloc and release for args. + Adjust all users. + PR middle-end/65431 * omp-low.c (delete_omp_context): Only splay_tree_delete reduction_map in GIMPLE_OMP_TARGET is_gimple_omp_offloaded diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 1ecc6f8b7bd..48d73cbc021 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -9105,14 +9105,11 @@ expand_omp_target (struct omp_region *region) } gimple g; - vec *args; /* The maximum number used by any start_ix, without varargs. */ - unsigned int argcnt = 11; - - vec_alloc (args, argcnt); - args->quick_push (device); + auto_vec args; + args.quick_push (device); if (offloaded) - args->quick_push (build_fold_addr_expr (child_fn)); + args.quick_push (build_fold_addr_expr (child_fn)); switch (start_ix) { case BUILT_IN_GOMP_TARGET: @@ -9120,7 +9117,7 @@ expand_omp_target (struct omp_region *region) case BUILT_IN_GOMP_TARGET_UPDATE: /* This const void * is part of the current ABI, but we're not actually using it. */ - args->quick_push (build_zero_cst (ptr_type_node)); + args.quick_push (build_zero_cst (ptr_type_node)); break; case BUILT_IN_GOACC_DATA_START: case BUILT_IN_GOACC_ENTER_EXIT_DATA: @@ -9130,10 +9127,10 @@ expand_omp_target (struct omp_region *region) default: gcc_unreachable (); } - args->quick_push (t1); - args->quick_push (t2); - args->quick_push (t3); - args->quick_push (t4); + args.quick_push (t1); + args.quick_push (t2); + args.quick_push (t3); + args.quick_push (t4); switch (start_ix) { case BUILT_IN_GOACC_DATA_START: @@ -9166,9 +9163,9 @@ expand_omp_target (struct omp_region *region) t_vector_length = fold_convert_loc (OMP_CLAUSE_LOCATION (c), integer_type_node, OMP_CLAUSE_VECTOR_LENGTH_EXPR (c)); - args->quick_push (t_num_gangs); - args->quick_push (t_num_workers); - args->quick_push (t_vector_length); + args.quick_push (t_num_gangs); + args.quick_push (t_num_workers); + args.quick_push (t_vector_length); } /* FALLTHRU */ case BUILT_IN_GOACC_ENTER_EXIT_DATA: @@ -9190,13 +9187,13 @@ expand_omp_target (struct omp_region *region) integer_type_node, OMP_CLAUSE_ASYNC_EXPR (c)); - args->quick_push (t_async); + args.quick_push (t_async); /* Save the index, and... */ - t_wait_idx = args->length (); + t_wait_idx = args.length (); /* ... push a default value. */ - args->quick_push (fold_convert_loc (gimple_location (entry_stmt), - integer_type_node, - integer_zero_node)); + args.quick_push (fold_convert_loc (gimple_location (entry_stmt), + integer_type_node, + integer_zero_node)); c = find_omp_clause (clauses, OMP_CLAUSE_WAIT); if (c) { @@ -9206,19 +9203,19 @@ expand_omp_target (struct omp_region *region) { if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_WAIT) { - args->safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c), - integer_type_node, - OMP_CLAUSE_WAIT_EXPR (c))); + args.safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c), + integer_type_node, + OMP_CLAUSE_WAIT_EXPR (c))); n++; } } /* Now that we know the number, replace the default value. */ - args->ordered_remove (t_wait_idx); - args->quick_insert (t_wait_idx, - fold_convert_loc (gimple_location (entry_stmt), - integer_type_node, - build_int_cst (integer_type_node, n))); + args.ordered_remove (t_wait_idx); + args.quick_insert (t_wait_idx, + fold_convert_loc (gimple_location (entry_stmt), + integer_type_node, + build_int_cst (integer_type_node, n))); } } break; @@ -9226,8 +9223,7 @@ expand_omp_target (struct omp_region *region) gcc_unreachable (); } - g = gimple_build_call_vec (builtin_decl_explicit (start_ix), *args); - args->release (); + g = gimple_build_call_vec (builtin_decl_explicit (start_ix), args); gimple_set_location (g, gimple_location (entry_stmt)); gsi_insert_before (&gsi, g, GSI_SAME_STMT); if (!offloaded)