aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMostafa Hagog <mustafa@il.ibm.com>2003-12-28 16:53:27 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2003-12-28 16:53:27 +0000
commit315d849ab2c0a8dde1b517aee18bc67176be5b35 (patch)
treee6a5748acc32c525d3030085f49922c8596edf81
parentb8da67fa2f2d13121e6ea7500b6dd413efd99921 (diff)
downloadgcc-315d849ab2c0a8dde1b517aee18bc67176be5b35.zip
gcc-315d849ab2c0a8dde1b517aee18bc67176be5b35.tar.gz
gcc-315d849ab2c0a8dde1b517aee18bc67176be5b35.tar.bz2
sbitmap.c (sbitmap_union_of_diff_cg, [...]): Accumulate "changed" properly.
2003-12-28 Mostafa Hagog <mustafa@il.ibm.com> * sbitmap.c (sbitmap_union_of_diff_cg, sbitmap_a_and_b_cg, sbitmap_a_xor_b_cg): Accumulate "changed" properly. (sbitmap_not): Zero all bits past n_bit. From-SVN: r75182
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/sbitmap.c13
2 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cbd6f4b..70b2443 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-12-28 Mostafa Hagog <mustafa@il.ibm.com>
+
+ * sbitmap.c (sbitmap_union_of_diff_cg, sbitmap_a_and_b_cg,
+ sbitmap_a_xor_b_cg): Accumulate "changed" properly.
+ (sbitmap_not): Zero all bits past n_bit.
+
2003-12-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
PR opt/13159
diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c
index 3cec45d..1d27a87 100644
--- a/gcc/sbitmap.c
+++ b/gcc/sbitmap.c
@@ -250,9 +250,16 @@ sbitmap_not (sbitmap dst, sbitmap src)
unsigned int i, n = dst->size;
sbitmap_ptr dstp = dst->elms;
sbitmap_ptr srcp = src->elms;
+ unsigned int last_bit;
for (i = 0; i < n; i++)
*dstp++ = ~*srcp++;
+
+ /* Zero all bits past n_bits, by ANDing dst with sbitmap_ones. */
+ last_bit = src->n_bits % SBITMAP_ELT_BITS;
+ if (last_bit)
+ dst->elms[n-1] = dst->elms[n-1]
+ & ((SBITMAP_ELT_TYPE)-1 >> (SBITMAP_ELT_BITS - last_bit));
}
/* Set the bits in DST to be the difference between the bits
@@ -298,7 +305,7 @@ sbitmap_a_and_b_cg (sbitmap dst, sbitmap a, sbitmap b)
for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ & *bp++;
- changed = *dstp ^ tmp;
+ changed |= *dstp ^ tmp;
*dstp++ = tmp;
}
@@ -332,7 +339,7 @@ sbitmap_a_xor_b_cg (sbitmap dst, sbitmap a, sbitmap b)
for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ ^ *bp++;
- changed = *dstp ^ tmp;
+ changed |= *dstp ^ tmp;
*dstp++ = tmp;
}
@@ -366,7 +373,7 @@ sbitmap_a_or_b_cg (sbitmap dst, sbitmap a, sbitmap b)
for (i = 0; i < n; i++)
{
SBITMAP_ELT_TYPE tmp = *ap++ | *bp++;
- changed = *dstp ^ tmp;
+ changed |= *dstp ^ tmp;
*dstp++ = tmp;
}