The following patch fixes a degradation of 20060102-1.c on ARM. Not
updating REG notes resulted in removing an insn after LRA as it was
wrongly considered dead.
The patch was successfully bootstrapped on x86/x86-64.
Committed as rev. 182664.
2011-12-23 Vladimir Makarov <vmaka...@redhat.com>
* lra.c (update_auto_inc_notes): Rename to update_reg_notes. Make
it unconditional. Remove REG_DEAD and REG_UNUSED too. Make call
of add_auto_inc_notes conditional.
Index: lra.c
===================================================================
--- lra.c (revision 182663)
+++ lra.c (working copy)
@@ -2032,10 +2032,14 @@ add_auto_inc_notes (rtx insn, rtx x)
}
}
-/* DF infrastructure does not deal with REG_INC notes -- so update
- them here. */
+#endif
+
+/* Remove all REG_DEAD and REG_UNUSED notes and regenerate REG_INC.
+ We change pseudos by hard registers without notification of DF and
+ that can make the notes obsolete. DF-infrastructure does not deal
+ with REG_INC notes -- so we should regenerate them here. */
static void
-update_auto_inc_notes (void)
+update_reg_notes (void)
{
rtx *pnote;
basic_block bb;
@@ -2048,17 +2052,19 @@ update_auto_inc_notes (void)
pnote = ®_NOTES (insn);
while (*pnote != 0)
{
- if (REG_NOTE_KIND (*pnote) == REG_INC)
+ if (REG_NOTE_KIND (*pnote) == REG_DEAD
+ || REG_NOTE_KIND (*pnote) == REG_UNUSED
+ || REG_NOTE_KIND (*pnote) == REG_INC)
*pnote = XEXP (*pnote, 1);
else
pnote = &XEXP (*pnote, 1);
}
+#ifdef AUTO_INC_DEC
add_auto_inc_notes (insn, PATTERN (insn));
+#endif
}
}
-#endif
-
/* Set to 1 while in lra. */
int lra_in_progress;
@@ -2204,9 +2210,7 @@ lra (FILE *f)
regstat_free_n_sets_and_refs ();
regstat_free_ri ();
reload_completed = 1;
-#ifdef AUTO_INC_DEC
- update_auto_inc_notes ();
-#endif
+ update_reg_notes ();
finish_subregs_of_mode ();
inserted_p = fixup_abnormal_edges ();