diff options
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r-- | gcc/cfgcleanup.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 1e4056a60f4..a2ff17d6981 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1577,16 +1577,16 @@ static bool try_optimize_cfg (mode) int mode; { - int i; bool changed_overall = false; bool changed; int iterations = 0; + basic_block bb, b; if (mode & CLEANUP_CROSSJUMP) add_noreturn_fake_exit_edges (); - for (i = 0; i < n_basic_blocks; i++) - update_forwarder_flag (BASIC_BLOCK (i)); + FOR_EACH_BB (bb) + update_forwarder_flag (bb); if (mode & CLEANUP_UPDATE_LIFE) clear_bb_flags (); @@ -1606,9 +1606,9 @@ try_optimize_cfg (mode) "\n\ntry_optimize_cfg iteration %i\n\n", iterations); - for (i = 0; i < n_basic_blocks;) + for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR;) { - basic_block c, b = BASIC_BLOCK (i); + basic_block c; edge s; bool changed_here = false; @@ -1721,7 +1721,7 @@ try_optimize_cfg (mode) /* Don't get confused by the index shift caused by deleting blocks. */ if (!changed_here) - i = b->index + 1; + b = b->next_bb; else changed = true; } @@ -1753,8 +1753,9 @@ try_optimize_cfg (mode) bool delete_unreachable_blocks () { - int i, j; bool changed = false; + basic_block b, next_bb; + int j = 0; find_unreachable_blocks (); @@ -1762,9 +1763,9 @@ delete_unreachable_blocks () as otherwise we can wind up with O(N^2) behaviour here when we have oodles of dead code. */ - for (i = j = 0; i < n_basic_blocks; ++i) + for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb) { - basic_block b = BASIC_BLOCK (i); + next_bb = b->next_bb; if (!(b->flags & BB_REACHABLE)) { |