diff options
author | zqchen <zqchen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-03 05:24:12 +0000 |
---|---|---|
committer | zqchen <zqchen@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-07-03 05:24:12 +0000 |
commit | f69fbf74ba65a70a887d353107986e512f0e7c4c (patch) | |
tree | 965441201e93a2ae9d149b7f26ec0a99c9dbe3e4 /gcc/loop-invariant.c | |
parent | 41dc70b206ce925b4c3a4d1a4eca15798c221e53 (diff) | |
download | gcc-f69fbf74ba65a70a887d353107986e512f0e7c4c.tar.gz |
ChangeLog:
2014-07-03 Zhenqiang Chen <zhenqiang.chen@linaro.org>
* loop-invariant.c (struct invariant): Add a new member: eqno;
(find_identical_invariants): Update eqno;
(create_new_invariant): Init eqno;
(get_inv_cost): Compute comp_cost with eqno;
testsuite/ChangeLog:
2014-07-03 Zhenqiang Chen <zhenqiang.chen@linaro.org>
* gcc.target/arm/identical-invariants.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212256 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-invariant.c')
-rw-r--r-- | gcc/loop-invariant.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index d47d461bfd7..bd67eb9b4cd 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -104,6 +104,9 @@ struct invariant /* The number of the invariant with the same value. */ unsigned eqto; + /* The number of invariants which eqto this. */ + unsigned eqno; + /* If we moved the invariant out of the loop, the register that contains its value. */ rtx reg; @@ -498,6 +501,7 @@ find_identical_invariants (invariant_htab_type *eq, struct invariant *inv) struct invariant *dep; rtx expr, set; enum machine_mode mode; + struct invariant *tmp; if (inv->eqto != ~0u) return; @@ -513,7 +517,12 @@ find_identical_invariants (invariant_htab_type *eq, struct invariant *inv) mode = GET_MODE (expr); if (mode == VOIDmode) mode = GET_MODE (SET_DEST (set)); - inv->eqto = find_or_insert_inv (eq, expr, mode, inv)->invno; + + tmp = find_or_insert_inv (eq, expr, mode, inv); + inv->eqto = tmp->invno; + + if (tmp->invno != inv->invno && inv->always_executed) + tmp->eqno++; if (dump_file && inv->eqto != inv->invno) fprintf (dump_file, @@ -722,6 +731,10 @@ create_new_invariant (struct def *def, rtx insn, bitmap depends_on, inv->invno = invariants.length (); inv->eqto = ~0u; + + /* Itself. */ + inv->eqno = 1; + if (def) def->invno = inv->invno; invariants.safe_push (inv); @@ -1136,7 +1149,7 @@ get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed, if (!inv->cheap_address || inv->def->n_addr_uses < inv->def->n_uses) - (*comp_cost) += inv->cost; + (*comp_cost) += inv->cost * inv->eqno; #ifdef STACK_REGS { |