aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-16 16:34:28 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-16 16:34:28 +0100
commit3db93c89bcf498337b179379987d42e7aef1cd0b (patch)
tree3b3d3f1e75c66f654e5766a8981e1f3f9e0f9992 /gcc
parente20f6b4bde8a93aefb4bb2a9b3946a24edeea5ef (diff)
downloadgcc-3db93c89bcf498337b179379987d42e7aef1cd0b.zip
gcc-3db93c89bcf498337b179379987d42e7aef1cd0b.tar.gz
gcc-3db93c89bcf498337b179379987d42e7aef1cd0b.tar.bz2
re PR rtl-optimization/52208 (Useless store)
PR rtl-optimization/52208 * ira-costs.c (scan_one_insn): Don't decrease mem_cost for MEMs with REG_EQUIV, if the MEM isn't general_operand. From-SVN: r184310
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/ira-costs.c13
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8b5efa..4ba6cbf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2012-02-16 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/52208
+ * ira-costs.c (scan_one_insn): Don't decrease mem_cost
+ for MEMs with REG_EQUIV, if the MEM isn't general_operand.
+
PR tree-optimization/52255
* tree-vect-loop-manip.c (slpeel_tree_peel_loop_to_edge): If
loop->header has virtual PHI, but exit_e->dest doesn't, add
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 8e1e846..34e6ef9 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, 2011, 2012
Free Software Foundation, Inc.
Contributed by Vladimir Makarov <vmakarov@redhat.com>.
@@ -1306,14 +1306,21 @@ scan_one_insn (rtx insn)
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. */
+ assignment to the destination pseudo.
+
+ Don't do this if SET_SRC (set) isn't a general operand, if it is
+ a memory requiring special instructions to load it, decreasing
+ mem_cost might result in it being loaded using the specialized
+ instruction into a register, then stored into stack and loaded
+ again from the stack. See PR52208. */
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))
&& targetm.legitimate_constant_p (GET_MODE (SET_DEST (set)),
XEXP (note, 0))
- && REG_N_SETS (REGNO (SET_DEST (set))) == 1)))
+ && REG_N_SETS (REGNO (SET_DEST (set))) == 1))
+ && general_operand (SET_SRC (set), GET_MODE (SET_SRC (set))))
{
enum reg_class cl = GENERAL_REGS;
rtx reg = SET_DEST (set);