From: Steven Bosscher Date: Sun, 17 Dec 2006 20:27:25 +0000 (+0000) Subject: cse.c (have_eh_succ_edges): New function. X-Git-Tag: releases/gcc-4.3.0~7930 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a7582f7c6dd1b3b7cbc302cff8a9c839859c9567;p=thirdparty%2Fgcc.git cse.c (have_eh_succ_edges): New function. * cse.c (have_eh_succ_edges): New function. (cse_insn): Don't remove dead EH edges here (cse_extended_basic_block): Do it here. (rest_of_handle_cse, rest_of_handle_cse2): Don't assert that we have removed all dead edges. From-SVN: r119993 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 86cff5c55be1..30cd10676da2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-12-17 Steven Bosscher + + * cse.c (have_eh_succ_edges): New function. + (cse_insn): Don't remove dead EH edges here + (cse_extended_basic_block): Do it here. + (rest_of_handle_cse, rest_of_handle_cse2): Don't assert + that we have removed all dead edges. + 2006-12-17 Matthias Klose PR libstdc++/11953 diff --git a/gcc/cse.c b/gcc/cse.c index bd33190b5187..fae16dabcc2e 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -4858,13 +4858,6 @@ cse_insn (rtx insn, rtx libcall_insn) validate_change (insn, &SET_SRC (sets[i].rtl), new, 1); apply_change_group (); - /* With non-call exceptions, if this was an insn that could - trap, we may have made it non-throwing now. For example - we may have replaced a load with a register. */ - if (flag_non_call_exceptions - && insn == BB_END (BLOCK_FOR_INSN (insn))) - purge_dead_edges (BLOCK_FOR_INSN (insn)); - break; } @@ -5938,6 +5931,22 @@ cse_dump_path (struct cse_basic_block_data *data, int nsets, FILE *f) fflush (f); } + +/* Return true if BB has exception handling successor edges. */ + +static bool +have_eh_succ_edges (basic_block bb) +{ + edge e; + edge_iterator ei; + + FOR_EACH_EDGE (e, ei, bb->succs) + if (e->flags & EDGE_EH) + return true; + + return false; +} + /* Scan to the end of the path described by DATA. Return an estimate of the total number of SETs, and the lowest and highest insn CUID, of all @@ -6109,6 +6118,12 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data) /* Make sure that libcalls don't span multiple basic blocks. */ gcc_assert (libcall_insn == NULL_RTX); + /* With non-call exceptions, we are not always able to update + the CFG properly inside cse_insn. So clean up possibly + redundant EH edges here. */ + if (flag_non_call_exceptions && have_eh_succ_edges (bb)) + purge_dead_edges (bb); + /* If we changed a conditional jump, we may have terminated the path we are following. Check that by verifying that the edge we would take still exists. If the edge does @@ -6210,13 +6225,13 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs) INSN_CUID (insn) = ++i; } - /* Loop over basic blocks in DFS order, + /* Loop over basic blocks in reverse completion order (RPO), excluding the ENTRY and EXIT blocks. */ n_blocks = pre_and_rev_post_order_compute (NULL, rc_order, false); i = 0; while (i < n_blocks) { - /* Find the first block in the DFS queue that we have not yet + /* Find the first block in the RPO queue that we have not yet processed before. */ do { @@ -6988,10 +7003,6 @@ rest_of_handle_cse (void) expecting CSE to be run. But always rerun it in a cheap mode. */ cse_not_expected = !flag_rerun_cse_after_loop && !flag_gcse; - /* If there are dead edges to purge, we haven't properly updated - the CFG incrementally. */ - gcc_assert (!purge_all_dead_edges ()); - if (tem) rebuild_jump_labels (get_insns ()); @@ -7044,10 +7055,6 @@ rest_of_handle_cse2 (void) bypassed safely. */ cse_condition_code_reg (); - /* If there are dead edges to purge, we haven't properly updated - the CFG incrementally. */ - gcc_assert (!purge_all_dead_edges ()); - delete_trivially_dead_insns (get_insns (), max_reg_num ()); if (tem)