diff options
-rw-r--r-- | gcc/ChangeLog | 34 | ||||
-rw-r--r-- | gcc/cfghooks.c | 2 | ||||
-rw-r--r-- | gcc/cfgloop.c | 106 | ||||
-rw-r--r-- | gcc/cfgloop.h | 46 | ||||
-rw-r--r-- | gcc/cfgloopanal.c | 14 | ||||
-rw-r--r-- | gcc/cfgloopmanip.c | 28 | ||||
-rw-r--r-- | gcc/lambda-code.c | 5 | ||||
-rw-r--r-- | gcc/modulo-sched.c | 2 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 2 | ||||
-rw-r--r-- | gcc/tree-loop-linear.c | 12 | ||||
-rw-r--r-- | gcc/tree-scalar-evolution.c | 13 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 14 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 2 | ||||
-rw-r--r-- | gcc/tree-vectorizer.c | 4 |
14 files changed, 174 insertions, 110 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b53da5a226..f7aad187b2c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,37 @@ +2007-05-11 Zdenek Dvorak <dvorakz@suse.cz> + + * tree-loop-linear.c (gather_interchange_stats, try_interchange_loops): + Use loop_depth and loop_outer accessor functions. + * tree-ssa-loop-im.c (outermost_invariant_loop, set_level, + determine_invariantness_stmt, move_computations_stmt): Ditto. + * cfgloopmanip.c (fix_bb_placement, fix_loop_placement, remove_path, + add_loop, loopify, unloop, fix_loop_structure): Ditto. + * tree-ssa-loop-manip.c (find_uses_to_rename_use): Ditto. + * tree-scalar-evolution.c (interpret_loop_phi, + compute_scalar_evolution_in_loop, analyze_scalar_evolution_in_loop, + instantiate_parameters_1, scev_const_prop): Ditto. + * cfghooks.c (make_forwarder_block): Ditto. + * cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto. + * modulo-sched.c (loop_canon_p): Ditto. + * tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg, + slpeel_can_duplicate_loop_p): Ditto. + * lambda-code.c (invariant_in_loop_and_outer_loops): Ditto. + * tree-cfg.c (tree_duplicate_sese_region): Ditto. + * cfgloop.c (flow_loop_dump, flow_loop_nodes_find, rescan_loop_exit, + cancel_loop, verify_loop_structure): Ditto. + (flow_loop_nested_p, superloop_at_depth, flow_loop_free, + add_bb_to_loop, remove_bb_from_loops, find_common_loop): Use the + superloops vector instead of "pred" array. + (establish_preds): Take father loop as an argument. Initialize the + superloops vector. + (flow_loop_tree_node_add): Pass father loop to establish_preds. Do not + initialize loop->outer. + (flow_loop_tree_node_remove): Truncate the superloops vector. + * cfgloop.h (struct loop): Removed field "outer", fields "depth" and + "pred" merged to "superloops" vector. + (loop_depth, loop_outer): New. + (fel_init): Use loop_outer. + 2007-05-11 Jan Hubicka <jh@suse.cz> * cgraphunit.c: Include gt-cgraphunit.h diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index 9e2eae75d49..f1103c15685 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -767,7 +767,7 @@ make_forwarder_block (basic_block bb, bool (*redirect_edge_p) (edge), } /* In case we split loop latch, update it. */ - for (ploop = loop; ploop; ploop = ploop->outer) + for (ploop = loop; ploop; ploop = loop_outer (ploop)) if (ploop->latch == dummy) ploop->latch = bb; } diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index b30e3527a6c..c77fdafd93c 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -36,7 +36,6 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "output.h" static void flow_loops_cfg_dump (FILE *); -static void establish_preds (struct loop *); /* Dump loop related CFG information. */ @@ -65,8 +64,10 @@ flow_loops_cfg_dump (FILE *file) bool flow_loop_nested_p (const struct loop *outer, const struct loop *loop) { - return (loop->depth > outer->depth - && loop->pred[outer->depth] == outer); + unsigned odepth = loop_depth (outer); + + return (loop_depth (loop) > odepth + && VEC_index (loop_p, loop->superloops, odepth) == outer); } /* Returns the loop such that LOOP is nested DEPTH (indexed from zero) @@ -75,12 +76,14 @@ flow_loop_nested_p (const struct loop *outer, const struct loop *loop) struct loop * superloop_at_depth (struct loop *loop, unsigned depth) { - gcc_assert (depth <= (unsigned) loop->depth); + unsigned ldepth = loop_depth (loop); + + gcc_assert (depth <= ldepth); - if (depth == (unsigned) loop->depth) + if (depth == ldepth) return loop; - return loop->pred[depth]; + return VEC_index (loop_p, loop->superloops, depth); } /* Returns the list of the latch edges of LOOP. */ @@ -133,7 +136,8 @@ flow_loop_dump (const struct loop *loop, FILE *file, } fprintf (file, ";; depth %d, outer %ld\n", - loop->depth, (long) (loop->outer ? loop->outer->num : -1)); + loop_depth (loop), (long) (loop_outer (loop) + ? loop_outer (loop)->num : -1)); fprintf (file, ";; nodes:"); bbs = get_loop_body (loop); @@ -175,8 +179,7 @@ flow_loop_free (struct loop *loop) { struct loop_exit *exit, *next; - if (loop->pred) - free (loop->pred); + VEC_free (loop_p, heap, loop->superloops); /* Break the list of the loop exit records. They will be freed when the corresponding edge is rescanned or removed, and this avoids @@ -226,9 +229,10 @@ flow_loop_nodes_find (basic_block header, struct loop *loop) int num_nodes = 1; edge latch; edge_iterator latch_ei; + unsigned depth = loop_depth (loop); header->loop_father = loop; - header->loop_depth = loop->depth; + header->loop_depth = depth; FOR_EACH_EDGE (latch, latch_ei, loop->header->preds) { @@ -239,7 +243,7 @@ flow_loop_nodes_find (basic_block header, struct loop *loop) num_nodes++; VEC_safe_push (basic_block, heap, stack, latch->src); latch->src->loop_father = loop; - latch->src->loop_depth = loop->depth; + latch->src->loop_depth = depth; while (!VEC_empty (basic_block, stack)) { @@ -256,7 +260,7 @@ flow_loop_nodes_find (basic_block header, struct loop *loop) if (ancestor->loop_father != loop) { ancestor->loop_father = loop; - ancestor->loop_depth = loop->depth; + ancestor->loop_depth = depth; num_nodes++; VEC_safe_push (basic_block, heap, stack, ancestor); } @@ -268,24 +272,27 @@ flow_loop_nodes_find (basic_block header, struct loop *loop) return num_nodes; } +/* Records the vector of superloops of the loop LOOP, whose immediate + superloop is FATHER. */ + static void -establish_preds (struct loop *loop) +establish_preds (struct loop *loop, struct loop *father) { - struct loop *ploop, *father = loop->outer; - - loop->depth = father->depth + 1; + loop_p ploop; + unsigned depth = loop_depth (father) + 1; + unsigned i; /* Remember the current loop depth if it is the largest seen so far. */ - cfun->max_loop_depth = MAX (cfun->max_loop_depth, loop->depth); + cfun->max_loop_depth = MAX (cfun->max_loop_depth, (int) depth); - if (loop->pred) - free (loop->pred); - loop->pred = XNEWVEC (struct loop *, loop->depth); - memcpy (loop->pred, father->pred, sizeof (struct loop *) * father->depth); - loop->pred[father->depth] = father; + VEC_truncate (loop_p, loop->superloops, 0); + VEC_reserve (loop_p, heap, loop->superloops, depth); + for (i = 0; VEC_iterate (loop_p, father->superloops, i, ploop); i++) + VEC_quick_push (loop_p, loop->superloops, ploop); + VEC_quick_push (loop_p, loop->superloops, father); for (ploop = loop->inner; ploop; ploop = ploop->next) - establish_preds (ploop); + establish_preds (ploop, loop); } /* Add LOOP to the loop hierarchy tree where FATHER is father of the @@ -297,9 +304,8 @@ flow_loop_tree_node_add (struct loop *father, struct loop *loop) { loop->next = father->inner; father->inner = loop; - loop->outer = father; - establish_preds (loop); + establish_preds (loop, father); } /* Remove LOOP from the loop hierarchy tree. */ @@ -309,21 +315,19 @@ flow_loop_tree_node_remove (struct loop *loop) { struct loop *prev, *father; - father = loop->outer; - loop->outer = NULL; + father = loop_outer (loop); /* Remove loop from the list of sons. */ if (father->inner == loop) father->inner = loop->next; else { - for (prev = father->inner; prev->next != loop; prev = prev->next); + for (prev = father->inner; prev->next != loop; prev = prev->next) + continue; prev->next = loop->next; } - loop->depth = -1; - free (loop->pred); - loop->pred = NULL; + VEC_truncate (loop_p, loop->superloops, 0); } /* Allocates and returns new loop structure. */ @@ -994,7 +998,7 @@ rescan_loop_exit (edge e, bool new_edge, bool removed) cloop = find_common_loop (e->src->loop_father, e->dest->loop_father); for (aloop = e->src->loop_father; aloop != cloop; - aloop = aloop->outer) + aloop = loop_outer (aloop)) { exit = XNEW (struct loop_exit); exit->e = e; @@ -1161,16 +1165,17 @@ num_loop_branches (const struct loop *loop) void add_bb_to_loop (basic_block bb, struct loop *loop) { - int i; + unsigned i; + loop_p ploop; edge_iterator ei; edge e; gcc_assert (bb->loop_father == NULL); bb->loop_father = loop; - bb->loop_depth = loop->depth; + bb->loop_depth = loop_depth (loop); loop->num_nodes++; - for (i = 0; i < loop->depth; i++) - loop->pred[i]->num_nodes++; + for (i = 0; VEC_iterate (loop_p, loop->superloops, i, ploop); i++) + ploop->num_nodes++; FOR_EACH_EDGE (e, ei, bb->succs) { @@ -1188,13 +1193,14 @@ remove_bb_from_loops (basic_block bb) { int i; struct loop *loop = bb->loop_father; + loop_p ploop; edge_iterator ei; edge e; gcc_assert (loop != NULL); loop->num_nodes--; - for (i = 0; i < loop->depth; i++) - loop->pred[i]->num_nodes--; + for (i = 0; VEC_iterate (loop_p, loop->superloops, i, ploop); i++) + ploop->num_nodes--; bb->loop_father = NULL; bb->loop_depth = 0; @@ -1212,18 +1218,23 @@ remove_bb_from_loops (basic_block bb) struct loop * find_common_loop (struct loop *loop_s, struct loop *loop_d) { + unsigned sdepth, ddepth; + if (!loop_s) return loop_d; if (!loop_d) return loop_s; - if (loop_s->depth < loop_d->depth) - loop_d = loop_d->pred[loop_s->depth]; - else if (loop_s->depth > loop_d->depth) - loop_s = loop_s->pred[loop_d->depth]; + sdepth = loop_depth (loop_s); + ddepth = loop_depth (loop_d); + + if (sdepth < ddepth) + loop_d = VEC_index (loop_p, loop_d->superloops, sdepth); + else if (sdepth > ddepth) + loop_s = VEC_index (loop_p, loop_s->superloops, ddepth); while (loop_s != loop_d) { - loop_s = loop_s->outer; - loop_d = loop_d->outer; + loop_s = loop_outer (loop_s); + loop_d = loop_outer (loop_d); } return loop_s; } @@ -1250,13 +1261,14 @@ cancel_loop (struct loop *loop) { basic_block *bbs; unsigned i; + struct loop *outer = loop_outer (loop); gcc_assert (!loop->inner); /* Move blocks up one level (they should be removed as soon as possible). */ bbs = get_loop_body (loop); for (i = 0; i < loop->num_nodes; i++) - bbs[i]->loop_father = loop->outer; + bbs[i]->loop_father = outer; delete_loop (loop); } @@ -1295,7 +1307,7 @@ verify_loop_structure (void) sizes[0] = 2; FOR_EACH_BB (bb) - for (loop = bb->loop_father; loop; loop = loop->outer) + for (loop = bb->loop_father; loop; loop = loop_outer (loop)) sizes[loop->num]++; FOR_EACH_LOOP (li, loop, LI_INCLUDE_ROOT) @@ -1494,7 +1506,7 @@ verify_loop_structure (void) for (loop = bb->loop_father; loop != e->dest->loop_father; - loop = loop->outer) + loop = loop_outer (loop)) { eloops--; sizes[loop->num]++; diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h index ef70a71c981..4c33c9cc056 100644 --- a/gcc/cfgloop.h +++ b/gcc/cfgloop.h @@ -85,6 +85,10 @@ struct loop_exit struct loop_exit *next_e; }; +typedef struct loop *loop_p; +DEF_VEC_P (loop_p); +DEF_VEC_ALLOC_P (loop_p, heap); + /* Structure to hold information for each natural loop. */ struct loop { @@ -109,14 +113,8 @@ struct loop /* Number of blocks contained within the loop. */ unsigned num_nodes; - /* The loop nesting depth. */ - int depth; - - /* Superloops of the loop. */ - struct loop **pred; - - /* The outer (parent) loop or NULL if outermost loop. */ - struct loop *outer; + /* Superloops of the loop, starting with the outermost loop. */ + VEC (loop_p, heap) *superloops; /* The first inner (child) loop or NULL if innermost loop. */ struct loop *inner; @@ -178,10 +176,6 @@ enum | LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS) #define AVOID_CFG_MODIFICATIONS (LOOPS_MAY_HAVE_MULTIPLE_LATCHES) -typedef struct loop *loop_p; -DEF_VEC_P (loop_p); -DEF_VEC_ALLOC_P (loop_p, heap); - /* Structure to hold CFG information about natural loops within a function. */ struct loops { @@ -410,6 +404,28 @@ get_loop (unsigned num) return VEC_index (loop_p, current_loops->larray, num); } +/* Returns the number of superloops of LOOP. */ + +static inline unsigned +loop_depth (const struct loop *loop) +{ + return VEC_length (loop_p, loop->superloops); +} + +/* Returns the immediate superloop of LOOP, or NULL if LOOP is the outermost + loop. */ + +static inline struct loop * +loop_outer (const struct loop *loop) +{ + unsigned n = VEC_length (loop_p, loop->superloops); + + if (n == 0) + return NULL; + + return VEC_index (loop_p, loop->superloops, n - 1); +} + /* Returns the list of loops in current_loops. */ static inline VEC (loop_p, heap) * @@ -519,10 +535,10 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) aloop = aloop->inner) continue; } - else if (!aloop->outer) + else if (!loop_outer (aloop)) break; else - aloop = aloop->outer; + aloop = loop_outer (aloop); } } else @@ -539,7 +555,7 @@ fel_init (loop_iterator *li, loop_p *loop, unsigned flags) else { while (aloop != NULL && aloop->next == NULL) - aloop = aloop->outer; + aloop = loop_outer (aloop); if (aloop == NULL) break; aloop = aloop->next; diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 7baa30a4899..54d00ce574c 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -276,7 +276,8 @@ mark_irreducible_loops (void) int num = current_loops ? number_of_loops () : 1; int *queue1 = XNEWVEC (int, last_basic_block + num); int *queue2 = XNEWVEC (int, last_basic_block + num); - int nq, depth; + int nq; + unsigned depth; struct loop *cloop, *loop; loop_iterator li; @@ -321,12 +322,13 @@ mark_irreducible_loops (void) if (!flow_bb_inside_loop_p (act->loop_father, e->dest)) { - depth = find_common_loop (act->loop_father, - e->dest->loop_father)->depth + 1; - if (depth == act->loop_father->depth) + depth = 1 + loop_depth (find_common_loop (act->loop_father, + e->dest->loop_father)); + if (depth == loop_depth (act->loop_father)) cloop = act->loop_father; else - cloop = act->loop_father->pred[depth]; + cloop = VEC_index (loop_p, act->loop_father->superloops, + depth); src = LOOP_REPR (cloop); } @@ -612,7 +614,7 @@ mark_loop_exit_edges (void) FOR_EACH_EDGE (e, ei, bb->succs) { - if (bb->loop_father->outer + if (loop_outer (bb->loop_father) && loop_exit_edge_p (bb->loop_father, e)) e->flags |= EDGE_LOOP_EXIT; else diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 0e876e566e1..a1af1111f15 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -102,7 +102,7 @@ fix_bb_placement (basic_block bb) act = e->dest->loop_father; if (act->header == e->dest) - act = act->outer; + act = loop_outer (act); if (flow_loop_nested_p (loop, act)) loop = act; @@ -138,9 +138,9 @@ fix_loop_placement (struct loop *loop) father = act; } - if (father != loop->outer) + if (father != loop_outer (loop)) { - for (act = loop->outer; act != father; act = act->outer) + for (act = loop_outer (loop); act != father; act = loop_outer (act)) act->num_nodes -= loop->num_nodes; flow_loop_tree_node_remove (loop); flow_loop_tree_node_add (father, loop); @@ -305,7 +305,7 @@ remove_path (edge e) we belong to. In this case first unloop the loops, then proceed normally. We may assume that e->dest is not a header of any loop, as it now has exactly one predecessor. */ - while (e->src->loop_father->outer + while (loop_outer (e->src->loop_father) && dominated_by_p (CDI_DOMINATORS, e->src->loop_father->latch, e->dest)) unloop (e->src->loop_father, &irred_invalidated); @@ -434,7 +434,7 @@ add_loop (struct loop *loop, struct loop *outer) /* If we find a direct subloop of OUTER, move it to LOOP. */ subloop = bbs[i]->loop_father; - if (subloop->outer == outer + if (loop_outer (subloop) == outer && subloop->header == bbs[i]) { flow_loop_tree_node_remove (subloop); @@ -477,7 +477,7 @@ loopify (edge latch_edge, edge header_edge, unsigned n_dom_bbs, i; sbitmap seen; struct loop *loop = alloc_loop (); - struct loop *outer = succ_bb->loop_father->outer; + struct loop *outer = loop_outer (succ_bb->loop_father); int freq; gcov_type cnt; edge e; @@ -592,7 +592,7 @@ unloop (struct loop *loop, bool *irred_invalidated) if (body[i]->loop_father == loop) { remove_bb_from_loops (body[i]); - add_bb_to_loop (body[i], loop->outer); + add_bb_to_loop (body[i], loop_outer (loop)); } free(body); @@ -600,7 +600,7 @@ unloop (struct loop *loop, bool *irred_invalidated) { ploop = loop->inner; flow_loop_tree_node_remove (ploop); - flow_loop_tree_node_add (loop->outer, ploop); + flow_loop_tree_node_add (loop_outer (loop), ploop); } /* Remove the loop and free its data. */ @@ -627,9 +627,9 @@ fix_loop_placements (struct loop *loop, bool *irred_invalidated) { struct loop *outer; - while (loop->outer) + while (loop_outer (loop)) { - outer = loop->outer; + outer = loop_outer (loop); if (!fix_loop_placement (loop)) break; @@ -1393,7 +1393,7 @@ fix_loop_structure (bitmap changed_bbs) FOR_EACH_BB (bb) { if (changed_bbs) - bb->aux = (void *) (size_t) bb->loop_father->depth; + bb->aux = (void *) (size_t) loop_depth (bb->loop_father); bb->loop_father = current_loops->tree_root; } @@ -1416,7 +1416,7 @@ fix_loop_structure (bitmap changed_bbs) { ploop = loop->inner; flow_loop_tree_node_remove (ploop); - flow_loop_tree_node_add (loop->outer, ploop); + flow_loop_tree_node_add (loop_outer (loop), ploop); } /* Remove the loop and free its data. */ @@ -1439,7 +1439,7 @@ fix_loop_structure (bitmap changed_bbs) FOR_EACH_LOOP (li, loop, 0) { ploop = superloop[loop->num]; - if (ploop != loop->outer) + if (ploop != loop_outer (loop)) { flow_loop_tree_node_remove (loop); flow_loop_tree_node_add (ploop, loop); @@ -1452,7 +1452,7 @@ fix_loop_structure (bitmap changed_bbs) { FOR_EACH_BB (bb) { - if ((void *) (size_t) bb->loop_father->depth != bb->aux) + if ((void *) (size_t) loop_depth (bb->loop_father) != bb->aux) bitmap_set_bit (changed_bbs, bb->index); bb->aux = NULL; diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index 655c0258230..579c3d3fb7f 100644 --- a/gcc/lambda-code.c +++ b/gcc/lambda-code.c @@ -1187,12 +1187,11 @@ invariant_in_loop_and_outer_loops (struct loop *loop, tree op) { if (is_gimple_min_invariant (op)) return true; - if (loop->depth == 0) + if (loop_depth (loop) == 0) return true; if (!expr_invariant_in_loop_p (loop, op)) return false; - if (loop->outer - && !invariant_in_loop_and_outer_loops (loop->outer, op)) + if (!invariant_in_loop_and_outer_loops (loop_outer (loop), op)) return false; return true; } diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 7da7ed869e0..36278a3a9eb 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -811,7 +811,7 @@ static bool loop_canon_p (struct loop *loop) { - if (loop->inner || ! loop->outer) + if (loop->inner || !loop_outer (loop)) return false; if (!single_exit (loop)) diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 0b0ed867591..15beeabb544 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -4367,7 +4367,7 @@ tree_duplicate_sese_region (edge entry, edge exit, if (loop->header == entry->dest) { copying_header = true; - loop->copy = loop->outer; + loop->copy = loop_outer (loop); if (!dominated_by_p (CDI_DOMINATORS, loop->latch, exit->src)) return false; diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c index 76bb2dd1f28..f0dfa7ac490 100644 --- a/gcc/tree-loop-linear.c +++ b/gcc/tree-loop-linear.c @@ -117,7 +117,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations, for (j = 0; j < DDR_NUM_DIST_VECTS (ddr); j++) { - int dist = DDR_DIST_VECT (ddr, j)[loop->depth - first_loop->depth]; + int dist = DDR_DIST_VECT (ddr, j)[loop_depth (loop) - loop_depth (first_loop)]; if (dist == 0) (*nb_deps_not_carried_by_loop) += 1; @@ -200,7 +200,7 @@ try_interchange_loops (lambda_trans_matrix trans, loop_j; loop_j = loop_j->inner) for (loop_i = first_loop; - loop_i->depth < loop_j->depth; + loop_depth (loop_i) < loop_depth (loop_j); loop_i = loop_i->inner) { gather_interchange_stats (dependence_relations, datarefs, @@ -230,14 +230,14 @@ try_interchange_loops (lambda_trans_matrix trans, || double_int_ucmp (access_strides_i, access_strides_j) < 0) { lambda_matrix_row_exchange (LTM_MATRIX (trans), - loop_i->depth - first_loop->depth, - loop_j->depth - first_loop->depth); + loop_depth (loop_i) - loop_depth (first_loop), + loop_depth (loop_j) - loop_depth (first_loop)); /* Validate the resulting matrix. When the transformation is not valid, reverse to the previous transformation. */ if (!lambda_transform_legal_p (trans, depth, dependence_relations)) lambda_matrix_row_exchange (LTM_MATRIX (trans), - loop_i->depth - first_loop->depth, - loop_j->depth - first_loop->depth); + loop_depth (loop_i) - loop_depth (first_loop), + loop_depth (loop_j) - loop_depth (first_loop)); } } diff --git a/gcc/tree-scalar-evolution.c b/gcc/tree-scalar-evolution.c index 955240b6895..b2a266bbf46 100644 --- a/gcc/tree-scalar-evolution.c +++ b/gcc/tree-scalar-evolution.c @@ -1534,7 +1534,7 @@ interpret_loop_phi (struct loop *loop, tree loop_phi_node) (phi_loop, PHI_RESULT (loop_phi_node)); /* Dive one level deeper. */ - subloop = superloop_at_depth (phi_loop, loop->depth + 1); + subloop = superloop_at_depth (phi_loop, loop_depth (loop) + 1); /* Interpret the subloop. */ res = compute_overall_effect_of_inner_loop (subloop, evolution_fn); @@ -1680,7 +1680,7 @@ compute_scalar_evolution_in_loop (struct loop *wrto_loop, if (def_loop == wrto_loop) return ev; - def_loop = superloop_at_depth (def_loop, wrto_loop->depth + 1); + def_loop = superloop_at_depth (def_loop, loop_depth (wrto_loop) + 1); res = compute_overall_effect_of_inner_loop (def_loop, ev); return analyze_scalar_evolution_1 (wrto_loop, res, chrec_not_analyzed_yet); @@ -2023,7 +2023,7 @@ analyze_scalar_evolution_in_loop (struct loop *wrto_loop, struct loop *use_loop, || !val) return chrec_dont_know; - use_loop = use_loop->outer; + use_loop = loop_outer (use_loop); } } @@ -2169,8 +2169,8 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache /* Don't instantiate loop-closed-ssa phi nodes. */ if (TREE_CODE (res) == SSA_NAME && (loop_containing_stmt (SSA_NAME_DEF_STMT (res)) == NULL - || (loop_containing_stmt (SSA_NAME_DEF_STMT (res))->depth - > def_loop->depth))) + || (loop_depth (loop_containing_stmt (SSA_NAME_DEF_STMT (res))) + > loop_depth (def_loop)))) { if (res == chrec) res = loop_closed_phi_def (chrec); @@ -2966,7 +2966,8 @@ scev_const_prop (void) tree_block_label (exit->dest); bsi = bsi_after_labels (exit->dest); - ex_loop = superloop_at_depth (loop, exit->dest->loop_father->depth + 1); + ex_loop = superloop_at_depth (loop, + loop_depth (exit->dest->loop_father) + 1); for (phi = phi_nodes (exit->dest); phi; phi = next_phi) { diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 1d0c4ade303..c3fb5424591 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -316,10 +316,10 @@ outermost_invariant_loop (tree def, struct loop *loop) if (LIM_DATA (def_stmt) && LIM_DATA (def_stmt)->max_loop) max_loop = find_common_loop (max_loop, - LIM_DATA (def_stmt)->max_loop->outer); + loop_outer (LIM_DATA (def_stmt)->max_loop)); if (max_loop == loop) return NULL; - max_loop = superloop_at_depth (loop, max_loop->depth + 1); + max_loop = superloop_at_depth (loop, loop_depth (max_loop) + 1); return max_loop; } @@ -525,7 +525,7 @@ set_level (tree stmt, struct loop *orig_loop, struct loop *level) stmt_loop = find_common_loop (orig_loop, stmt_loop); if (LIM_DATA (stmt) && LIM_DATA (stmt)->tgt_loop) stmt_loop = find_common_loop (stmt_loop, - LIM_DATA (stmt)->tgt_loop->outer); + loop_outer (LIM_DATA (stmt)->tgt_loop)); if (flow_loop_nested_p (stmt_loop, level)) return; @@ -709,12 +709,12 @@ determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED, bool maybe_never = ALWAYS_EXECUTED_IN (bb) == NULL; struct loop *outermost = ALWAYS_EXECUTED_IN (bb); - if (!bb->loop_father->outer) + if (!loop_outer (bb->loop_father)) return; if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Basic block %d (loop %d -- depth %d):\n\n", - bb->index, bb->loop_father->num, bb->loop_father->depth); + bb->index, bb->loop_father->num, loop_depth (bb->loop_father)); for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) { @@ -774,7 +774,7 @@ determine_invariantness_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED, { print_generic_stmt_indented (dump_file, stmt, 0, 2); fprintf (dump_file, " invariant up to level %d, cost %d.\n\n", - LIM_DATA (stmt)->max_loop->depth, + loop_depth (LIM_DATA (stmt)->max_loop), LIM_DATA (stmt)->cost); } @@ -815,7 +815,7 @@ move_computations_stmt (struct dom_walk_data *dw_data ATTRIBUTE_UNUSED, tree stmt; unsigned cost = 0; - if (!bb->loop_father->outer) + if (!loop_outer (bb->loop_father)) return; for (bsi = bsi_start (bb); !bsi_end_p (bsi); ) diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 3416df32d3c..16b126dc457 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -244,7 +244,7 @@ find_uses_to_rename_use (basic_block bb, tree use, bitmap *use_blocks, def_loop = def_bb->loop_father; /* If the definition is not inside loop, it is not interesting. */ - if (!def_loop->outer) + if (!loop_outer (def_loop)) return; if (!use_blocks[ver]) diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index f635334f19d..fc501261591 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -832,7 +832,7 @@ slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *loop, edge e) } /* Generate new loop structure. */ - new_loop = duplicate_loop (loop, loop->outer); + new_loop = duplicate_loop (loop, loop_outer (loop)); if (!new_loop) { free (bbs); @@ -962,7 +962,7 @@ slpeel_can_duplicate_loop_p (struct loop *loop, edge e) if (loop->inner /* All loops have an outer scope; the only case loop->outer is NULL is for the function itself. */ - || !loop->outer + || !loop_outer (loop) || loop->num_nodes != 2 || !empty_block_p (loop->latch) || !single_exit (loop) |