This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch to fix PR78287
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 16 Feb 2017 14:48:24 -0500
- Subject: patch to fix PR78287
- Authentication-results: sourceware.org; auth=none
The following patch fixes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78127
The patch was successfully bootstrapped and tested on x86-64.
Committed as rev. 245514.
Index: ChangeLog
===================================================================
--- ChangeLog (revision 245513)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2017-02-16 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/78127
+ * lra.c (lra): Call lra_eliminate before finish the loop after
+ lra_constraint.
+
2017-02-16 Richard Biener <rguenther@suse.de>
* graphite.h: Do not include isl/isl_val_gmp.h, instead include
Index: lra.c
===================================================================
--- lra.c (revision 245513)
+++ lra.c (working copy)
@@ -2389,14 +2389,7 @@ lra (FILE *f)
{
for (;;)
{
- /* We should try to assign hard registers to scratches even
- if there were no RTL transformations in lra_constraints.
- Also we should check IRA assignments on the first
- iteration as they can be wrong because of early clobbers
- operands which are ignored in IRA. */
- if (! lra_constraints (lra_constraint_iter == 0)
- && lra_constraint_iter > 1)
- break;
+ bool reloads_p = lra_constraints (lra_constraint_iter == 0);
/* Constraint transformations may result in that eliminable
hard regs become uneliminable and pseudos which use them
should be spilled. It is better to do it before pseudo
@@ -2406,6 +2399,23 @@ lra (FILE *f)
RS6000_PIC_OFFSET_TABLE_REGNUM uneliminable if we started
to use a constant pool. */
lra_eliminate (false, false);
+ /* We should try to assign hard registers to scratches even
+ if there were no RTL transformations in lra_constraints.
+ Also we should check IRA assignments on the first
+ iteration as they can be wrong because of early clobbers
+ operands which are ignored in IRA. */
+ if (! reloads_p && lra_constraint_iter > 1)
+ {
+ /* Stack is not empty here only when there are changes
+ during the elimination sub-pass. */
+ if (bitmap_empty_p (lra_constraint_insn_stack_bitmap))
+ break;
+ else
+ /* If there are no reloads but changing due
+ elimination, restart the constraint sub-pass
+ first. */
+ continue;
+ }
/* Do inheritance only for regular algorithms. */
if (! lra_simple_p)
{