diff options
author | Arend Bayer <arend.bayer@web.de> | 2005-01-27 23:00:19 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2005-01-27 23:00:19 +0000 |
commit | 6c6678595b48c2a69d6711eb84b2f1214f69d5bf (patch) | |
tree | 7ab36bd9a65425cdb4d1699512a34481c62f2e34 /gcc/cse.c | |
parent | 88af764e45e01bcd4aedaddc769cbc579b523f77 (diff) | |
download | gcc-6c6678595b48c2a69d6711eb84b2f1214f69d5bf.zip gcc-6c6678595b48c2a69d6711eb84b2f1214f69d5bf.tar.gz gcc-6c6678595b48c2a69d6711eb84b2f1214f69d5bf.tar.bz2 |
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
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 36 |
1 files changed, 21 insertions, 15 deletions
@@ -2844,18 +2844,21 @@ find_best_addr (rtx insn, rtx *loc, enum machine_mode mode) be valid and produce better code. */ if (!REG_P (addr)) { - rtx folded = fold_rtx (copy_rtx (addr), NULL_RTX); - int addr_folded_cost = address_cost (folded, mode); - int addr_cost = address_cost (addr, mode); - - if ((addr_folded_cost < addr_cost - || (addr_folded_cost == addr_cost - /* ??? The rtx_cost comparison is left over from an older - version of this code. It is probably no longer helpful. */ - && (rtx_cost (folded, MEM) > rtx_cost (addr, MEM) - || approx_reg_cost (folded) < approx_reg_cost (addr)))) - && validate_change (insn, loc, folded, 0)) - addr = folded; + rtx folded = fold_rtx (addr, NULL_RTX); + if (folded != addr) + { + int addr_folded_cost = address_cost (folded, mode); + int addr_cost = address_cost (addr, mode); + + if ((addr_folded_cost < addr_cost + || (addr_folded_cost == addr_cost + /* ??? The rtx_cost comparison is left over from an older + version of this code. It is probably no longer helpful.*/ + && (rtx_cost (folded, MEM) > rtx_cost (addr, MEM) + || 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 @@ -3608,9 +3611,12 @@ fold_rtx (rtx x, rtx insn) #endif case ASM_OPERANDS: - 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); + if (insn) + { + 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; default: |