This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: patch to solve PR39522
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jeffrey Law <law at redhat dot com>
- Date: Wed, 25 Mar 2009 18:11:15 -0400
- Subject: RFA: patch to solve PR39522
The following patch solves PR39522. The details of the problem can be
found on
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39522
This patch actually a small corrections of my patch for PR37514. It
should behave the same way as the previous patch in all situations when
gcc with the previous patch is not aborting on gcc_assert. So I believe
the patch is safe.
Successfully bootstrapped and tested on x86_64 and ia64 (a target with
heavy usages of INC/DEC addressing).
Ok to commit?
2009-03-25 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/39522
* reload1.c (reload_as_needed): Invalidate reg_last_reload_reg too
when reg_reloaded_valid is set.
Index: reload1.c
===================================================================
--- reload1.c (revision 145015)
+++ reload1.c (working copy)
@@ -4367,29 +4367,39 @@ reload_as_needed (int live_known)
SET_REGNO_REG_SET (®_has_output_reload,
REGNO (XEXP (in_reg, 0)));
}
- else if ((code == PRE_INC || code == PRE_DEC
- || code == POST_INC || code == POST_DEC))
+ else if (code == PRE_INC || code == PRE_DEC
+ || code == POST_INC || code == POST_DEC)
{
- int in_hard_regno;
int in_regno = REGNO (XEXP (in_reg, 0));
if (reg_last_reload_reg[in_regno] != NULL_RTX)
{
+ int in_hard_regno;
+ bool forget_p = true;
+
in_hard_regno = REGNO (reg_last_reload_reg[in_regno]);
- gcc_assert (TEST_HARD_REG_BIT (reg_reloaded_valid,
- in_hard_regno));
- for (x = old_prev ? NEXT_INSN (old_prev) : insn;
- x != old_next;
- x = NEXT_INSN (x))
- if (x == reg_reloaded_insn[in_hard_regno])
- break;
+ if (TEST_HARD_REG_BIT (reg_reloaded_valid,
+ in_hard_regno))
+ {
+ for (x = old_prev ? NEXT_INSN (old_prev) : insn;
+ x != old_next;
+ x = NEXT_INSN (x))
+ if (x == reg_reloaded_insn[in_hard_regno])
+ {
+ forget_p = false;
+ break;
+ }
+ }
/* If for some reasons, we didn't set up
reg_last_reload_reg in this insn,
invalidate inheritance from previous
insns for the incremented/decremented
register. Such registers will be not in
- reg_has_output_reload. */
- if (x == old_next)
+ reg_has_output_reload. Invalidate it
+ also if the corresponding element in
+ reg_reloaded_insn is also
+ invalidated. */
+ if (forget_p)
forget_old_reloads_1 (XEXP (in_reg, 0),
NULL_RTX, NULL);
}