diff options
author | Richard Biener <rguenther@suse.de> | 2013-02-20 09:03:18 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-02-20 09:03:18 +0000 |
commit | 79836a12e3349fb81b1e184ac87080dc880d09af (patch) | |
tree | a254810adf6022c9e225c2fbfdb577cf13879091 /gcc/tree-ssa-loop-ivopts.c | |
parent | 30b07d033db90fb3722583c3210be1ab63679e3f (diff) | |
download | gcc-79836a12e3349fb81b1e184ac87080dc880d09af.zip gcc-79836a12e3349fb81b1e184ac87080dc880d09af.tar.gz gcc-79836a12e3349fb81b1e184ac87080dc880d09af.tar.bz2 |
tree-ssa-loop-ivopts.c (alloc_use_cost_map): Use bitmap_count_bits and ceil_log2.
2013-02-20 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-ivopts.c (alloc_use_cost_map): Use bitmap_count_bits
and ceil_log2.
(get_use_iv_cost): Terminate hashtable walk when coming across
an empty entry.
From-SVN: r196166
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index d30bfec..2940bf1 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -2574,26 +2574,20 @@ record_important_candidates (struct ivopts_data *data) static void alloc_use_cost_map (struct ivopts_data *data) { - unsigned i, size, s, j; + unsigned i, size, s; for (i = 0; i < n_iv_uses (data); i++) { struct iv_use *use = iv_use (data, i); - bitmap_iterator bi; if (data->consider_all_candidates) size = n_iv_cands (data); else { - s = 0; - EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, bi) - { - s++; - } + s = bitmap_count_bits (use->related_cands); /* Round up to the power of two, so that moduling by it is fast. */ - for (size = 1; size < s; size <<= 1) - continue; + size = s ? (1 << ceil_log2 (s)) : 1; } use->n_map_members = size; @@ -2731,10 +2725,13 @@ get_use_iv_cost (struct ivopts_data *data, struct iv_use *use, for (i = s; i < use->n_map_members; i++) if (use->cost_map[i].cand == cand) return use->cost_map + i; - + else if (use->cost_map[i].cand == NULL) + return NULL; for (i = 0; i < s; i++) if (use->cost_map[i].cand == cand) return use->cost_map + i; + else if (use->cost_map[i].cand == NULL) + return NULL; return NULL; } |