summaryrefslogtreecommitdiff
path: root/gcc/lra.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/lra.c')
-rw-r--r--gcc/lra.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/lra.c b/gcc/lra.c
index a29266e7ecc..f4d7a3c071f 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2180,6 +2180,10 @@ int lra_new_regno_start;
/* Start of reload pseudo regnos before the new spill pass. */
int lra_constraint_new_regno_start;
+/* Avoid spilling pseudos with regno more than the following value if
+ it is possible. */
+int lra_bad_spill_regno_start;
+
/* Inheritance pseudo regnos before the new spill pass. */
bitmap_head lra_inheritance_pseudos;
@@ -2269,6 +2273,7 @@ lra (FILE *f)
permit changing reg classes for pseudos created by this
simplification. */
lra_constraint_new_regno_start = lra_new_regno_start = max_reg_num ();
+ lra_bad_spill_regno_start = INT_MAX;
remove_scratches ();
scratch_p = lra_constraint_new_regno_start != max_reg_num ();
@@ -2406,12 +2411,14 @@ lra (FILE *f)
/* Assignment of stack slots changes elimination offsets for
some eliminations. So update the offsets here. */
lra_eliminate (false, false);
- /* 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_constraint_new_regno_start = max_reg_num ();
+ if (lra_bad_spill_regno_start == INT_MAX
+ && lra_inheritance_iter > LRA_MAX_INHERITANCE_PASSES
+ && lra_rematerialization_iter > LRA_MAX_REMATERIALIZATION_PASSES)
+ /* After switching off inheritance and rematerialization
+ passes, avoid spilling reload pseudos will be created to
+ prevent LRA cycling in some complicated cases. */
+ lra_bad_spill_regno_start = lra_constraint_new_regno_start;
lra_assignment_iter_after_spill = 0;
}
restore_scratches ();