Commit 431e1124 by Richard Sandiford Committed by Richard Sandiford

re PR tree-optimization/50873 (The fix to PR50730 causes gcc.c-torture/unsorted/dilayout.c to ICE)

gcc/
	PR middle-end/50873
	* optabs.c (maybe_legitimize_operand_same_code): Use copy_to_mode_reg
	instead of force_reg.  Do nothing if the address is already a
	non-virtual pseudo register.

From-SVN: r182244
parent c9556982
2011-12-12 Richard Sandiford <richard.sandiford@linaro.org>
PR middle-end/50873
* optabs.c (maybe_legitimize_operand_same_code): Use copy_to_mode_reg
instead of force_reg. Do nothing if the address is already a
non-virtual pseudo register.
2011-12-12 Torvald Riegel <triegel@redhat.com> 2011-12-12 Torvald Riegel <triegel@redhat.com>
* gimplify.c (voidify_wrapper_expr): Add default handling for * gimplify.c (voidify_wrapper_expr): Add default handling for
...@@ -8242,18 +8242,24 @@ maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno, ...@@ -8242,18 +8242,24 @@ maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno,
return true; return true;
/* If the operand is a memory whose address has no side effects, /* If the operand is a memory whose address has no side effects,
try forcing the address into a register. The check for side try forcing the address into a non-virtual pseudo register.
effects is important because force_reg cannot handle things The check for side effects is important because copy_to_mode_reg
like auto-modified addresses. */ cannot handle things like auto-modified addresses. */
if (insn_data[(int) icode].operand[opno].allows_mem if (insn_data[(int) icode].operand[opno].allows_mem && MEM_P (op->value))
&& MEM_P (op->value)
&& !side_effects_p (XEXP (op->value, 0)))
{ {
rtx addr, mem, last; rtx addr, mem;
mem = op->value;
addr = XEXP (mem, 0);
if (!(REG_P (addr) && REGNO (addr) > LAST_VIRTUAL_REGISTER)
&& !side_effects_p (addr))
{
rtx last;
enum machine_mode mode;
last = get_last_insn (); last = get_last_insn ();
addr = force_reg (Pmode, XEXP (op->value, 0)); mode = targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
mem = replace_equiv_address (op->value, addr); mem = replace_equiv_address (mem, copy_to_mode_reg (mode, addr));
if (insn_operand_matches (icode, opno, mem)) if (insn_operand_matches (icode, opno, mem))
{ {
op->value = mem; op->value = mem;
...@@ -8261,6 +8267,7 @@ maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno, ...@@ -8261,6 +8267,7 @@ maybe_legitimize_operand_same_code (enum insn_code icode, unsigned int opno,
} }
delete_insns_since (last); delete_insns_since (last);
} }
}
return false; return false;
} }
......
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