Commit 6c667859 by Arend Bayer Committed by Kazu Hirata

cse.c: (find_best_addr): Don't call copy_rtx before calling fold_rtx.

	* cse.c: (find_best_addr): Don't call copy_rtx before calling
	fold_rtx.  Save cost recomputation if fold_rtx did nothing.
	(fold_rtx) <ASM_OPERANDS>: Don't do anything if INSN is
	NULL_RTX.

Co-Authored-By: Kazu Hirata <kazu@cs.umass.edu>

From-SVN: r94345
parent 88af764e
2005-01-27 Arend Bayer <arend.bayer@web.de>
Kazu Hirata <kazu@cs.umass.edu>
* cse.c: (find_best_addr): Don't call copy_rtx before calling
fold_rtx. Save cost recomputation if fold_rtx did nothing.
(fold_rtx) <ASM_OPERANDS>: Don't do anything if INSN is
NULL_RTX.
2005-01-27 Jeff Law <law@redhat.com> 2005-01-27 Jeff Law <law@redhat.com>
* tree-into-ssa.c (ssa_rewrite_initialize_block): Do not register * tree-into-ssa.c (ssa_rewrite_initialize_block): Do not register
......
...@@ -2844,18 +2844,21 @@ find_best_addr (rtx insn, rtx *loc, enum machine_mode mode) ...@@ -2844,18 +2844,21 @@ find_best_addr (rtx insn, rtx *loc, enum machine_mode mode)
be valid and produce better code. */ be valid and produce better code. */
if (!REG_P (addr)) if (!REG_P (addr))
{ {
rtx folded = fold_rtx (copy_rtx (addr), NULL_RTX); rtx folded = fold_rtx (addr, NULL_RTX);
int addr_folded_cost = address_cost (folded, mode); if (folded != addr)
int addr_cost = address_cost (addr, mode); {
int addr_folded_cost = address_cost (folded, mode);
if ((addr_folded_cost < addr_cost int addr_cost = address_cost (addr, mode);
|| (addr_folded_cost == addr_cost
/* ??? The rtx_cost comparison is left over from an older if ((addr_folded_cost < addr_cost
version of this code. It is probably no longer helpful. */ || (addr_folded_cost == addr_cost
&& (rtx_cost (folded, MEM) > rtx_cost (addr, MEM) /* ??? The rtx_cost comparison is left over from an older
|| approx_reg_cost (folded) < approx_reg_cost (addr)))) version of this code. It is probably no longer helpful.*/
&& validate_change (insn, loc, folded, 0)) && (rtx_cost (folded, MEM) > rtx_cost (addr, MEM)
addr = folded; || approx_reg_cost (folded) < approx_reg_cost (addr))))
&& validate_change (insn, loc, folded, 0))
addr = folded;
}
} }
/* If this address is not in the hash table, we can't look for equivalences /* If this address is not in the hash table, we can't look for equivalences
...@@ -3608,9 +3611,12 @@ fold_rtx (rtx x, rtx insn) ...@@ -3608,9 +3611,12 @@ fold_rtx (rtx x, rtx insn)
#endif #endif
case ASM_OPERANDS: case ASM_OPERANDS:
for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--) if (insn)
validate_change (insn, &ASM_OPERANDS_INPUT (x, i), {
fold_rtx (ASM_OPERANDS_INPUT (x, i), insn), 0); for (i = ASM_OPERANDS_INPUT_LENGTH (x) - 1; i >= 0; i--)
validate_change (insn, &ASM_OPERANDS_INPUT (x, i),
fold_rtx (ASM_OPERANDS_INPUT (x, i), insn), 0);
}
break; break;
default: default:
......
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