aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-05-04 16:41:15 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1994-05-04 16:41:15 -0400
commit761827969bfb2200a63850c4e97042389d0e503a (patch)
treec1b00fe737287b5431c3a4091b4af7f9f5e2ee17 /gcc
parent2b979c572605c9b2ffdaf68ef64615b71127d66f (diff)
downloadgcc-761827969bfb2200a63850c4e97042389d0e503a.zip
gcc-761827969bfb2200a63850c4e97042389d0e503a.tar.gz
gcc-761827969bfb2200a63850c4e97042389d0e503a.tar.bz2
(emit_reload_insns): Add another way to delete an output reload.
From-SVN: r7209
Diffstat (limited to 'gcc')
-rw-r--r--gcc/reload1.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 7a44245..c5877e3 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -5614,6 +5614,21 @@ emit_reload_insns (insn)
else if (GET_CODE (oldequiv) == SUBREG)
oldequiv_reg = SUBREG_REG (oldequiv);
+ /* If we are reloading from a register that was recently stored in
+ with an output-reload, see if we can prove there was
+ actually no need to store the old value in it. */
+
+ if (optimize && GET_CODE (oldequiv) == REG
+ && REGNO (oldequiv) < FIRST_PSEUDO_REGISTER
+ && spill_reg_order[REGNO (oldequiv)] >= 0
+ && spill_reg_store[reload_spill_index[REGNO (oldequiv)]] != 0
+ && dead_or_set_p (insn, reload_in[j])
+ /* This is unsafe if operand occurs more than once in current
+ insn. Perhaps some occurrences weren't reloaded. */
+ && count_occurrences (PATTERN (insn), reload_in[j]) == 1)
+ delete_output_reload
+ (insn, j, spill_reg_store[spill_reg_order[REGNO (oldequiv)]]);
+
/* Encapsulate both RELOADREG and OLDEQUIV into that mode,
then load RELOADREG from OLDEQUIV. Note that we cannot use
gen_lowpart_common since it can do the wrong thing when