Commit cb292345 by Jakub Jelinek Committed by Jakub Jelinek

re PR target/25005 (ICE in extract_constrain_insn_cached, at recog.c:2002)

	PR target/25005
	* regrename.c (replace_oldest_value_reg): Use validate_change with
	IN_GROUP set to 1 instead of doing direct modifications.
	(copyprop_hardreg_forward_1): Likewise.  If any replace_oldest_*
	replacements have been performed on an instruction, use
	apply_change_group ().

	* g++.dg/opt/pr25005.C: New test.

From-SVN: r109013
parent 7eab6e7b
2005-12-23 Jakub Jelinek <jakub@redhat.com>
PR target/25005
* regrename.c (replace_oldest_value_reg): Use validate_change with
IN_GROUP set to 1 instead of doing direct modifications.
(copyprop_hardreg_forward_1): Likewise. If any replace_oldest_*
replacements have been performed on an instruction, use
apply_change_group ().
2005-12-23 Hans-Peter Nilsson <hp@axis.com> 2005-12-23 Hans-Peter Nilsson <hp@axis.com>
* config/cris/arit.c (do_31div): Clarify what "31" refers to. * config/cris/arit.c (do_31div): Clarify what "31" refers to.
......
...@@ -1408,7 +1408,7 @@ replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx insn, ...@@ -1408,7 +1408,7 @@ replace_oldest_value_reg (rtx *loc, enum reg_class cl, rtx insn,
fprintf (dump_file, "insn %u: replaced reg %u with %u\n", fprintf (dump_file, "insn %u: replaced reg %u with %u\n",
INSN_UID (insn), REGNO (*loc), REGNO (new)); INSN_UID (insn), REGNO (*loc), REGNO (new));
*loc = new; validate_change (insn, loc, new, 1);
return true; return true;
} }
return false; return false;
...@@ -1574,8 +1574,9 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd) ...@@ -1574,8 +1574,9 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn)) for (insn = BB_HEAD (bb); ; insn = NEXT_INSN (insn))
{ {
int n_ops, i, alt, predicated; int n_ops, i, alt, predicated;
bool is_asm; bool is_asm, any_replacements;
rtx set; rtx set;
bool replaced[MAX_RECOG_OPERANDS];
if (! INSN_P (insn)) if (! INSN_P (insn))
{ {
...@@ -1687,11 +1688,13 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd) ...@@ -1687,11 +1688,13 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
} }
no_move_special_case: no_move_special_case:
any_replacements = false;
/* For each input operand, replace a hard register with the /* For each input operand, replace a hard register with the
eldest live copy that's in an appropriate register class. */ eldest live copy that's in an appropriate register class. */
for (i = 0; i < n_ops; i++) for (i = 0; i < n_ops; i++)
{ {
bool replaced = false; replaced[i] = false;
/* Don't scan match_operand here, since we've no reg class /* Don't scan match_operand here, since we've no reg class
information to pass down. Any operands that we could information to pass down. Any operands that we could
...@@ -1708,37 +1711,57 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd) ...@@ -1708,37 +1711,57 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
if (recog_data.operand_type[i] == OP_IN) if (recog_data.operand_type[i] == OP_IN)
{ {
if (recog_op_alt[i][alt].is_address) if (recog_op_alt[i][alt].is_address)
replaced replaced[i]
= replace_oldest_value_addr (recog_data.operand_loc[i], = replace_oldest_value_addr (recog_data.operand_loc[i],
recog_op_alt[i][alt].cl, recog_op_alt[i][alt].cl,
VOIDmode, insn, vd); VOIDmode, insn, vd);
else if (REG_P (recog_data.operand[i])) else if (REG_P (recog_data.operand[i]))
replaced replaced[i]
= replace_oldest_value_reg (recog_data.operand_loc[i], = replace_oldest_value_reg (recog_data.operand_loc[i],
recog_op_alt[i][alt].cl, recog_op_alt[i][alt].cl,
insn, vd); insn, vd);
else if (MEM_P (recog_data.operand[i])) else if (MEM_P (recog_data.operand[i]))
replaced = replace_oldest_value_mem (recog_data.operand[i], replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
insn, vd); insn, vd);
} }
else if (MEM_P (recog_data.operand[i])) else if (MEM_P (recog_data.operand[i]))
replaced = replace_oldest_value_mem (recog_data.operand[i], replaced[i] = replace_oldest_value_mem (recog_data.operand[i],
insn, vd); insn, vd);
/* If we performed any replacement, update match_dups. */ /* If we performed any replacement, update match_dups. */
if (replaced) if (replaced[i])
{ {
int j; int j;
rtx new; rtx new;
changed = true;
new = *recog_data.operand_loc[i]; new = *recog_data.operand_loc[i];
recog_data.operand[i] = new; recog_data.operand[i] = new;
for (j = 0; j < recog_data.n_dups; j++) for (j = 0; j < recog_data.n_dups; j++)
if (recog_data.dup_num[j] == i) if (recog_data.dup_num[j] == i)
*recog_data.dup_loc[j] = new; validate_change (insn, recog_data.dup_loc[j], new, 1);
any_replacements = true;
}
}
if (any_replacements)
{
if (! apply_change_group ())
{
for (i = 0; i < n_ops; i++)
if (replaced[i])
{
rtx old = *recog_data.operand_loc[i];
recog_data.operand[i] = old;
}
if (dump_file)
fprintf (dump_file,
"insn %u: reg replacements not verified\n",
INSN_UID (insn));
} }
else
changed = true;
} }
did_replacement: did_replacement:
......
2005-12-23 Jakub Jelinek <jakub@redhat.com>
PR target/25005
* g++.dg/opt/pr25005.C: New test.
2005-12-22 Mark Mitchell <mark@codesourcery.com> 2005-12-22 Mark Mitchell <mark@codesourcery.com>
PR c++/25369 PR c++/25369
// PR target/25005
// { dg-options "-O2 -funroll-loops" }
// { dg-do compile }
inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
struct M { ~M() { } };
struct P
{
P () { v[0] = 0; v[1] = 0; v[2] = 0; }
P (const P &x) { for (int i = 0; i < 3; ++i) v[i] = x.v[i]; }
double v[3];
};
struct V : public M
{
V (const P *x, const P *y)
{
P *b = this->a = ::new P[2];
for (; x != y; ++x, ++b)
::new (b) P(*x);
}
P *a;
};
void bar (const V &);
void
foo ()
{
const P d[2] = { P(), P() };
bar (V (&d[0], &d[2]));
}
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