diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-07 15:46:53 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-07 15:46:53 +0000 |
commit | cc636d560f756da291b909e5c1790ffba37c4e8c (patch) | |
tree | ce9be778c6fd5bbc5eb633ed0344673882ecdabe /gcc/cfgloopmanip.c | |
parent | 71bd4883d964169b14dfd5f83896fbc07cf2b55c (diff) | |
download | gcc-cc636d560f756da291b909e5c1790ffba37c4e8c.tar.gz |
* cfganal.c (flow_depth_first_order_compute, dfs_enumerate_from,
cfgbuild.c, inside_basic_block_p, control_flow_insn_p,
make_label_edge, make_edges, find_basic_blocks_1): Use gcc_assert
or gcc_unreachable.
* cfg.c (clear_edges, initialize_bb_rbi, compact_blocks,
remove_edge, alloc_aux_for_blocks, free_aux_for_blocks,
alloc_aux_for_edges, free_aux_for_edges): Likewise.
* cfgcleanup.c (try_forward_edges,
merge_blocks_move_predecessor_nojumps,
merge_blocks_move_successor_nojumps): Likewise.
* cfgexpand.c (expand_gimple_cond_expr,
expand_gimple_tailcall): Likewise.
* cfghooks.c (duplicate_block): Likewise.
* cfglayout.c (record_effective_endpoints,
insn_locators_initialize, change_scope, fixup_reorder_chain,
verify_insn_chain, fixup_fallthru_exit_predecessor,
duplicate_insn_chain, cfg_layout_finalize): Likewise.
* cfgloopanal.c (check_irred): Likewise.
* cfgloop.c (superloop_at_depth, flow_loops_free,
flow_loop_entry_edges_find, flow_loops_find,
flow_loop_outside_edge_p, get_loop_body,
get_loop_body_in_dom_order, get_loop_body_in_bfs_order,
get_loop_exit_edges, num_loop_branches, cancel_loop,
verify_loop_structure): Likewise.
cfgloopmanip.c (find_path, remove_path, loop_delete_branch_edge,
duplicate_loop_to_header_edge, create_preheader,
create_loop_notes): Likewise.
* cfgrtl.c (delete_insn, try_redirect_by_replacing_jump,
edirect_branch_edge, force_nonfallthru_and_redirect,
rtl_split_edge, insert_insn_on_edge, commit_one_edge_insertion,
commit_edge_insertions, commit_edge_insertions_watch_calls,
purge_dead_edges, cfg_layout_redirect_edge_and_branch,
cfg_layout_redirect_edge_and_branch_force,
cfg_layout_merge_blocks, rtl_flow_call_edges_add): Likewise.
* cgraph.c (cgraph_node, cgraph_create_edge, cgraph_remove_edge,
cgraph_redirect_edge_callee, cgraph_global_info, cgraph_rtl_info,
cgraph_varpool_node): Likewise.
* cgraphunit.c (cgraph_finalize_function,
cgraph_finalize_compilation_unit, cgraph_mark_functions_to_output,
cgraph_expand_function, cgraph_remove_unreachable_nodes,
cgraph_clone_inlined_nodes, cgraph_mark_inline_edge,
cgraph_mark_inline, cgraph_expand_all_functions,
cgraph_build_static_cdtor): Likewise.
* combine.c (do_SUBST, try_combine, subst, combine_simplify_rtx,
simplify_logical, distribute_notes, insn_cuid): Likewise.
* conflict.c (conflict_graph_add, print_conflict): Likewise.
* coverage.c (rtl_coverage_counter_ref, tree_coverage_counter_ref,
coverage_checksum_string): Likewise.
* cse.c (make_new_qty, make_regs_eqv, insert, invalidate,
hash_rtx, exp_equiv_p, cse_basic_block, count_reg_usage,
cse_cc_succs, cse_condition_code_reg): Likewise.
* cselib.c (entry_and_rtx_equal_p, remove_useless_values,
rtx_equal_for_cselib_p, wrap_constant, cselib_hash_rtx,
new_cselib_val, cselib_subst_to_values, cselib_invalidate_regno,
cselib_record_set): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87145 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgloopmanip.c')
-rw-r--r-- | gcc/cfgloopmanip.c | 100 |
1 files changed, 40 insertions, 60 deletions
diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index 4d4005da1a9..62fb9d24e94 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -98,8 +98,7 @@ remove_bbs (basic_block *bbs, int nbbs) static int find_path (edge e, basic_block **bbs) { - if (e->dest->pred->pred_next) - abort (); + gcc_assert (!e->dest->pred->pred_next); /* Find bbs in the path. */ *bbs = xcalloc (n_basic_blocks, sizeof (basic_block)); @@ -323,6 +322,7 @@ remove_path (struct loops *loops, edge e) basic_block *rem_bbs, *bord_bbs, *dom_bbs, from, bb; int i, nrem, n_bord_bbs, n_dom_bbs; sbitmap seen; + bool deleted; if (!loop_delete_branch_edge (e, 0)) return false; @@ -367,8 +367,8 @@ remove_path (struct loops *loops, edge e) /* Remove the path. */ from = e->src; - if (!loop_delete_branch_edge (e, 1)) - abort (); + deleted = loop_delete_branch_edge (e, 1); + gcc_assert (deleted); dom_bbs = xcalloc (n_basic_blocks, sizeof (basic_block)); /* Cancel loops contained in the path. */ @@ -765,47 +765,37 @@ static bool loop_delete_branch_edge (edge e, int really_delete) { basic_block src = e->src; + basic_block newdest; int irr; edge snd; - if (src->succ->succ_next) - { - basic_block newdest; - - /* Cannot handle more than two exit edges. */ - if (src->succ->succ_next->succ_next) - return false; - /* And it must be just a simple branch. */ - if (!any_condjump_p (BB_END (src))) - return false; - - snd = e == src->succ ? src->succ->succ_next : src->succ; - newdest = snd->dest; - if (newdest == EXIT_BLOCK_PTR) - return false; - - /* Hopefully the above conditions should suffice. */ - if (!really_delete) - return true; + gcc_assert (src->succ->succ_next); + + /* Cannot handle more than two exit edges. */ + if (src->succ->succ_next->succ_next) + return false; + /* And it must be just a simple branch. */ + if (!any_condjump_p (BB_END (src))) + return false; - /* Redirecting behaves wrongly wrto this flag. */ - irr = snd->flags & EDGE_IRREDUCIBLE_LOOP; + snd = e == src->succ ? src->succ->succ_next : src->succ; + newdest = snd->dest; + if (newdest == EXIT_BLOCK_PTR) + return false; - if (!redirect_edge_and_branch (e, newdest)) - return false; - src->succ->flags &= ~EDGE_IRREDUCIBLE_LOOP; - src->succ->flags |= irr; + /* Hopefully the above conditions should suffice. */ + if (!really_delete) + return true; - return true; - } - else - { - /* Cannot happen -- we are using this only to remove an edge - from branch. */ - abort (); - } + /* Redirecting behaves wrongly wrto this flag. */ + irr = snd->flags & EDGE_IRREDUCIBLE_LOOP; - return false; /* To avoid warning, cannot get here. */ + if (!redirect_edge_and_branch (e, newdest)) + return false; + src->succ->flags &= ~EDGE_IRREDUCIBLE_LOOP; + src->succ->flags |= irr; + + return true; } /* Check whether LOOP's body can be duplicated. */ @@ -880,18 +870,14 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops, int prob_pass_thru, prob_pass_wont_exit, prob_pass_main; int add_irreducible_flag; - if (e->dest != loop->header) - abort (); - if (ndupl <= 0) - abort (); + gcc_assert (e->dest == loop->header); + gcc_assert (ndupl > 0); if (orig) { /* Orig must be edge out of the loop. */ - if (!flow_bb_inside_loop_p (loop, orig->src)) - abort (); - if (flow_bb_inside_loop_p (loop, orig->dest)) - abort (); + gcc_assert (flow_bb_inside_loop_p (loop, orig->src)); + gcc_assert (!flow_bb_inside_loop_p (loop, orig->dest)); } bbs = get_loop_body (loop); @@ -907,8 +893,7 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops, /* In case we are doing loop peeling and the loop is in the middle of irreducible region, the peeled copies will be inside it too. */ add_irreducible_flag = e->flags & EDGE_IRREDUCIBLE_LOOP; - if (is_latch && add_irreducible_flag) - abort (); + gcc_assert (!is_latch || !add_irreducible_flag); /* Find edge from latch. */ latch_edge = loop_latch_edge (loop); @@ -960,11 +945,9 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops, scale_act = REG_BR_PROB_BASE - prob_pass_thru; } for (i = 0; i < ndupl; i++) - if (scale_step[i] < 0 || scale_step[i] > REG_BR_PROB_BASE) - abort (); - if (scale_main < 0 || scale_main > REG_BR_PROB_BASE - || scale_act < 0 || scale_act > REG_BR_PROB_BASE) - abort (); + gcc_assert (scale_step[i] >= 0 && scale_step[i] <= REG_BR_PROB_BASE); + gcc_assert (scale_main >= 0 && scale_main <= REG_BR_PROB_BASE + && scale_act >= 0 && scale_act <= REG_BR_PROB_BASE); } /* Loop the new bbs will belong to. */ @@ -1154,8 +1137,7 @@ create_preheader (struct loop *loop, int flags) irred |= (e->flags & EDGE_IRREDUCIBLE_LOOP) != 0; nentry++; } - if (!nentry) - abort (); + gcc_assert (nentry); if (nentry == 1) { for (e = loop->header->pred; e->src == loop->latch; e = e->pred_next); @@ -1285,9 +1267,8 @@ create_loop_notes (void) #ifdef ENABLE_CHECKING /* Verify that there really are no loop notes. */ for (insn = get_insns (); insn; insn = NEXT_INSN (insn)) - if (NOTE_P (insn) - && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG) - abort (); + gcc_assert (!NOTE_P (insn) || + NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG); #endif flow_loops_find (&loops, LOOP_TREE); @@ -1335,8 +1316,7 @@ create_loop_notes (void) && onlyjump_p (insn)) { pbb = BLOCK_FOR_INSN (insn); - if (!pbb || !pbb->succ || pbb->succ->succ_next) - abort (); + gcc_assert (pbb && pbb->succ && !pbb->succ->succ_next); if (!flow_bb_inside_loop_p (loop, pbb->succ->dest)) insn = BB_HEAD (first[loop->num]); |