From 86a1db604960e827a493f7b6bf74df6137e6e934 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 9 Mar 1999 07:49:53 -0800 Subject: [PATCH] flow.c (tidy_fallthru_edge): Be more careful finding the last BARRIER of a list. * flow.c (tidy_fallthru_edge): Be more careful finding the last BARRIER of a list. Delete the cc0 setter as well as a cond jump. From-SVN: r25656 --- gcc/ChangeLog | 5 +++++ gcc/flow.c | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a5b2a99169c..171d2eaebd55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 9 15:48:15 1999 Richard Henderson + + * flow.c (tidy_fallthru_edge): Be more careful finding the last + BARRIER of a list. Delete the cc0 setter as well as a cond jump. + Tue Mar 9 15:26:02 1999 Hans-Peter Nilsson * i386.md (ashlsi3 splitter): Fix typo in last change. diff --git a/gcc/flow.c b/gcc/flow.c index 3b4ef6e581d7..1e17112208e2 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -1933,7 +1933,7 @@ tidy_fallthru_edge (e, b, c) edge e; basic_block b, c; { - rtx p, q, h; + rtx q, h; /* ??? In a late-running flow pass, other folks may have deleted basic blocks by nopping out blocks, leaving multiple BARRIERs between here @@ -1943,12 +1943,10 @@ tidy_fallthru_edge (e, b, c) barriers and notes. */ q = NEXT_INSN (b->end); - do - { - p = q; - q = next_nonnote_insn (q); - } - while (GET_CODE (q) == BARRIER); + if (q && GET_CODE (q) == NOTE) + q = next_nonnote_insn (q); + while (q && GET_CODE (q) == BARRIER) + q = next_nonnote_insn (q); /* Assert that we now actually do fall through. */ h = c->head; @@ -1963,6 +1961,13 @@ tidy_fallthru_edge (e, b, c) q = b->end; if (GET_CODE (q) == JUMP_INSN) { +#ifdef HAVE_cc0 + /* If this was a conditional jump, we need to also delete + the insn that set cc0. */ + if (! simplejump_p (q) && condjump_p (q)) + q = PREV_INSN (q); +#endif + if (b->head == q) { PUT_CODE (q, NOTE); @@ -1974,7 +1979,8 @@ tidy_fallthru_edge (e, b, c) } /* Selectively unlink the sequence. */ - delete_insn_chain (NEXT_INSN (q), p); + if (q != PREV_INSN (c->head)) + delete_insn_chain (NEXT_INSN (q), PREV_INSN (c->head)); e->flags |= EDGE_FALLTHRU; } -- 2.43.5