re PR inline-asm/55775 (ICE when building pari)

2012-12-21  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/55775
	* lra-assigns.c (improve_inheritance): Do nothing after
	LRA_MAX_INHERITANCE_PASSES pass.
	* lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Rename to
	LRA_MAX_CONSTRAINT_ITERATION_NUMBER.  Move to lra-int.h.
	(MAX_INHERITANCE_PASSES): Rename to LRA_MAX_INHERITANCE_PASSES.
	Move to lra-int.h.
	* lra-int.h (LRA_MAX_CONSTRAINT_ITERATION_NUMBER): Move from
	lra-constraints.c.
	(LRA_MAX_INHERITANCE_PASSES): Ditto.

2012-12-21  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/55775
	* gcc.target/i386/pr55775.c: New test.

From-SVN: r194680
This commit is contained in:
Vladimir Makarov 2012-12-21 21:20:48 +00:00 committed by Vladimir Makarov
parent a0edd35cf6
commit 8e3a486902
6 changed files with 99 additions and 23 deletions

View File

@ -1,3 +1,16 @@
2012-12-21 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/55775
* lra-assigns.c (improve_inheritance): Do nothing after
LRA_MAX_INHERITANCE_PASSES pass.
* lra-constraints.c (MAX_CONSTRAINT_ITERATION_NUMBER): Rename to
LRA_MAX_CONSTRAINT_ITERATION_NUMBER. Move to lra-int.h.
(MAX_INHERITANCE_PASSES): Rename to LRA_MAX_INHERITANCE_PASSES.
Move to lra-int.h.
* lra-int.h (LRA_MAX_CONSTRAINT_ITERATION_NUMBER): Move from
lra-constraints.c.
(LRA_MAX_INHERITANCE_PASSES): Ditto.
2012-12-21 Steve Ellcey <sellcey@mips.com>
PR bootstrap/54128

View File

@ -1084,6 +1084,8 @@ improve_inheritance (bitmap changed_pseudos)
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)

View File

@ -3201,10 +3201,6 @@ loc_equivalence_callback (rtx loc, const_rtx, void *)
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,

View File

@ -249,6 +249,25 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
#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;

View File

@ -1,3 +1,8 @@
2012-12-21 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/55775
* gcc.target/i386/pr55775.c: New test.
2012-12-21 David Edelsohn <dje.gcc@gmail.com>
* gcc.dg/pthread-init-2.c (dg-options): Define _XOPEN_SOURCE=500

View 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);
}