summaryrefslogtreecommitdiff
path: root/gcc/lra.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/lra.c')
-rw-r--r--gcc/lra.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/lra.c b/gcc/lra.c
index 269a0f14f74..a29266e7ecc 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2260,6 +2260,7 @@ lra (FILE *f)
lra_live_range_iter = lra_coalesce_iter = lra_constraint_iter = 0;
lra_assignment_iter = lra_assignment_iter_after_spill = 0;
lra_inheritance_iter = lra_undo_inheritance_iter = 0;
+ lra_rematerialization_iter = 0;
setup_reg_spill_flag ();
@@ -2405,7 +2406,12 @@ lra (FILE *f)
/* Assignment of stack slots changes elimination offsets for
some eliminations. So update the offsets here. */
lra_eliminate (false, false);
- lra_constraint_new_regno_start = max_reg_num ();
+ /* After switching off inheritance and rematerialization passes,
+ don't forget reload pseudos after spilling sub-pass to avoid
+ LRA cycling in some complicated cases. */
+ if (lra_inheritance_iter <= LRA_MAX_INHERITANCE_PASSES
+ || lra_rematerialization_iter <= LRA_MAX_REMATERIALIZATION_PASSES)
+ lra_constraint_new_regno_start = max_reg_num ();
lra_assignment_iter_after_spill = 0;
}
restore_scratches ();