===================================================================
@@ -1084,6 +1084,8 @@ improve_inheritance (bitmap changed_pseu
lra_copy_t cp, next_cp;
bitmap_iterator bi;
+ if (lra_inheritance_iter > LRA_MAX_INHERITANCE_PASSES)
+ return;
n = 0;
EXECUTE_IF_SET_IN_BITMAP (&lra_inheritance_pseudos, 0, k, bi)
if (reg_renumber[k] >= 0 && lra_reg_info[k].nrefs != 0)
===================================================================
@@ -3201,10 +3201,6 @@ loc_equivalence_callback (rtx loc, const
return NULL_RTX;
}
-/* Maximum allowed number of constraint pass iterations after the last
- spill pass. It is for preventing LRA cycling in a bug case. */
-#define MAX_CONSTRAINT_ITERATION_NUMBER 30
-
/* Maximum number of generated reload insns per an insn. It is for
preventing this pass cycling in a bug case. */
#define MAX_RELOAD_INSNS_NUMBER LRA_MAX_INSN_RELOADS
@@ -3328,10 +3324,10 @@ lra_constraints (bool first_p)
fprintf (lra_dump_file, "\n********** Local #%d: **********\n\n",
lra_constraint_iter);
lra_constraint_iter_after_spill++;
- if (lra_constraint_iter_after_spill > MAX_CONSTRAINT_ITERATION_NUMBER)
+ if (lra_constraint_iter_after_spill > LRA_MAX_CONSTRAINT_ITERATION_NUMBER)
internal_error
("Maximum number of LRA constraint passes is achieved (%d)\n",
- MAX_CONSTRAINT_ITERATION_NUMBER);
+ LRA_MAX_CONSTRAINT_ITERATION_NUMBER);
changed_p = false;
lra_risky_transformations_p = false;
new_insn_uid_start = get_max_uid ();
@@ -4698,21 +4694,6 @@ inherit_in_ebb (rtx head, rtx tail)
return change_p;
}
-/* The maximal number of inheritance/split passes in LRA. It should
- be more 1 in order to perform caller saves transformations and much
- less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many
- as permitted constraint passes in some complicated cases. The
- first inheritance/split pass has a biggest impact on generated code
- quality. Each subsequent affects generated code in less degree.
- For example, the 3rd pass does not change generated SPEC2000 code
- at all on x86-64. */
-#define MAX_INHERITANCE_PASSES 2
-
-#if MAX_INHERITANCE_PASSES <= 0 \
- || MAX_INHERITANCE_PASSES >= MAX_CONSTRAINT_ITERATION_NUMBER - 8
-#error wrong MAX_INHERITANCE_PASSES value
-#endif
-
/* This value affects EBB forming. If probability of edge from EBB to
a BB is not greater than the following value, we don't add the BB
to EBB. */
@@ -4730,7 +4711,7 @@ lra_inheritance (void)
edge e;
lra_inheritance_iter++;
- if (lra_inheritance_iter > MAX_INHERITANCE_PASSES)
+ if (lra_inheritance_iter > LRA_MAX_INHERITANCE_PASSES)
return;
timevar_push (TV_LRA_INHERITANCE);
if (lra_dump_file != NULL)
@@ -5000,7 +4981,7 @@ lra_undo_inheritance (void)
bool change_p;
lra_undo_inheritance_iter++;
- if (lra_undo_inheritance_iter > MAX_INHERITANCE_PASSES)
+ if (lra_undo_inheritance_iter > LRA_MAX_INHERITANCE_PASSES)
return false;
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
===================================================================
@@ -249,6 +249,25 @@ typedef struct lra_insn_recog_data *lra_
#define LRA_LOSER_COST_FACTOR 6
#define LRA_MAX_REJECT 600
+/* Maximum allowed number of constraint pass iterations after the last
+ spill pass. It is for preventing LRA cycling in a bug case. */
+#define LRA_MAX_CONSTRAINT_ITERATION_NUMBER 30
+
+/* The maximal number of inheritance/split passes in LRA. It should
+ be more 1 in order to perform caller saves transformations and much
+ less MAX_CONSTRAINT_ITERATION_NUMBER to prevent LRA to do as many
+ as permitted constraint passes in some complicated cases. The
+ first inheritance/split pass has a biggest impact on generated code
+ quality. Each subsequent affects generated code in less degree.
+ For example, the 3rd pass does not change generated SPEC2000 code
+ at all on x86-64. */
+#define LRA_MAX_INHERITANCE_PASSES 2
+
+#if LRA_MAX_INHERITANCE_PASSES <= 0 \
+ || LRA_MAX_INHERITANCE_PASSES >= LRA_MAX_CONSTRAINT_ITERATION_NUMBER - 8
+#error wrong LRA_MAX_INHERITANCE_PASSES value
+#endif
+
/* lra.c: */
extern FILE *lra_dump_file;
===================================================================
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int *ptr;
+int *fn1 (int *);
+int fn2 (int, int);
+int fn3 (void);
+int fn4 (int);
+
+static int
+foo (int x, int y, int z)
+{
+ int b;
+ asm ("" : "=a" (b), "=&d" (x) : "0" (y), "1" (x), "mr" (z));
+ return x;
+}
+
+static int
+bar (int x, int y)
+{
+ int a;
+ if (!y)
+ {
+ for (a = 0; a <= (x >> 1); )
+ ;
+ a = foo (y, fn2 (2, x), x);
+ if (x)
+ a = x;
+ return a;
+ }
+}
+
+static int
+baz (int x, int y)
+{
+ int *a = ptr;
+ int t, xk1 = fn3 (), xk = x * xk1;
+ for (t = 0; t < xk; t += xk1)
+ {
+ if (fn4 (a[2]))
+ return -y;
+ a = fn1 (a);
+ }
+ return 0;
+}
+
+void
+test (int x, long y, int z)
+{
+ int a = fn3 ();
+ int b;
+ int c = bar (x, z);
+ for (b = 0; b <= y; b++)
+ c = baz (x, c);
+ fn2 (c, a);
+}