diff options
36 files changed, 121 insertions, 142 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f54a4764c44..7736e5d07be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,30 @@ 2013-11-19 Richard Biener <rguenther@suse.de> + * cfgloop.h (struct loop_iterator): C++-ify, add constructor + and destructor and make fel_next a member function. + (fel_next): Transform into ... + (loop_iterator::next): ... this. + (fel_init): Transform into ... + (loop_iterator::loop_iterator): ... this. + (loop_iterator::~loop_iterator): New. + (FOR_EACH_LOOP): Remove loop-iterator argument. + (FOR_EACH_LOOP_BREAK): Remove no longer necessary macro. + * cfgloop.c, cfgloopmanip.c, config/mn10300/mn10300.c, + graphite-clast-to-gimple.c, graphite-scop-detection.c, + graphite-sese-to-poly.c, ipa-inline-analysis.c, ipa-pure-const.c, + loop-init.c, loop-invariant.c, loop-unroll.c, loop-unswitch.c, + modulo-sched.c, predict.c, sel-sched-ir.c, tree-cfg.c, tree-data-ref.c, + tree-if-conv.c, tree-loop-distribution.c, tree-parloops.c, + tree-predcom.c, tree-scalar-evolution.c, tree-ssa-dce.c, + tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, + tree-ssa-loop-ivopts.c, tree-ssa-loop-manip.c, tree-ssa-loop-niter.c, + tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c, + tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vrp.c: Adjust + uses of FOR_EACH_LOOP and remove loop_iterator variables. Replace + FOR_EACH_LOOP_BREAK with break. + +2013-11-19 Richard Biener <rguenther@suse.de> + PR tree-optimization/59164 * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Uncomment assert. diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 20c58e4fa69..a5eb4da3490 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -156,7 +156,6 @@ flow_loop_dump (const struct loop *loop, FILE *file, void flow_loops_dump (FILE *file, void (*loop_dump_aux) (const struct loop *, FILE *, int), int verbose) { - loop_iterator li; struct loop *loop; if (!current_loops || ! file) @@ -164,7 +163,7 @@ flow_loops_dump (FILE *file, void (*loop_dump_aux) (const struct loop *, FILE *, fprintf (file, ";; %d loops found\n", number_of_loops (cfun)); - FOR_EACH_LOOP (li, loop, LI_INCLUDE_ROOT) + FOR_EACH_LOOP (loop, LI_INCLUDE_ROOT) { flow_loop_dump (loop, file, loop_dump_aux, verbose); } @@ -767,10 +766,9 @@ disambiguate_multiple_latches (struct loop *loop) void disambiguate_loops_with_multiple_latches (void) { - loop_iterator li; struct loop *loop; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { if (!loop->latch) disambiguate_multiple_latches (loop); @@ -1327,7 +1325,6 @@ verify_loop_structure (void) int err = 0; edge e; unsigned num = number_of_loops (cfun); - loop_iterator li; struct loop_exit *exit, *mexit; bool dom_available = dom_info_available_p (CDI_DOMINATORS); sbitmap visited; @@ -1369,7 +1366,7 @@ verify_loop_structure (void) visited = sbitmap_alloc (last_basic_block); bitmap_clear (visited); bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun)); - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { unsigned n; @@ -1416,7 +1413,7 @@ verify_loop_structure (void) sbitmap_free (visited); /* Check headers and latches. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { i = loop->num; if (loop->header == NULL) @@ -1536,7 +1533,7 @@ verify_loop_structure (void) } /* Check the recorded loop exits. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { if (!loop->exits || loop->exits->e != NULL) { @@ -1630,7 +1627,7 @@ verify_loop_structure (void) err = 1; } - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { eloops = 0; for (exit = loop->exits->next; exit->e; exit = exit->next) diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index 87086d49022..68285a6d1b8 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -542,48 +542,52 @@ enum li_flags /* The iterator for loops. */ -typedef struct +struct loop_iterator { + loop_iterator (loop_p *loop, unsigned flags); + ~loop_iterator (); + + inline loop_p next (); + /* The list of loops to visit. */ vec<int> to_visit; /* The index of the actual loop. */ unsigned idx; -} loop_iterator; +}; -static inline void -fel_next (loop_iterator *li, loop_p *loop) +inline loop_p +loop_iterator::next () { int anum; - while (li->to_visit.iterate (li->idx, &anum)) + while (this->to_visit.iterate (this->idx, &anum)) { - li->idx++; - *loop = get_loop (cfun, anum); - if (*loop) - return; + this->idx++; + loop_p loop = get_loop (cfun, anum); + if (loop) + return loop; } - li->to_visit.release (); - *loop = NULL; + return NULL; } -static inline void -fel_init (loop_iterator *li, loop_p *loop, unsigned flags) +inline +loop_iterator::loop_iterator (loop_p *loop, unsigned flags) { struct loop *aloop; unsigned i; int mn; - li->idx = 0; + this->idx = 0; if (!current_loops) { - li->to_visit.create (0); + this->to_visit.create (0); *loop = NULL; return; } - li->to_visit.create (number_of_loops (cfun)); + this->to_visit.create (number_of_loops (cfun)); mn = (flags & LI_INCLUDE_ROOT) ? 0 : 1; if (flags & LI_ONLY_INNERMOST) @@ -592,7 +596,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) if (aloop != NULL && aloop->inner == NULL && aloop->num >= mn) - li->to_visit.quick_push (aloop->num); + this->to_visit.quick_push (aloop->num); } else if (flags & LI_FROM_INNERMOST) { @@ -605,7 +609,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) while (1) { if (aloop->num >= mn) - li->to_visit.quick_push (aloop->num); + this->to_visit.quick_push (aloop->num); if (aloop->next) { @@ -627,7 +631,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) while (1) { if (aloop->num >= mn) - li->to_visit.quick_push (aloop->num); + this->to_visit.quick_push (aloop->num); if (aloop->inner != NULL) aloop = aloop->inner; @@ -642,19 +646,19 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) } } - fel_next (li, loop); + *loop = this->next (); } -#define FOR_EACH_LOOP(LI, LOOP, FLAGS) \ - for (fel_init (&(LI), &(LOOP), FLAGS); \ - (LOOP); \ - fel_next (&(LI), &(LOOP))) +inline +loop_iterator::~loop_iterator () +{ + this->to_visit.release (); +} -#define FOR_EACH_LOOP_BREAK(LI) \ - { \ - (LI).to_visit.release (); \ - break; \ - } +#define FOR_EACH_LOOP(LOOP, FLAGS) \ + for (loop_iterator li(&(LOOP), FLAGS); \ + (LOOP); \ + (LOOP) = li.next ()) /* The properties of the target. */ struct target_cfgloop { diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index c8f923b5fca..714c7e1177f 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -1585,13 +1585,12 @@ create_preheader (struct loop *loop, int flags) void create_preheaders (int flags) { - loop_iterator li; struct loop *loop; if (!current_loops) return; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) create_preheader (loop, flags); loops_state_set (LOOPS_HAVE_PREHEADERS); } @@ -1601,11 +1600,10 @@ create_preheaders (int flags) void force_single_succ_latches (void) { - loop_iterator li; struct loop *loop; edge e; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { if (loop->latch != loop->header && single_succ_p (loop->latch)) continue; diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 342c336f118..7304e8638c7 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -3229,7 +3229,6 @@ mn10300_loop_contains_call_insn (loop_p loop) static void mn10300_scan_for_setlb_lcc (void) { - loop_iterator liter; loop_p loop; DUMP ("Looking for loops that can use the SETLB insn", NULL_RTX); @@ -3244,7 +3243,7 @@ mn10300_scan_for_setlb_lcc (void) if an inner loop is not suitable for use with the SETLB/Lcc insns, it may be the case that its parent loop is suitable. Thus we should check all loops, but work from the innermost outwards. */ - FOR_EACH_LOOP (liter, loop, LI_ONLY_INNERMOST) + FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST) { const char * reason = NULL; diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c index 44aecfbebf6..a661dbbc91b 100644 --- a/gcc/graphite-clast-to-gimple.c +++ b/gcc/graphite-clast-to-gimple.c @@ -1718,10 +1718,9 @@ gloog (scop_p scop, bb_pbb_htab_type bb_pbb_mapping) if (dump_file && (dump_flags & TDF_DETAILS)) { loop_p loop; - loop_iterator li; int num_no_dependency = 0; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if (loop->can_be_parallel) num_no_dependency++; diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c index 7b0ae7ea74d..001712673e7 100644 --- a/gcc/graphite-scop-detection.c +++ b/gcc/graphite-scop-detection.c @@ -1375,14 +1375,13 @@ canonicalize_loop_closed_ssa (loop_p loop) static void canonicalize_loop_closed_ssa_form (void) { - loop_iterator li; loop_p loop; #ifdef ENABLE_CHECKING verify_loop_closed_ssa (true); #endif - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) canonicalize_loop_closed_ssa (loop); rewrite_into_loop_closed_ssa (NULL, TODO_update_ssa); diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 620d09b8544..544ea93265e 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see #include "domwalk.h" #include "sese.h" #include "tree-ssa-propagate.h" +#include "expr.h" #ifdef HAVE_cloog #include "expr.h" @@ -3064,12 +3065,11 @@ rewrite_commutative_reductions_out_of_ssa_loop (scop_p scop, static void rewrite_commutative_reductions_out_of_ssa (scop_p scop) { - loop_iterator li; loop_p loop; bool changed = false; sese region = SCOP_REGION (scop); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if (loop_in_sese_p (loop, region)) changed |= rewrite_commutative_reductions_out_of_ssa_loop (scop, loop); @@ -3091,12 +3091,11 @@ rewrite_commutative_reductions_out_of_ssa (scop_p scop) static bool scop_ivs_can_be_represented (scop_p scop) { - loop_iterator li; loop_p loop; gimple_stmt_iterator psi; bool result = true; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { if (!loop_in_sese_p (loop, SCOP_REGION (scop))) continue; @@ -3116,7 +3115,7 @@ scop_ivs_can_be_represented (scop_p scop) } } if (!result) - FOR_EACH_LOOP_BREAK (li); + break; } return result; diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 662196f058b..3cd335ffd7d 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -2601,14 +2601,13 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) if (!early && nonconstant_names.exists ()) { struct loop *loop; - loop_iterator li; predicate loop_iterations = true_predicate (); predicate loop_stride = true_predicate (); if (dump_file && (dump_flags & TDF_DETAILS)) flow_loops_dump (dump_file, NULL, 0); scev_initialize (); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { vec<edge> exits; edge ex; diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index a241a699c5c..9e5b1ab921e 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -791,17 +791,16 @@ end: } else { - loop_iterator li; struct loop *loop; scev_initialize (); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if (!finite_loop_p (loop)) { if (dump_file) fprintf (dump_file, " can not prove finiteness of " "loop %i\n", loop->num); l->looping =true; - FOR_EACH_LOOP_BREAK (li); + break; } scev_finalize (); } diff --git a/gcc/loop-init.c b/gcc/loop-init.c index 8cc96af10fd..664b1ace427 100644 --- a/gcc/loop-init.c +++ b/gcc/loop-init.c @@ -135,7 +135,6 @@ loop_optimizer_init (unsigned flags) void loop_optimizer_finalize (void) { - loop_iterator li; struct loop *loop; basic_block bb; @@ -162,10 +161,8 @@ loop_optimizer_finalize (void) gcc_assert (current_loops != NULL); - FOR_EACH_LOOP (li, loop, 0) - { - free_simple_loop_desc (loop); - } + FOR_EACH_LOOP (loop, 0) + free_simple_loop_desc (loop); /* Clean up. */ flow_loops_free (current_loops); @@ -199,7 +196,6 @@ fix_loop_structure (bitmap changed_bbs) { basic_block bb; int record_exits = 0; - loop_iterator li; struct loop *loop; unsigned old_nloops, i; @@ -224,7 +220,7 @@ fix_loop_structure (bitmap changed_bbs) loops, so that when we remove the loops, we know that the loops inside are preserved, and do not waste time relinking loops that will be removed later. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { /* Detect the case that the loop is no longer present even though it wasn't marked for removal. diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index c5d6b5ac29d..efe2e7a9f16 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -1815,9 +1815,8 @@ calculate_loop_reg_pressure (void) basic_block bb; rtx insn, link; struct loop *loop, *parent; - loop_iterator li; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if (loop->aux == NULL) { loop->aux = xcalloc (1, sizeof (struct loop_data)); @@ -1884,7 +1883,7 @@ calculate_loop_reg_pressure (void) bitmap_clear (&curr_regs_live); if (flag_ira_region == IRA_REGION_MIXED || flag_ira_region == IRA_REGION_ALL) - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { EXECUTE_IF_SET_IN_BITMAP (&LOOP_DATA (loop)->regs_live, 0, j, bi) if (! bitmap_bit_p (&LOOP_DATA (loop)->regs_ref, j)) @@ -1898,7 +1897,7 @@ calculate_loop_reg_pressure (void) } if (dump_file == NULL) return; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { parent = loop_outer (loop); fprintf (dump_file, "\n Loop %d (parent %d, header bb%d, depth %d)\n", @@ -1933,7 +1932,6 @@ void move_loop_invariants (void) { struct loop *loop; - loop_iterator li; if (flag_ira_loop_pressure) { @@ -1945,7 +1943,7 @@ move_loop_invariants (void) } df_set_flags (DF_EQ_NOTES + DF_DEFER_INSN_RESCAN); /* Process the loops, innermost first. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { curr_loop = loop; /* move_single_loop_invariants for very large loops @@ -1954,7 +1952,7 @@ move_loop_invariants (void) move_single_loop_invariants (loop); } - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { free_loop_data (loop); } diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 40f06dbbca3..1240f7ce024 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -269,7 +269,6 @@ unroll_and_peel_loops (int flags) { struct loop *loop; bool changed = false; - loop_iterator li; /* First perform complete loop peeling (it is almost surely a win, and affects parameters for further decision a lot). */ @@ -279,7 +278,7 @@ unroll_and_peel_loops (int flags) decide_unrolling_and_peeling (flags); /* Scan the loops, inner ones first. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { /* And perform the appropriate transformations. */ switch (loop->lpt_decision.decision) @@ -345,11 +344,10 @@ static void peel_loops_completely (int flags) { struct loop *loop; - loop_iterator li; bool changed = false; /* Scan the loops, the inner ones first. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { loop->lpt_decision.decision = LPT_NONE; location_t locus = get_loop_location (loop); @@ -386,10 +384,9 @@ static void decide_unrolling_and_peeling (int flags) { struct loop *loop; - loop_iterator li; /* Scan the loops, inner ones first. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { loop->lpt_decision.decision = LPT_NONE; location_t locus = get_loop_location (loop); diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index 219c943545b..671ec19b6d0 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -138,13 +138,12 @@ compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob, void unswitch_loops (void) { - loop_iterator li; struct loop *loop; bool changed = false; /* Go through inner loops (only original ones). */ - FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST) + FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST) changed |= unswitch_single_loop (loop, NULL_RTX, 0); iv_analysis_done (); diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 599c025f57d..1f2a014127b 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -1351,7 +1351,6 @@ sms_schedule (void) ddg_ptr *g_arr, g; int * node_order; int maxii, max_asap; - loop_iterator li; partial_schedule_ptr ps; basic_block bb = NULL; struct loop *loop; @@ -1395,7 +1394,7 @@ sms_schedule (void) /* Build DDGs for all the relevant loops and hold them in G_ARR indexed by the loop index. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { rtx head, tail; rtx count_reg; @@ -1406,7 +1405,7 @@ sms_schedule (void) if (dump_file) fprintf (dump_file, "SMS reached max limit... \n"); - FOR_EACH_LOOP_BREAK (li); + break; } if (dump_file) @@ -1533,7 +1532,7 @@ sms_schedule (void) } /* We don't want to perform SMS on new loops - created by versioning. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { rtx head, tail; rtx count_reg, count_init; diff --git a/gcc/predict.c b/gcc/predict.c index 4adc5e44c9e..e22c96ce8c0 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1514,12 +1514,11 @@ predict_extra_loop_exits (edge exit_edge) static void predict_loops (void) { - loop_iterator li; struct loop *loop; /* Try to predict out blocks in a loop that are not part of a natural loop. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { basic_block bb, *bbs; unsigned j, n_exits; diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index 90bf1e2da1b..579cf8d4056 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -6201,11 +6201,10 @@ make_regions_from_the_rest (void) /* Free data structures used in pipelining of loops. */ void sel_finish_pipelining (void) { - loop_iterator li; struct loop *loop; /* Release aux fields so we don't free them later by mistake. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) loop->aux = NULL; loop_optimizer_finalize (); @@ -6227,11 +6226,10 @@ sel_find_rgns (void) if (current_loops) { loop_p loop; - loop_iterator li; - FOR_EACH_LOOP (li, loop, (flag_sel_sched_pipelining_outer_loops - ? LI_FROM_INNERMOST - : LI_ONLY_INNERMOST)) + FOR_EACH_LOOP (loop, (flag_sel_sched_pipelining_outer_loops + ? LI_FROM_INNERMOST + : LI_ONLY_INNERMOST)) make_regions_from_loop_nest (loop); } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index a38dec3920f..c30b113bc24 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -267,12 +267,11 @@ static void replace_loop_annotate () { struct loop *loop; - loop_iterator li; basic_block bb; gimple_stmt_iterator gsi; gimple stmt; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { gsi = gsi_last_bb (loop->header); stmt = gsi_stmt (gsi); @@ -1640,9 +1639,8 @@ replace_uses_by (tree name, tree val) if (current_loops) { struct loop *loop; - loop_iterator li; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { substitute_in_loop_info (loop, name, val); } diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 190b91ca752..21729583431 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -4745,10 +4745,9 @@ analyze_all_data_dependences (struct loop *loop) void tree_check_data_deps (void) { - loop_iterator li; struct loop *loop_nest; - FOR_EACH_LOOP (li, loop_nest, 0) + FOR_EACH_LOOP (loop_nest, 0) analyze_all_data_dependences (loop_nest); } diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 2dd073389f8..dd3925ad859 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1788,7 +1788,6 @@ tree_if_conversion (struct loop *loop) static unsigned int main_tree_if_conversion (void) { - loop_iterator li; struct loop *loop; bool changed = false; unsigned todo = 0; @@ -1796,7 +1795,7 @@ main_tree_if_conversion (void) if (number_of_loops (cfun) <= 1) return 0; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if (flag_tree_loop_if_convert == 1 || flag_tree_loop_if_convert_stores == 1 || flag_tree_loop_vectorize diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 6f9462c4aec..0afa52aff1e 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -1661,7 +1661,6 @@ static unsigned int tree_loop_distribution (void) { struct loop *loop; - loop_iterator li; bool changed = false; basic_block bb; control_dependences *cd = NULL; @@ -1677,7 +1676,7 @@ tree_loop_distribution (void) /* We can at the moment only distribute non-nested loops, thus restrict walking to innermost loops. */ - FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST) + FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST) { vec<gimple> work_list = vNULL; basic_block *bbs; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index b7370f73c46..d627c69f954 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1747,7 +1747,6 @@ static void gen_parallel_loop (struct loop *loop, reduction_info_table_type reduction_list, unsigned n_threads, struct tree_niter_desc *niter) { - loop_iterator li; tree many_iterations_cond, type, nit; tree arg_struct, new_arg_struct; gimple_seq stmts; @@ -1902,7 +1901,7 @@ gen_parallel_loop (struct loop *loop, reduction_info_table_type reduction_list, /* Free loop bound estimations that could contain references to removed statements. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) free_numbers_of_iterations_estimates_loop (loop); /* Expand the parallel constructs. We do it directly here instead of running @@ -2143,7 +2142,6 @@ parallelize_loops (void) bool changed = false; struct loop *loop; struct tree_niter_desc niter_desc; - loop_iterator li; reduction_info_table_type reduction_list; struct obstack parloop_obstack; HOST_WIDE_INT estimated; @@ -2159,7 +2157,7 @@ parallelize_loops (void) reduction_list.create (10); init_stmt_vec_info_vec (); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { reduction_list.empty (); if (dump_file && (dump_flags & TDF_DETAILS)) diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 830f82bc811..6d141842f1c 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -2511,11 +2511,10 @@ tree_predictive_commoning (void) { bool unrolled = false; struct loop *loop; - loop_iterator li; unsigned ret = 0; initialize_original_copy_tables (); - FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST) + FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST) if (optimize_loop_for_speed_p (loop)) { unrolled |= tree_predictive_commoning_loop (loop); diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index e8b18f9df07..0c1f1dfbb1a 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -3103,16 +3103,14 @@ initialize_scalar_evolutions_analyzer (void) void scev_initialize (void) { - loop_iterator li; struct loop *loop; - scalar_evolution_info = htab_create_ggc (100, hash_scev_info, eq_scev_info, del_scev_info); initialize_scalar_evolutions_analyzer (); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { loop->nb_iterations = NULL_TREE; } @@ -3144,7 +3142,6 @@ scev_reset_htab (void) void scev_reset (void) { - loop_iterator li; struct loop *loop; scev_reset_htab (); @@ -3152,7 +3149,7 @@ scev_reset (void) if (!current_loops) return; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { loop->nb_iterations = NULL_TREE; } @@ -3298,7 +3295,6 @@ scev_const_prop (void) struct loop *loop, *ex_loop; bitmap ssa_names_to_remove = NULL; unsigned i; - loop_iterator li; gimple_stmt_iterator psi; if (number_of_loops (cfun) <= 1) @@ -3360,7 +3356,7 @@ scev_const_prop (void) } /* Now the regular final value replacement. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { edge exit; tree def, rslt, niter; diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 213bb51b3e2..e07bd42932f 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -396,7 +396,6 @@ find_obviously_necessary_stmts (bool aggressive) /* Prevent the empty possibly infinite loops from being removed. */ if (aggressive) { - loop_iterator li; struct loop *loop; scev_initialize (); if (mark_irreducible_loops ()) @@ -414,7 +413,7 @@ find_obviously_necessary_stmts (bool aggressive) } } - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if (!finite_loop_p (loop)) { if (dump_file) diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index 138c0a7a0fb..df45c286790 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -130,7 +130,6 @@ do_while_loop_p (struct loop *loop) static unsigned int copy_loop_headers (void) { - loop_iterator li; struct loop *loop; basic_block header; edge exit, entry; @@ -150,7 +149,7 @@ copy_loop_headers (void) copied_bbs = XNEWVEC (basic_block, n_basic_blocks_for_fn (cfun)); bbs_size = n_basic_blocks_for_fn (cfun); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { /* Copy at most 20 insns. */ int limit = 20; diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 79a0543a40f..6ea634c1781 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1584,14 +1584,13 @@ analyze_memory_references (void) gimple_stmt_iterator bsi; basic_block bb, *bbs; struct loop *loop, *outer; - loop_iterator li; unsigned i, n; /* Initialize bb_loop_postorder with a mapping from loop->num to its postorder index. */ i = 0; bb_loop_postorder = XNEWVEC (unsigned, number_of_loops (cfun)); - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) bb_loop_postorder[loop->num] = i++; /* Collect all basic-blocks in loops and sort them after their loops postorder. */ @@ -1617,7 +1616,7 @@ analyze_memory_references (void) /* Propagate the information about accessed memory references up the loop hierarchy. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { /* Finalize the overall touched references (including subloops). */ bitmap_ior_into (&memory_accesses.all_refs_stored_in_loop[loop->num], diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index ea0ab8ca80b..0fdc5ab585f 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -983,7 +983,6 @@ canonicalize_loop_induction_variables (struct loop *loop, unsigned int canonicalize_induction_variables (void) { - loop_iterator li; struct loop *loop; bool changed = false; bool irred_invalidated = false; @@ -992,7 +991,7 @@ canonicalize_induction_variables (void) free_numbers_of_iterations_estimates (); estimate_numbers_of_iterations (); - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { changed |= canonicalize_loop_induction_variables (loop, true, UL_SINGLE_ITER, diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 9bf12ebdc8e..c20ffe692a9 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -6875,12 +6875,11 @@ tree_ssa_iv_optimize (void) { struct loop *loop; struct ivopts_data data; - loop_iterator li; tree_ssa_iv_optimize_init (&data); /* Optimize the loops starting with the innermost ones. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { if (dump_file && (dump_flags & TDF_DETAILS)) flow_loop_dump (loop, dump_file, NULL, 1); diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index fe2686d3037..246b66702dc 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -350,12 +350,11 @@ add_exit_phis (bitmap names_to_rename, bitmap *use_blocks, bitmap *loop_exits) static void get_loops_exits (bitmap *loop_exits) { - loop_iterator li; struct loop *loop; unsigned j; edge e; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { vec<edge> exit_edges = get_loop_exit_edges (loop); loop_exits[loop->num] = BITMAP_ALLOC (&loop_renamer_obstack); diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 023f2a83356..1e0dcd61e31 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -3586,14 +3586,13 @@ estimated_stmt_executions (struct loop *loop, double_int *nit) void estimate_numbers_of_iterations (void) { - loop_iterator li; struct loop *loop; /* We don't want to issue signed overflow warnings while getting loop iteration estimates. */ fold_defer_overflow_warnings (); - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { estimate_numbers_of_iterations_loop (loop); } @@ -3863,10 +3862,9 @@ free_numbers_of_iterations_estimates_loop (struct loop *loop) void free_numbers_of_iterations_estimates (void) { - loop_iterator li; struct loop *loop; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { free_numbers_of_iterations_estimates_loop (loop); } diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 6baf4abd319..4e49d762442 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -1930,7 +1930,6 @@ fail: unsigned int tree_ssa_prefetch_arrays (void) { - loop_iterator li; struct loop *loop; bool unrolled = false; int todo_flags = 0; @@ -1978,7 +1977,7 @@ tree_ssa_prefetch_arrays (void) here. */ gcc_assert ((PREFETCH_BLOCK & (PREFETCH_BLOCK - 1)) == 0); - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Processing loop %d:\n", loop->num); diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 236b89b8a12..9f4d4926a55 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -83,13 +83,12 @@ static tree tree_may_unswitch_on (basic_block, struct loop *); unsigned int tree_ssa_unswitch_loops (void) { - loop_iterator li; struct loop *loop; bool changed = false; HOST_WIDE_INT iterations; /* Go through inner loops (only original ones). */ - FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST) + FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST) { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, ";; Considering loop %d\n", loop->num); diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 3fba8486b3a..afd7ac43972 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -1554,7 +1554,6 @@ thread_through_all_blocks (bool may_peel_loop_headers) bitmap_iterator bi; bitmap threaded_blocks; struct loop *loop; - loop_iterator li; /* We must know about loops in order to preserve them. */ gcc_assert (current_loops != NULL); @@ -1582,7 +1581,7 @@ thread_through_all_blocks (bool may_peel_loop_headers) /* Then perform the threading through loop headers. We start with the innermost loop, so that the changes in cfg we perform won't affect further threading. */ - FOR_EACH_LOOP (li, loop, LI_FROM_INNERMOST) + FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) { if (!loop->header || !bitmap_bit_p (threaded_blocks, loop->header->index)) diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 5021c5b48cc..fea7086b623 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -324,7 +324,6 @@ vectorize_loops (void) unsigned int i; unsigned int num_vectorized_loops = 0; unsigned int vect_loops_num; - loop_iterator li; struct loop *loop; hash_table <simduid_to_vf> simduid_to_vf_htab; hash_table <simd_array_to_simduid> simd_array_to_simduid_htab; @@ -349,7 +348,7 @@ vectorize_loops (void) /* If some loop was duplicated, it gets bigger number than all previously defined loops. This fact allows us to run only over initial loops skipping newly generated ones. */ - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) if ((flag_tree_loop_vectorize && optimize_loop_nest_for_speed_p (loop)) || loop->force_vect) { diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index d250186a40b..4a24c668d57 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -5895,8 +5895,7 @@ find_assert_locations (void) the order we compute liveness and insert asserts we otherwise fail to insert asserts into the loop latch. */ loop_p loop; - loop_iterator li; - FOR_EACH_LOOP (li, loop, 0) + FOR_EACH_LOOP (loop, 0) { i = loop->latch->index; unsigned int j = single_succ_edge (loop->latch)->dest_idx; |