From 761827969bfb2200a63850c4e97042389d0e503a Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Wed, 4 May 1994 16:41:15 -0400 Subject: [PATCH] (emit_reload_insns): Add another way to delete an output reload. From-SVN: r7209 --- gcc/reload1.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gcc/reload1.c b/gcc/reload1.c index 7a44245468c..c5877e3174a 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 -- 2.30.2