This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Fix some fallout from sbitmap -> bitmap transition
- From: Jan Vroonhof <jan dot vroonhof at ntlworld dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: 26 Apr 2003 20:50:42 +0100
- Subject: [tree-ssa] Fix some fallout from sbitmap -> bitmap transition
elim_create uses bitmap_clear_bit inside an EXECUTE_IF_SET_IN_BITMAP.
This might potentially free the bitmap block we are currently walking.
[this does indeed happen with a noddy example and -ftree-copyprop].
After applying this fix said noddy example starts crashing in its
usual place (edge splitting) again.
2003-04-26 Jan Vroonhof <jan dot vroonhof at ntlworld dot com>
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP_CLEAR): New bitmap walking
macro. Clear bit when iterating over it. Primitive initial
implementation (does not free data block when it turns out to be
empty after walk).
* tree-ssa.c (elim_create): Don't modify bitmap while using
bitmap walking macro, use implicit clearing macro.
Index: bitmap.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bitmap.h,v
retrieving revision 1.28.2.1
diff -u -r1.28.2.1 bitmap.h
--- bitmap.h 3 Feb 2003 17:08:22 -0000 1.28.2.1
+++ bitmap.h 26 Apr 2003 19:45:12 -0000
@@ -217,6 +217,23 @@
} \
} while (0)
+/* Loop over all bits in BITMAP, starting with MIN, setting BITNUM to
+ the bit number, clearing the bit and executing CODE for all bits
+ that are set.
+
+ #### FIXME: Reusing EXECUTE_IF_SET_IN_BITMAP does not free the block
+ (if possible) before going to ptr->next;
+*/
+
+#define EXECUTE_IF_SET_IN_BITMAP_CLEAR(BITMAP, MIN, BITNUM, CODE) \
+do { \
+ EXECUTE_IF_SET_IN_BITMAP(BITMAP, MIN, BITNUM, \
+ { \
+ ptr_->bits[word_num_] &= ~mask_; \
+ CODE; \
+ }); \
+} while (0)
+
/* Loop over all bits in BITMAP1 and BITMAP2, starting with MIN, setting
BITNUM to the bit number and executing CODE for all bits that are set in
the first bitmap and not set in the second. */
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.69
diff -u -r1.1.4.69 tree-ssa.c
--- tree-ssa.c 26 Apr 2003 03:04:04 -0000 1.1.4.69
+++ tree-ssa.c 26 Apr 2003 19:45:14 -0000
@@ -1129,10 +1129,9 @@
}
else
{
- EXECUTE_IF_SET_IN_BITMAP (g->succ[T], 0, S,
+ EXECUTE_IF_SET_IN_BITMAP_CLEAR (g->succ[T], 0, S,
{
SET_BIT (g->visited, T);
- bitmap_clear_bit(g->succ[T], S);
insert_copy_on_edge (g->e,
partition_to_var (g->map, T),
partition_to_var (g->map, S));
@@ -2035,7 +2034,7 @@
#if 0
register_new_def (*def_p, cached_lhs, block_defs_p);
ssa_stats.num_re++;
- bsi_remove (si);
+ bsi_remove (&si);
return;
#else
if (var_is_live (cached_lhs, ann->bb))