summaryrefslogtreecommitdiff
path: root/gcc/loop-invariant.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-19 17:37:45 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-19 17:37:45 +0000
commit09c7ce539539dc7a0460973b63b269c71b527379 (patch)
tree4a838115d14ebe93303016d8ff822904c206b25c /gcc/loop-invariant.c
parent9b85291b9675e17f8401b1a9d928709b670c49a9 (diff)
downloadgcc-09c7ce539539dc7a0460973b63b269c71b527379.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223402 138bc75d-0d04-0410-961f-82ee72b054a4
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 1c3eae5e965..85270fe14bc 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;