aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-invariant.c
diff options
context:
space:
mode:
authorDavid Sherwood <david.sherwood@arm.com>2015-05-19 17:37:45 +0000
committerJeff Law <law@gcc.gnu.org>2015-05-19 11:37:45 -0600
commit315a349c27e1395a9bde30876824891027e67aac (patch)
tree4a838115d14ebe93303016d8ff822904c206b25c /gcc/loop-invariant.c
parent0aaaa54a73ed57a95e13403158e345f7bab01ff9 (diff)
downloadgcc-315a349c27e1395a9bde30876824891027e67aac.zip
gcc-315a349c27e1395a9bde30876824891027e67aac.tar.gz
gcc-315a349c27e1395a9bde30876824891027e67aac.tar.bz2
loop-invariant.c (create_new_invariant): Don't calculate address cost if mode is not a scalar integer.
2015-05-19 David Sherwood <david.sherwood@arm.com> * loop-invariant.c (create_new_invariant): Don't calculate address cost if mode is not a scalar integer. (get_inv_cost): Increase computational cost for unused invariants. * gcc.dg/loop-invariant.c: New testcase. From-SVN: r223402
Diffstat (limited to 'gcc/loop-invariant.c')
-rw-r--r--gcc/loop-invariant.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index 1c3eae5..85270fe 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -741,8 +741,11 @@ create_new_invariant (struct def *def, rtx_insn *insn, bitmap depends_on,
enough to not regress 410.bwaves either (by still moving reg+reg
invariants).
See http://gcc.gnu.org/ml/gcc-patches/2009-10/msg01210.html . */
- inv->cheap_address = address_cost (SET_SRC (set), word_mode,
- ADDR_SPACE_GENERIC, speed) < 3;
+ if (SCALAR_INT_MODE_P (GET_MODE (SET_DEST (set))))
+ inv->cheap_address = address_cost (SET_SRC (set), word_mode,
+ ADDR_SPACE_GENERIC, speed) < 3;
+ else
+ inv->cheap_address = false;
}
else
{
@@ -1173,6 +1176,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed,
}
if (!inv->cheap_address
+ || inv->def->n_uses == 0
|| inv->def->n_addr_uses < inv->def->n_uses)
(*comp_cost) += inv->cost * inv->eqno;