From 341c100fc52d5e5175ac3e3aa3caf096c8ac1378 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 7 Sep 2004 15:46:53 +0000 Subject: cfganal.c (flow_depth_first_order_compute, [...]): Use gcc_assert or gcc_unreachable. * 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. From-SVN: r87145 --- gcc/cfgloop.c | 61 ++++++++++++++++++++--------------------------------------- 1 file changed, 20 insertions(+), 41 deletions(-) (limited to 'gcc/cfgloop.c') diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 892b70d..01b9a46 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -107,8 +107,7 @@ flow_loop_nested_p (const struct loop *outer, const struct loop *loop) struct loop * superloop_at_depth (struct loop *loop, unsigned depth) { - if (depth > (unsigned) loop->depth) - abort (); + gcc_assert (depth <= (unsigned) loop->depth); if (depth == (unsigned) loop->depth) return loop; @@ -213,8 +212,7 @@ flow_loops_free (struct loops *loops) { unsigned i; - if (! loops->num) - abort (); + gcc_assert (loops->num); /* Free the loop descriptors. */ for (i = 0; i < loops->num; i++) @@ -253,8 +251,7 @@ flow_loop_entry_edges_find (struct loop *loop) num_entries++; } - if (! num_entries) - abort (); + gcc_assert (num_entries); loop->entry_edges = xmalloc (num_entries * sizeof (edge *)); @@ -794,8 +791,7 @@ flow_loops_find (struct loops *loops, int flags) /* This function cannot be repeatedly called with different flags to build up the loop information. The loop tree must always be built if this function is called. */ - if (! (flags & LOOP_TREE)) - abort (); + gcc_assert (flags & LOOP_TREE); memset (loops, 0, sizeof *loops); @@ -837,8 +833,7 @@ flow_loops_find (struct loops *loops, int flags) { basic_block latch = e->src; - if (e->flags & EDGE_ABNORMAL) - abort (); + gcc_assert (!(e->flags & EDGE_ABNORMAL)); /* Look for back edges where a predecessor is dominated by this block. A natural loop has a single entry @@ -849,8 +844,7 @@ flow_loops_find (struct loops *loops, int flags) && dominated_by_p (CDI_DOMINATORS, latch, header)) { /* Shared headers should be eliminated by now. */ - if (more_latches) - abort (); + gcc_assert (!more_latches); more_latches = 1; SET_BIT (headers, header->index); num_loops++; @@ -984,8 +978,7 @@ flow_bb_inside_loop_p (const struct loop *loop, const basic_block bb) bool flow_loop_outside_edge_p (const struct loop *loop, edge e) { - if (e->dest != loop->header) - abort (); + gcc_assert (e->dest == loop->header); return !flow_bb_inside_loop_p (loop, e->src); } @@ -1005,8 +998,7 @@ get_loop_body (const struct loop *loop) basic_block *tovisit, bb; unsigned tv = 0; - if (!loop->num_nodes) - abort (); + gcc_assert (loop->num_nodes); tovisit = xcalloc (loop->num_nodes, sizeof (basic_block)); tovisit[tv++] = loop->header; @@ -1014,8 +1006,7 @@ get_loop_body (const struct loop *loop) if (loop->latch == EXIT_BLOCK_PTR) { /* There may be blocks unreachable from EXIT_BLOCK. */ - if (loop->num_nodes != (unsigned) n_basic_blocks + 2) - abort (); + gcc_assert (loop->num_nodes == (unsigned) n_basic_blocks + 2); FOR_EACH_BB (bb) tovisit[tv++] = bb; tovisit[tv++] = EXIT_BLOCK_PTR; @@ -1027,8 +1018,7 @@ get_loop_body (const struct loop *loop) loop->header) + 1; } - if (tv != loop->num_nodes) - abort (); + gcc_assert (tv == loop->num_nodes); return tovisit; } @@ -1071,19 +1061,16 @@ get_loop_body_in_dom_order (const struct loop *loop) basic_block *tovisit; int tv; - if (!loop->num_nodes) - abort (); + gcc_assert (loop->num_nodes); tovisit = xcalloc (loop->num_nodes, sizeof (basic_block)); - if (loop->latch == EXIT_BLOCK_PTR) - abort (); + gcc_assert (loop->latch != EXIT_BLOCK_PTR); tv = 0; fill_sons_in_loop (loop, loop->header, tovisit, &tv); - if (tv != (int) loop->num_nodes) - abort (); + gcc_assert (tv == (int) loop->num_nodes); return tovisit; } @@ -1099,11 +1086,8 @@ get_loop_body_in_bfs_order (const struct loop *loop) unsigned int i = 0; unsigned int vc = 1; - if (!loop->num_nodes) - abort (); - - if (loop->latch == EXIT_BLOCK_PTR) - abort (); + gcc_assert (loop->num_nodes); + gcc_assert (loop->latch != EXIT_BLOCK_PTR); blocks = xcalloc (loop->num_nodes, sizeof (basic_block)); visited = BITMAP_XMALLOC (); @@ -1132,8 +1116,7 @@ get_loop_body_in_bfs_order (const struct loop *loop) } } - if (i < vc) - abort (); + gcc_assert (i >= vc); bb = blocks[vc++]; } @@ -1150,8 +1133,7 @@ get_loop_exit_edges (const struct loop *loop, unsigned int *n_edges) unsigned i, n; basic_block * body; - if (loop->latch == EXIT_BLOCK_PTR) - abort (); + gcc_assert (loop->latch != EXIT_BLOCK_PTR); body = get_loop_body (loop); n = 0; @@ -1179,8 +1161,7 @@ num_loop_branches (const struct loop *loop) unsigned i, n; basic_block * body; - if (loop->latch == EXIT_BLOCK_PTR) - abort (); + gcc_assert (loop->latch != EXIT_BLOCK_PTR); body = get_loop_body (loop); n = 0; @@ -1246,8 +1227,7 @@ cancel_loop (struct loops *loops, struct loop *loop) basic_block *bbs; unsigned i; - if (loop->inner) - abort (); + gcc_assert (!loop->inner); /* Move blocks up one level (they should be removed as soon as possible). */ bbs = get_loop_body (loop); @@ -1492,8 +1472,7 @@ verify_loop_structure (struct loops *loops) } } - if (err) - abort (); + gcc_assert (!err); free (sizes); } -- cgit v1.1