This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch to fix PR58348
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Sep 2013 14:25:30 -0400
- Subject: patch to fix PR58348
- Authentication-results: sourceware.org; auth=none
The following patch fixes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58438
The patch was successfully bootstrapped and tested on x86/x86-64.
Committed as rev. 202714.
2013-09-18 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/58438
* lra.c (lra): Clear lra_optional_reload_pseudos in upper loop.
* lra-constraints.c (undo_optional_reloads): Keep optional reloads
from previous subpasses.
2013-09-18 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/58438
* g++.dg/pr58438.C: New test.
Index: lra.c
===================================================================
--- lra.c (revision 202626)
+++ lra.c (working copy)
@@ -2315,7 +2315,6 @@ lra (FILE *f)
{
for (;;)
{
- bitmap_clear (&lra_optional_reload_pseudos);
/* We should try to assign hard registers to scratches even
if there were no RTL transformations in
lra_constraints. */
@@ -2367,6 +2366,9 @@ lra (FILE *f)
lra_clear_live_ranges ();
}
}
+ /* Don't clear optional reloads bitmap until all constraints are
+ satisfied as we need to differ them from regular reloads. */
+ bitmap_clear (&lra_optional_reload_pseudos);
bitmap_clear (&lra_subreg_reload_pseudos);
bitmap_clear (&lra_inheritance_pseudos);
bitmap_clear (&lra_split_regs);
Index: lra-constraints.c
===================================================================
--- lra-constraints.c (revision 202630)
+++ lra-constraints.c (working copy)
@@ -5456,10 +5456,12 @@ undo_optional_reloads (void)
EXECUTE_IF_SET_IN_BITMAP (&lra_optional_reload_pseudos, 0, regno, bi)
{
keep_p = false;
- if (reg_renumber[lra_reg_info[regno].restore_regno] >= 0)
- /* If the original pseudo changed its allocation, just
- removing the optional pseudo is dangerous as the original
- pseudo will have longer live range. */
+ /* Keep optional reloads from previous subpasses. */
+ if (lra_reg_info[regno].restore_regno < 0
+ /* If the original pseudo changed its allocation, just
+ removing the optional pseudo is dangerous as the original
+ pseudo will have longer live range. */
+ || reg_renumber[lra_reg_info[regno].restore_regno] >= 0)
keep_p = true;
else if (reg_renumber[regno] >= 0)
EXECUTE_IF_SET_IN_BITMAP (&lra_reg_info[regno].insn_bitmap, 0, uid, bi2)