aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1995-04-17 13:55:26 -0700
committerJim Wilson <wilson@gcc.gnu.org>1995-04-17 13:55:26 -0700
commite340018d59ced3ea94209a8c28ba6330865eb18d (patch)
tree0f5e8793673b921863a00a9620d3e72741e95b30
parent0d9641d106bb9d99a32f98ed5be56f2aef3ff8b1 (diff)
downloadgcc-e340018d59ced3ea94209a8c28ba6330865eb18d.zip
gcc-e340018d59ced3ea94209a8c28ba6330865eb18d.tar.gz
gcc-e340018d59ced3ea94209a8c28ba6330865eb18d.tar.bz2
(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
-rw-r--r--gcc/combine.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index a95284a..f71db78 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);