Commit feca7b89 by Vladimir Makarov Committed by Vladimir Makarov

re PR rtl-optimization/79571 (ICE in Max. number of generated reload insns per…

re PR rtl-optimization/79571 (ICE in Max. number of generated reload insns per insn is achieved (90))

2017-03-06  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/79571
	* lra-constraints.c (process_alt_operands): Claculate static
	reject and subtract it from overal when there will be only address
	reloads.

2017-03-06  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/79571
	* gcc.target/i386/pr79571.c: New.

From-SVN: r245928
parent bdbbf28d
2017-03-06 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/79571
* lra-constraints.c (process_alt_operands): Claculate static
reject and subtract it from overal when there will be only address
reloads.
2017-03-06 Julia Koval <julia.koval@intel.com> 2017-03-06 Julia Koval <julia.koval@intel.com>
PR target/79793 PR target/79793
......
...@@ -1867,11 +1867,15 @@ process_alt_operands (int only_alternative) ...@@ -1867,11 +1867,15 @@ process_alt_operands (int only_alternative)
/* LOSERS counts the operands that don't fit this alternative and /* LOSERS counts the operands that don't fit this alternative and
would require loading. */ would require loading. */
int losers; int losers;
int addr_losers;
/* REJECT is a count of how undesirable this alternative says it is /* REJECT is a count of how undesirable this alternative says it is
if any reloading is required. If the alternative matches exactly if any reloading is required. If the alternative matches exactly
then REJECT is ignored, but otherwise it gets this much counted then REJECT is ignored, but otherwise it gets this much counted
against it in addition to the reloading needed. */ against it in addition to the reloading needed. */
int reject; int reject;
/* This is defined by '!' or '?' alternative constraint and added to
reject. But in some cases it can be ignored. */
int static_reject;
int op_reject; int op_reject;
/* The number of elements in the following array. */ /* The number of elements in the following array. */
int early_clobbered_regs_num; int early_clobbered_regs_num;
...@@ -1948,7 +1952,8 @@ process_alt_operands (int only_alternative) ...@@ -1948,7 +1952,8 @@ process_alt_operands (int only_alternative)
if (!TEST_BIT (preferred, nalt)) if (!TEST_BIT (preferred, nalt))
continue; continue;
overall = losers = reject = reload_nregs = reload_sum = 0; overall = losers = addr_losers = 0;
static_reject = reject = reload_nregs = reload_sum = 0;
for (nop = 0; nop < n_operands; nop++) for (nop = 0; nop < n_operands; nop++)
{ {
int inc = (curr_static_id int inc = (curr_static_id
...@@ -1956,8 +1961,9 @@ process_alt_operands (int only_alternative) ...@@ -1956,8 +1961,9 @@ process_alt_operands (int only_alternative)
if (lra_dump_file != NULL && inc != 0) if (lra_dump_file != NULL && inc != 0)
fprintf (lra_dump_file, fprintf (lra_dump_file,
" Staticly defined alt reject+=%d\n", inc); " Staticly defined alt reject+=%d\n", inc);
reject += inc; static_reject += inc;
} }
reject += static_reject;
early_clobbered_regs_num = 0; early_clobbered_regs_num = 0;
for (nop = 0; nop < n_operands; nop++) for (nop = 0; nop < n_operands; nop++)
...@@ -2704,6 +2710,9 @@ process_alt_operands (int only_alternative) ...@@ -2704,6 +2710,9 @@ process_alt_operands (int only_alternative)
nop); nop);
reject++; reject++;
} }
if (MEM_P (op) && offmemok)
addr_losers++;
} }
if (early_clobber_p && ! scratch_p) if (early_clobber_p && ! scratch_p)
...@@ -2718,7 +2727,8 @@ process_alt_operands (int only_alternative) ...@@ -2718,7 +2727,8 @@ process_alt_operands (int only_alternative)
Should we update the cost (may be approximately) here Should we update the cost (may be approximately) here
because of early clobber register reloads or it is a rare because of early clobber register reloads or it is a rare
or non-important thing to be worth to do it. */ or non-important thing to be worth to do it. */
overall = losers * LRA_LOSER_COST_FACTOR + reject; overall = (losers * LRA_LOSER_COST_FACTOR + reject
- (addr_losers == losers ? static_reject : 0));
if ((best_losers == 0 || losers != 0) && best_overall < overall) if ((best_losers == 0 || losers != 0) && best_overall < overall)
{ {
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
...@@ -2742,6 +2752,7 @@ process_alt_operands (int only_alternative) ...@@ -2742,6 +2752,7 @@ process_alt_operands (int only_alternative)
if (early_clobber_p && operand_reg[nop] != NULL_RTX) if (early_clobber_p && operand_reg[nop] != NULL_RTX)
early_clobbered_nops[early_clobbered_regs_num++] = nop; early_clobbered_nops[early_clobbered_regs_num++] = nop;
} }
if (curr_insn_set != NULL_RTX && n_operands == 2 if (curr_insn_set != NULL_RTX && n_operands == 2
/* Prevent processing non-move insns. */ /* Prevent processing non-move insns. */
&& (GET_CODE (SET_SRC (curr_insn_set)) == SUBREG && (GET_CODE (SET_SRC (curr_insn_set)) == SUBREG
...@@ -2753,9 +2764,15 @@ process_alt_operands (int only_alternative) ...@@ -2753,9 +2764,15 @@ process_alt_operands (int only_alternative)
|| reg_in_class_p (no_subreg_reg_operand[1], curr_alt[0]))) || reg_in_class_p (no_subreg_reg_operand[1], curr_alt[0])))
|| (! curr_alt_win[0] && curr_alt_win[1] || (! curr_alt_win[0] && curr_alt_win[1]
&& REG_P (no_subreg_reg_operand[1]) && REG_P (no_subreg_reg_operand[1])
/* Check that we reload memory not the memory
address. */
&& !curr_alt_offmemok[0]
&& reg_in_class_p (no_subreg_reg_operand[1], curr_alt[0])) && reg_in_class_p (no_subreg_reg_operand[1], curr_alt[0]))
|| (curr_alt_win[0] && ! curr_alt_win[1] || (curr_alt_win[0] && ! curr_alt_win[1]
&& REG_P (no_subreg_reg_operand[0]) && REG_P (no_subreg_reg_operand[0])
/* Check that we reload memory not the memory
address. */
&& !curr_alt_offmemok[1]
&& reg_in_class_p (no_subreg_reg_operand[0], curr_alt[1]) && reg_in_class_p (no_subreg_reg_operand[0], curr_alt[1])
&& (! CONST_POOL_OK_P (curr_operand_mode[1], && (! CONST_POOL_OK_P (curr_operand_mode[1],
no_subreg_reg_operand[1]) no_subreg_reg_operand[1])
......
2017-03-06 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/79571
* gcc.target/i386/pr79571.c: New.
2017-03-06 Marek Polacek <polacek@redhat.com> 2017-03-06 Marek Polacek <polacek@redhat.com>
PR c++/79796 - ICE with NSDMI and this pointer PR c++/79796 - ICE with NSDMI and this pointer
......
/* PR rtl-optimization/79571 */
/* { dg-do compile } */
/* { dg-options "-O -mno-sse -w" } */
struct a
{
int b;
int *c
} h;
struct d
{
struct a e
};
struct fd
{
struct d *d
} i;
g;
j ()
{
unsigned a = g;
i = (struct fd){a & 3};
struct fd f = i;
h = f.d->e;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment