aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2011-02-15 14:21:59 -0700
committerJeff Law <law@gcc.gnu.org>2011-02-15 14:21:59 -0700
commitfc2fa4fb3848f15a1f69843151214033f45edc07 (patch)
tree7c28c5110a66983cfc6dd2dfaefced152d6c2824
parent158559dec972855ee988113db67e60334da2d479 (diff)
downloadgcc-fc2fa4fb3848f15a1f69843151214033f45edc07.zip
gcc-fc2fa4fb3848f15a1f69843151214033f45edc07.tar.gz
gcc-fc2fa4fb3848f15a1f69843151214033f45edc07.tar.bz2
Revert
2011-01-25 Jeff Law <law@redhat.com> PR rtl-optimization/37273 * ira-costs.c (scan_one_insn): Detect constants living in memory and handle them like argument loads from stack slots. Do not double count memory for memory constants and argument loads from stack slots. From-SVN: r170199
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/ira-costs.c21
2 files changed, 14 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 564fe92..8af5e87 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-15 Jeff Law <law@redhat.com>
+
+ Revert
+ 2011-01-25 Jeff Law <law@redhat.com>
+
+ PR rtl-optimization/37273
+ * ira-costs.c (scan_one_insn): Detect constants living in memory and
+ handle them like argument loads from stack slots. Do not double
+ count memory for memory constants and argument loads from stack slots.
+
2011-02-15 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/47725
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 6db5bf2..2329613 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1,5 +1,5 @@
/* IRA hard register and memory cost calculation for allocnos or pseudos.
- Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Vladimir Makarov <vmakarov@redhat.com>.
@@ -1009,7 +1009,6 @@ scan_one_insn (rtx insn)
enum rtx_code pat_code;
rtx set, note;
int i, k;
- bool counted_mem;
if (!NONDEBUG_INSN_P (insn))
return insn;
@@ -1019,23 +1018,15 @@ scan_one_insn (rtx insn)
|| pat_code == ADDR_VEC || pat_code == ADDR_DIFF_VEC)
return insn;
- counted_mem = false;
set = single_set (insn);
extract_insn (insn);
/* If this insn loads a parameter from its stack slot, then it
represents a savings, rather than a cost, if the parameter is
- stored in memory. Record this fact.
-
- Similarly if we're loading other constants from memory (constant
- pool, TOC references, small data areas, etc) and this is the only
- assignment to the destination pseudo. */
+ stored in memory. Record this fact. */
if (set != 0 && REG_P (SET_DEST (set)) && MEM_P (SET_SRC (set))
&& (note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) != NULL_RTX
- && ((MEM_P (XEXP (note, 0)))
- || (CONSTANT_P (XEXP (note, 0))
- && LEGITIMATE_CONSTANT_P (XEXP (note, 0))
- && REG_N_SETS (REGNO (SET_DEST (set))) == 1)))
+ && MEM_P (XEXP (note, 0)))
{
enum reg_class cl = GENERAL_REGS;
rtx reg = SET_DEST (set);
@@ -1047,7 +1038,6 @@ scan_one_insn (rtx insn)
-= ira_memory_move_cost[GET_MODE (reg)][cl][1] * frequency;
record_address_regs (GET_MODE (SET_SRC (set)), XEXP (SET_SRC (set), 0),
0, MEM, SCRATCH, frequency * 2);
- counted_mem = true;
}
record_operand_costs (insn, pref);
@@ -1062,10 +1052,7 @@ scan_one_insn (rtx insn)
struct costs *p = COSTS (costs, COST_INDEX (regno));
struct costs *q = op_costs[i];
- /* If the already accounted for the memory "cost" above, don't
- do so again. */
- if (!counted_mem)
- p->mem_cost += q->mem_cost;
+ p->mem_cost += q->mem_cost;
for (k = 0; k < cost_classes_num; k++)
p->cost[k] += q->cost[k];
}