diff options
author | Richard Biener <rguenther@suse.de> | 2020-08-06 14:50:56 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-09-24 15:59:19 +0200 |
commit | 4b9d61f79c0c0185a33048ae6cc72269cf7efa31 (patch) | |
tree | f62956faf4f9fa1e7b25d44bee91258c462842fd /gcc/tree-ssa-loop-niter.c | |
parent | 2e66e53b1efb98f5cf6b0a123990c1ca999affd7 (diff) | |
download | gcc-4b9d61f79c0c0185a33048ae6cc72269cf7efa31.zip gcc-4b9d61f79c0c0185a33048ae6cc72269cf7efa31.tar.gz gcc-4b9d61f79c0c0185a33048ae6cc72269cf7efa31.tar.bz2 |
add move CTOR to auto_vec, use auto_vec for get_loop_exit_edges
This adds a move CTOR to auto_vec<T, 0> and makes use of a
auto_vec<edge> return value for get_loop_exit_edges denoting
that lifetime management of the vector is handed to the caller.
The move CTOR prompted the hash_table change because it appearantly
makes the copy CTOR implicitely deleted (good) and hash-table
expansion of the odr_enum_map which is
hash_map <nofree_string_hash, odr_enum> where odr_enum has an
auto_vec<odr_enum_val, 0> member triggers this. Not sure if
there's a latent bug there before this (I think we're not
invoking DTORs, but we're invoking copy-CTORs).
2020-08-06 Richard Biener <rguenther@suse.de>
* vec.h (auto_vec<T, 0>::auto_vec (auto_vec &&)): New move CTOR.
(auto_vec<T, 0>::operator=(auto_vec &&)): Delete.
* hash-table.h (hash_table::expand): Use std::move when expanding.
* cfgloop.h (get_loop_exit_edges): Return auto_vec<edge>.
* cfgloop.c (get_loop_exit_edges): Adjust.
* cfgloopmanip.c (fix_loop_placement): Likewise.
* ipa-fnsummary.c (analyze_function_body): Likewise.
* ira-build.c (create_loop_tree_nodes): Likewise.
(create_loop_tree_node_allocnos): Likewise.
(loop_with_complex_edge_p): Likewise.
* ira-color.c (ira_loop_edge_freq): Likewise.
* loop-unroll.c (analyze_insns_in_loop): Likewise.
* predict.c (predict_loops): Likewise.
* tree-predcom.c (last_always_executed_block): Likewise.
* tree-ssa-loop-ch.c (ch_base::copy_headers): Likewise.
* tree-ssa-loop-im.c (store_motion_loop): Likewise.
* tree-ssa-loop-ivcanon.c (loop_edge_to_cancel): Likewise.
(canonicalize_loop_induction_variables): Likewise.
* tree-ssa-loop-manip.c (get_loops_exits): Likewise.
* tree-ssa-loop-niter.c (find_loop_niter): Likewise.
(finite_loop_p): Likewise.
(find_loop_niter_by_eval): Likewise.
(estimate_numbers_of_iterations): Likewise.
* tree-ssa-loop-prefetch.c (emit_mfence_after_loop): Likewise.
(may_use_storent_in_loop_p): Likewise.
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index b3647d9e..45747e1 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2752,7 +2752,7 @@ tree find_loop_niter (class loop *loop, edge *exit) { unsigned i; - vec<edge> exits = get_loop_exit_edges (loop); + auto_vec<edge> exits = get_loop_exit_edges (loop); edge ex; tree niter = NULL_TREE, aniter; class tree_niter_desc desc; @@ -2803,7 +2803,6 @@ find_loop_niter (class loop *loop, edge *exit) continue; } } - exits.release (); return niter ? niter : chrec_dont_know; } @@ -2837,21 +2836,18 @@ finite_loop_p (class loop *loop) if (loop->finite_p) { unsigned i; - vec<edge> exits = get_loop_exit_edges (loop); + auto_vec<edge> exits = get_loop_exit_edges (loop); edge ex; /* If the loop has a normal exit, we can assume it will terminate. */ FOR_EACH_VEC_ELT (exits, i, ex) if (!(ex->flags & (EDGE_EH | EDGE_ABNORMAL | EDGE_FAKE))) { - exits.release (); if (dump_file) fprintf (dump_file, "Assume loop %i to be finite: it has an exit " "and -ffinite-loops is on.\n", loop->num); return true; } - - exits.release (); } return false; @@ -3114,7 +3110,7 @@ tree find_loop_niter_by_eval (class loop *loop, edge *exit) { unsigned i; - vec<edge> exits = get_loop_exit_edges (loop); + auto_vec<edge> exits = get_loop_exit_edges (loop); edge ex; tree niter = NULL_TREE, aniter; @@ -3123,10 +3119,7 @@ find_loop_niter_by_eval (class loop *loop, edge *exit) /* Loops with multiple exits are expensive to handle and less important. */ if (!flag_expensive_optimizations && exits.length () > 1) - { - exits.release (); - return chrec_dont_know; - } + return chrec_dont_know; FOR_EACH_VEC_ELT (exits, i, ex) { @@ -3144,7 +3137,6 @@ find_loop_niter_by_eval (class loop *loop, edge *exit) niter = aniter; *exit = ex; } - exits.release (); return niter ? niter : chrec_dont_know; } @@ -4236,7 +4228,6 @@ get_upper_bound_based_on_builtin_expr_with_prob (gcond *cond) void estimate_numbers_of_iterations (class loop *loop) { - vec<edge> exits; tree niter, type; unsigned i; class tree_niter_desc niter_desc; @@ -4275,7 +4266,7 @@ estimate_numbers_of_iterations (class loop *loop) number_of_latch_executions (loop); basic_block *body = get_loop_body (loop); - exits = get_loop_exit_edges (loop, body); + auto_vec<edge> exits = get_loop_exit_edges (loop, body); likely_exit = single_likely_exit (loop, exits); FOR_EACH_VEC_ELT (exits, i, ex) { @@ -4311,7 +4302,6 @@ estimate_numbers_of_iterations (class loop *loop) true, ex == likely_exit, true); record_control_iv (loop, &niter_desc); } - exits.release (); if (flag_aggressive_loop_optimizations) infer_loop_bounds_from_undefined (loop, body); |