From 79836a12e3349fb81b1e184ac87080dc880d09af Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 20 Feb 2013 09:03:18 +0000 Subject: [PATCH] tree-ssa-loop-ivopts.c (alloc_use_cost_map): Use bitmap_count_bits and ceil_log2. 2013-02-20 Richard Biener * 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 --- gcc/ChangeLog | 8 ++++++++ gcc/tree-ssa-loop-ivopts.c | 17 +++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 005d9a1..2a92d35 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,9 +1,17 @@ +2013-02-20 Richard Biener + + * 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. + 2013-02-20 Igor Zamyatin * config/i386/i386.c (initial_ix86_tune_features): Turn on fp reassociation for avx2 targets. 2012-02-19 Edgar E. Iglesias + * config/microblaze/microblaze.c: microblaze_has_clz = 0 Add version check for v8.10.a to enable microblaze_has_clz * config/microblaze/microblaze.h: Add TARGET_HAS_CLZ as combined 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; } -- 2.7.4