tree-ssa-loop-ivopts.c (alloc_use_cost_map): Use bitmap_count_bits and ceil_log2.
authorRichard Biener <rguenther@suse.de>
Wed, 20 Feb 2013 09:03:18 +0000 (09:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 20 Feb 2013 09:03:18 +0000 (09:03 +0000)
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

gcc/ChangeLog
gcc/tree-ssa-loop-ivopts.c

index 005d9a12ac68c390801acdb43c3c40f3b33d2ab7..2a92d350a42d19012d487c256f3d2ec9e6386860 100644 (file)
@@ -1,9 +1,17 @@
+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.
+
 2013-02-20  Igor Zamyatin  <igor.zamyatin@intel.com>
 
        * config/i386/i386.c (initial_ix86_tune_features): Turn on fp
        reassociation for avx2 targets.
 
 2012-02-19  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+
        * 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 
index d30bfec50626c2695ec8d4ee206ec51ded452c20..2940bf100447874d98bab4fc8265ae8713ecc603 100644 (file)
@@ -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;
 }