summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-17 20:27:25 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2006-12-17 20:27:25 +0000
commit99013338a81eb3bf5ea317e1c21ab63e934145bf (patch)
treeed0d26aaad0d636bc1d11a6a27977280077fed16
parent3bcef99fa3e41347ffc0920d3dc7289f51fc9126 (diff)
downloadppe42-gcc-99013338a81eb3bf5ea317e1c21ab63e934145bf.tar.gz
ppe42-gcc-99013338a81eb3bf5ea317e1c21ab63e934145bf.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119993 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/cse.c41
2 files changed, 32 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 86cff5c55be..30cd10676da 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2006-12-17 Steven Bosscher <steven@gcc.gnu.org>
+
+ * 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 <doko@debian.org>
PR libstdc++/11953
diff --git a/gcc/cse.c b/gcc/cse.c
index bd33190b518..fae16dabcc2 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;
}
@@ -5939,6 +5932,22 @@ cse_dump_path (struct cse_basic_block_data *data, int nsets, FILE *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
insns in the path. */
@@ -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)
OpenPOWER on IntegriCloud