From e340018d59ced3ea94209a8c28ba6330865eb18d Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Mon, 17 Apr 1995 13:55:26 -0700 Subject: [PATCH] (get_last_value): Ignore BARRIER when scanning backwards. (move_deaths): New variables before_dead and after_dead. Set them to instructions that have valid INSN_CUID values and use in test. From-SVN: r9397 --- gcc/combine.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/gcc/combine.c b/gcc/combine.c index a95284a1b19..f71db787f17 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -9961,10 +9961,13 @@ get_last_value (x) /* Skip over USE insns. They are not useful here, and they may have been made by combine, in which case they do not have a INSN_CUID value. We can't use prev_real_insn, because that would incorrectly - take us backwards across labels. */ + take us backwards across labels. Skip over BARRIERs also, since + they could have been made by combine. If we see one, we must be + optimizing dead code, so it doesn't matter what we do. */ for (insn = prev_nonnote_insn (subst_insn); insn && ((GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == USE) + || GET_CODE (insn) == BARRIER || INSN_CUID (insn) >= subst_low_cuid); insn = prev_nonnote_insn (insn)) ; @@ -10294,9 +10297,22 @@ move_deaths (x, from_cuid, to_insn, pnotes) { register int regno = REGNO (x); register rtx where_dead = reg_last_death[regno]; - - if (where_dead && INSN_CUID (where_dead) >= from_cuid - && INSN_CUID (where_dead) < INSN_CUID (to_insn)) + register rtx before_dead, after_dead; + + /* WHERE_DEAD could be a USE insn made by combine, so first we + make sure that we have insns with valid INSN_CUID values. */ + before_dead = where_dead; + while (before_dead && INSN_UID (before_dead) > max_uid_cuid) + before_dead = PREV_INSN (before_dead); + after_dead = where_dead; + while (after_dead && INSN_UID (after_dead) > max_uid_cuid) + after_dead = NEXT_INSN (after_dead); + + if (before_dead && after_dead + && INSN_CUID (before_dead) >= from_cuid + && (INSN_CUID (after_dead) < INSN_CUID (to_insn) + || (where_dead != after_dead + && INSN_CUID (after_dead) == INSN_CUID (to_insn)))) { rtx note = remove_death (regno, where_dead); -- 2.30.2