aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-03-25 16:30:35 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-03-25 16:30:35 -0800
commit6b2e80b7b46f99a60eefaa349e1cce2bb50344cd (patch)
treec4f8d4bdc6a7c010706486f85f40149100773970 /gcc
parent9ad6276f020d76c928e1b64167e32208bd012dc5 (diff)
downloadgcc-6b2e80b7b46f99a60eefaa349e1cce2bb50344cd.zip
gcc-6b2e80b7b46f99a60eefaa349e1cce2bb50344cd.tar.gz
gcc-6b2e80b7b46f99a60eefaa349e1cce2bb50344cd.tar.bz2
recog.c (peephole2_optimize): Distribute EH_REGION -1 notes anywhere in the block.
* recog.c (peephole2_optimize): Distribute EH_REGION -1 notes anywhere in the block. Don't refer to insns that have been removed from the chain. Iterate backward through the new insns. Don't refer to edges that have been removed. From-SVN: r51357
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/recog.c30
2 files changed, 27 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bab7fdd..e030917 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2002-03-25 Richard Henderson <rth@redhat.com>
+
+ * recog.c (peephole2_optimize): Distribute EH_REGION -1 notes
+ anywhere in the block. Don't refer to insns that have been
+ removed from the chain. Iterate backward through the new insns.
+ Don't refer to edges that have been removed.
+
2002-03-26 Alan Modra <amodra@bigpond.net.au>
* combine.c (simplify_comparison <ASHIFTRT, LSHIFTRT>): Correct
diff --git a/gcc/recog.c b/gcc/recog.c
index 769c267..3289f6e 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3045,7 +3045,7 @@ peephole2_optimize (dump_file)
prev = PREV_INSN (insn);
if (INSN_P (insn))
{
- rtx try;
+ rtx try, before_try;
int match_len;
rtx note;
@@ -3128,14 +3128,16 @@ peephole2_optimize (dump_file)
if (i >= MAX_INSNS_PER_PEEP2 + 1)
i -= MAX_INSNS_PER_PEEP2 + 1;
+ note = find_reg_note (peep2_insn_data[i].insn,
+ REG_EH_REGION, NULL_RTX);
+
/* Replace the old sequence with the new. */
try = emit_insn_after (try, peep2_insn_data[i].insn);
+ before_try = PREV_INSN (insn);
delete_insn_chain (insn, peep2_insn_data[i].insn);
/* Re-insert the EH_REGION notes. */
- if (try == bb->end
- && (note = find_reg_note (peep2_insn_data[i].insn,
- REG_EH_REGION, NULL_RTX)))
+ if (note)
{
rtx x;
edge eh_edge;
@@ -3145,11 +3147,11 @@ peephole2_optimize (dump_file)
if (eh_edge->flags & EDGE_EH)
break;
- for (x = NEXT_INSN (peep2_insn_data[i].insn);
- x != NEXT_INSN (try); x = NEXT_INSN (x))
+ for (x = try ; x != before_try ; x = PREV_INSN (x))
if (GET_CODE (x) == CALL_INSN
|| (flag_non_call_exceptions
- && may_trap_p (PATTERN (x))))
+ && may_trap_p (PATTERN (x))
+ && !find_reg_note (x, REG_EH_REGION, NULL)))
{
REG_NOTES (x)
= gen_rtx_EXPR_LIST (REG_EH_REGION,
@@ -3158,9 +3160,16 @@ peephole2_optimize (dump_file)
if (x != bb->end && eh_edge)
{
- edge nfte = split_block (bb, x);
- edge nehe = make_edge (nfte->src, eh_edge->dest,
- eh_edge->flags);
+ edge nfte, nehe;
+ int flags;
+
+ nfte = split_block (bb, x);
+ flags = EDGE_EH | EDGE_ABNORMAL;
+ if (GET_CODE (x) == CALL_INSN)
+ flags |= EDGE_ABNORMAL_CALL;
+ nehe = make_edge (nfte->src, eh_edge->dest,
+ flags);
+
nehe->probability = eh_edge->probability;
nfte->probability
= REG_BR_PROB_BASE - nehe->probability;
@@ -3171,6 +3180,7 @@ peephole2_optimize (dump_file)
changed = true;
#endif
bb = nfte->src;
+ eh_edge = nehe;
}
}