2010-02-25 Nicolas Benoit * ebitmap.c: Change calls to verify_popcount with calls to sbitmap_verify_popcount. (ebitmap_clear_bit): Fixed map->cacheindex test and map>cache update when bit clearing results in an empty element. Index: ebitmap.c =================================================================== --- ebitmap.c (revision 157079) +++ ebitmap.c (working copy) @@ -1,5 +1,5 @@ /* Sparse array-based bitmaps. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Daniel Berlin This file is part of GCC. @@ -254,8 +254,13 @@ ebitmap_clear_bit (ebitmap map, unsigned if (!have_eltwordindex) eltwordindex = sbitmap_popcount (map->wordmask, wordindex); - if (map->cache != NULL && map->cacheindex == eltwordindex) - map->cache = NULL; + if (map->cache != NULL) + { + if (map->cacheindex == wordindex) + map->cache = NULL; + else if (map->cacheindex > wordindex) + map->cache = map->cache - 1; + } RESET_BIT (map->wordmask, wordindex); @@ -457,7 +462,7 @@ ebitmap_and_into (ebitmap dst, ebitmap s for (i = 0; i < dst->numwords; i++) gcc_assert (dst->elts[i] != 0); - verify_popcount (dst->wordmask); + sbitmap_verify_popcount (dst->wordmask); gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == dst->numwords); } @@ -529,7 +534,7 @@ ebitmap_and (ebitmap dst, ebitmap src1, for (i = 0; i < dst->numwords; i++) gcc_assert (dst->elts[i] != 0); - verify_popcount (dst->wordmask); + sbitmap_verify_popcount (dst->wordmask); gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == dst->numwords); } @@ -652,7 +657,7 @@ ebitmap_ior_into (ebitmap dst, ebitmap s EXECUTE_IF_SET_IN_EBITMAP (dstcopy, 0, i, ebi) gcc_assert (ebitmap_bit_p (dst, i)); - verify_popcount (dst->wordmask); + sbitmap_verify_popcount (dst->wordmask); gcc_assert (changed == !ebitmap_equal_p (dst, dstcopy)); gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == dst->numwords); @@ -772,7 +777,7 @@ ebitmap_ior (ebitmap dst, ebitmap src1, EXECUTE_IF_SET_IN_EBITMAP (src2, 0, i, ebi) gcc_assert (ebitmap_bit_p (dst, i)); } - verify_popcount (dst->wordmask); + sbitmap_verify_popcount (dst->wordmask); gcc_assert (changed == !ebitmap_equal_p (dst, dstcopy)); gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == dst->numwords); @@ -848,7 +853,7 @@ ebitmap_and_compl_into (ebitmap dst, ebi gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == neweltindex); - verify_popcount (dst->wordmask); + sbitmap_verify_popcount (dst->wordmask); gcc_assert (changed == !ebitmap_equal_p (dst, dstcopy)); gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == dst->numwords); @@ -950,7 +955,7 @@ ebitmap_and_compl (ebitmap dst, ebitmap for (i = 0; i < dst->numwords; i++) gcc_assert (dst->elts[i] != 0); - verify_popcount (dst->wordmask); + sbitmap_verify_popcount (dst->wordmask); gcc_assert (sbitmap_popcount (dst->wordmask, dst->wordmask->n_bits) == dst->numwords); }