Commit 821b7577 by Vladimir Makarov Committed by Vladimir Makarov

re PR rtl-optimization/55154 (ICE: in curr_insn_transform, at…

re PR rtl-optimization/55154 (ICE: in curr_insn_transform, at lra-constraints.c:2702 with custom flags)

2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>

	PR tree-optimization/55154
	* lra-int.h (LRA_LOSER_COST_FACTOR, LRA_MAX_REJECT): New macros.
	* lra.c (setup_operand_alternative): Use them.
	* lra-constraints.c (LOSER_COST_FACTOR, MAX_OVERALL_COST_BOUND):
	Remove.
	(process_alt_operands): Use LRA_LOSER_COST_FACTOR and
	LRA_MAX_REJECT.  Accumulate reject instead of setting for
	non-const.
	(curr_insn_transform): Initialize best_losers and best_overall by
	INT_MAX.

2012-11-09  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/55154
	* gcc.target/i386/pr55154.c: New test.

From-SVN: r193364
parent ad7bac31
2012-11-09 Vladimir Makarov <vmakarov@redhat.com>
PR tree-optimization/55154
* lra-int.h (LRA_LOSER_COST_FACTOR, LRA_MAX_REJECT): New macros.
* lra.c (setup_operand_alternative): Use them.
* lra-constraints.c (LOSER_COST_FACTOR, MAX_OVERALL_COST_BOUND):
Remove.
(process_alt_operands): Use LRA_LOSER_COST_FACTOR and
LRA_MAX_REJECT. Accumulate reject instead of setting for
non-const.
(curr_insn_transform): Initialize best_losers and best_overall by
INT_MAX.
2012-11-09 Christian Bruel <christian.bruel@st.com> 2012-11-09 Christian Bruel <christian.bruel@st.com>
* config/sh/sh.c (sh_can_use_simple_return_p): Enable with * config/sh/sh.c (sh_can_use_simple_return_p): Enable with
...@@ -44,7 +57,6 @@ ...@@ -44,7 +57,6 @@
* config/i386/i386.c (release_scratch_register_on_entry): Also adjust * config/i386/i386.c (release_scratch_register_on_entry): Also adjust
sp_offset manually. sp_offset manually.
>>>>>>> .r193360
2012-11-08 Christian Bruel <christian.bruel@st.com> 2012-11-08 Christian Bruel <christian.bruel@st.com>
* tree-ssa-tail-merge.c (replace_block_by): Update bb2 profile count. * tree-ssa-tail-merge.c (replace_block_by): Update bb2 profile count.
...@@ -1282,12 +1282,6 @@ general_constant_p (rtx x) ...@@ -1282,12 +1282,6 @@ general_constant_p (rtx x)
return CONSTANT_P (x) && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (x)); return CONSTANT_P (x) && (! flag_pic || LEGITIMATE_PIC_OPERAND_P (x));
} }
/* Cost factor for each additional reload and maximal cost bound for
insn reloads. One might ask about such strange numbers. Their
values occurred historically from former reload pass. */
#define LOSER_COST_FACTOR 6
#define MAX_OVERALL_COST_BOUND 600
/* Major function to choose the current insn alternative and what /* Major function to choose the current insn alternative and what
operands should be reloaded and how. If ONLY_ALTERNATIVE is not operands should be reloaded and how. If ONLY_ALTERNATIVE is not
negative we should consider only this alternative. Return false if negative we should consider only this alternative. Return false if
...@@ -1576,6 +1570,7 @@ process_alt_operands (int only_alternative) ...@@ -1576,6 +1570,7 @@ process_alt_operands (int only_alternative)
badop = false; badop = false;
this_alternative = curr_alt[m]; this_alternative = curr_alt[m];
COPY_HARD_REG_SET (this_alternative_set, curr_alt_set[m]); COPY_HARD_REG_SET (this_alternative_set, curr_alt_set[m]);
winreg = this_alternative != NO_REGS;
break; break;
} }
...@@ -1828,7 +1823,7 @@ process_alt_operands (int only_alternative) ...@@ -1828,7 +1823,7 @@ process_alt_operands (int only_alternative)
might cost something but probably less than old might cost something but probably less than old
reload pass believes. */ reload pass believes. */
if (lra_former_scratch_p (REGNO (operand_reg[nop]))) if (lra_former_scratch_p (REGNO (operand_reg[nop])))
reject += LOSER_COST_FACTOR; reject += LRA_LOSER_COST_FACTOR;
} }
} }
else if (did_match) else if (did_match)
...@@ -1912,20 +1907,15 @@ process_alt_operands (int only_alternative) ...@@ -1912,20 +1907,15 @@ process_alt_operands (int only_alternative)
&& no_input_reloads_p && ! const_to_mem)) && no_input_reloads_p && ! const_to_mem))
goto fail; goto fail;
/* If we can't reload this value at all, reject this /* Check strong discouragement of reload of non-constant
alternative. Note that we could also lose due to into class THIS_ALTERNATIVE. */
LIMIT_RELOAD_CLASS, but we don't check that here. */ if (! CONSTANT_P (op) && ! no_regs_p
if (! CONSTANT_P (op) && ! no_regs_p) && (targetm.preferred_reload_class
{ (op, this_alternative) == NO_REGS
if (targetm.preferred_reload_class || (curr_static_id->operand[nop].type == OP_OUT
(op, this_alternative) == NO_REGS) && (targetm.preferred_output_reload_class
reject = MAX_OVERALL_COST_BOUND; (op, this_alternative) == NO_REGS))))
reject += LRA_MAX_REJECT;
if (curr_static_id->operand[nop].type == OP_OUT
&& (targetm.preferred_output_reload_class
(op, this_alternative) == NO_REGS))
reject = MAX_OVERALL_COST_BOUND;
}
if (! ((const_to_mem && constmemok) if (! ((const_to_mem && constmemok)
|| (MEM_P (op) && offmemok))) || (MEM_P (op) && offmemok)))
...@@ -1966,7 +1956,7 @@ process_alt_operands (int only_alternative) ...@@ -1966,7 +1956,7 @@ 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 * LOSER_COST_FACTOR + reject; overall = losers * LRA_LOSER_COST_FACTOR + reject;
if ((best_losers == 0 || losers != 0) && best_overall < overall) if ((best_losers == 0 || losers != 0) && best_overall < overall)
goto fail; goto fail;
...@@ -2019,7 +2009,7 @@ process_alt_operands (int only_alternative) ...@@ -2019,7 +2009,7 @@ process_alt_operands (int only_alternative)
{ {
curr_alt_match_win[j] = false; curr_alt_match_win[j] = false;
losers++; losers++;
overall += LOSER_COST_FACTOR; overall += LRA_LOSER_COST_FACTOR;
} }
if (! curr_alt_match_win[i]) if (! curr_alt_match_win[i])
curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = i; curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++] = i;
...@@ -2032,7 +2022,7 @@ process_alt_operands (int only_alternative) ...@@ -2032,7 +2022,7 @@ process_alt_operands (int only_alternative)
} }
curr_alt_win[i] = curr_alt_match_win[i] = false; curr_alt_win[i] = curr_alt_match_win[i] = false;
losers++; losers++;
overall += LOSER_COST_FACTOR; overall += LRA_LOSER_COST_FACTOR;
} }
small_class_operands_num = 0; small_class_operands_num = 0;
for (nop = 0; nop < n_operands; nop++) for (nop = 0; nop < n_operands; nop++)
...@@ -2635,7 +2625,7 @@ curr_insn_transform (void) ...@@ -2635,7 +2625,7 @@ curr_insn_transform (void)
the wrong kind of hard reg. For this, we must consider all the the wrong kind of hard reg. For this, we must consider all the
operands together against the register constraints. */ operands together against the register constraints. */
best_losers = best_overall = MAX_RECOG_OPERANDS * 2 + MAX_OVERALL_COST_BOUND; best_losers = best_overall = INT_MAX;
best_small_class_operands_num = best_reload_sum = 0; best_small_class_operands_num = best_reload_sum = 0;
curr_swapped = false; curr_swapped = false;
......
...@@ -243,6 +243,12 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t; ...@@ -243,6 +243,12 @@ typedef struct lra_insn_recog_data *lra_insn_recog_data_t;
#define LRA_TEMP_CLOBBER_P(x) \ #define LRA_TEMP_CLOBBER_P(x) \
(RTL_FLAG_CHECK1 ("TEMP_CLOBBER_P", (x), CLOBBER)->unchanging) (RTL_FLAG_CHECK1 ("TEMP_CLOBBER_P", (x), CLOBBER)->unchanging)
/* Cost factor for each additional reload and maximal cost reject for
insn reloads. One might ask about such strange numbers. Their
values occurred historically from former reload pass. */
#define LRA_LOSER_COST_FACTOR 6
#define LRA_MAX_REJECT 600
/* lra.c: */ /* lra.c: */
extern FILE *lra_dump_file; extern FILE *lra_dump_file;
......
...@@ -784,10 +784,10 @@ setup_operand_alternative (lra_insn_recog_data_t data) ...@@ -784,10 +784,10 @@ setup_operand_alternative (lra_insn_recog_data_t data)
break; break;
case '?': case '?':
op_alt->reject += 6; op_alt->reject += LRA_LOSER_COST_FACTOR;
break; break;
case '!': case '!':
op_alt->reject += 600; op_alt->reject += LRA_MAX_REJECT;
break; break;
case '&': case '&':
op_alt->earlyclobber = 1; op_alt->earlyclobber = 1;
......
2012-11-09 Vladimir Makarov <vmakarov@redhat.com> 2012-11-09 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/55154
* gcc.target/i386/pr55154.c: New test.
2012-11-09 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/55151 PR rtl-optimization/55151
* gcc.dg/pr55151.c: Move ... * gcc.dg/pr55151.c: Move ...
* gcc.target/i386/pr55151.c: ... here. * gcc.target/i386/pr55151.c: ... here.
......
/* { dg-do compile } */
/* { dg-require-effective-target lp64 } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-O2 -mcx16 -fpic -mcmodel=large -fno-split-wide-types" } */
__int128 i;
void test ()
{
__sync_val_compare_and_swap (&i, i, i);
}
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