This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix bitmap-iterator breakage
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Thu, 04 Nov 2004 10:16:13 +0000
- Subject: fix bitmap-iterator breakage
- Organization: Codesourcery LLC
I've installed this obvious patch to fix bootstrap breakage my just installed
iterator patch caused. Booting has proceeded to building stage2.
It turns out that both ENTRY_BLOCK and EXIT_BLOCK can be set in the
bitmap here, hence the adjusted comment. I also hoisted the num_predecessors
update out of the loop.
I'm uncomfortable with the entry and exit blocks causing the bitmap to
have a block right at the end. Although this works it does limit an idea
I had to represent 'mostly full' bitmaps. Any thoughts to how difficult
it would be to change ENTRY and EXIT block's numbers? If they were
0 and 1, we wouldn't need the special check for them either, merely needing
the usual index into the bb pointer array. (This is clearly not a stage 3
thing.)
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2004-11-04 Nathan Sidwell <nathan@codesourcery.com>
* predict.c (propagate_freq): Make bitno unsigned. Move
npredecessors update out of loop.
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.131
diff -c -3 -p -r1.131 predict.c
*** predict.c 4 Nov 2004 00:23:15 -0000 1.131
--- predict.c 4 Nov 2004 09:43:14 -0000
*************** propagate_freq (struct loop *loop, bitma
*** 1557,1563 ****
basic_block head = loop->header;
basic_block bb;
basic_block last;
! int i;
edge e;
basic_block nextbb;
bitmap_iterator bi;
--- 1557,1563 ----
basic_block head = loop->header;
basic_block bb;
basic_block last;
! unsigned i;
edge e;
basic_block nextbb;
bitmap_iterator bi;
*************** propagate_freq (struct loop *loop, bitma
*** 1569,1583 ****
edge_iterator ei;
int count = 0;
! /* The outermost "loop" includes the exit block, which we can not
! look up via BASIC_BLOCK. Detect this and use EXIT_BLOCK_PTR
! directly. Do the same for the entry block just to be safe. */
! if (i == ENTRY_BLOCK)
! bb = ENTRY_BLOCK_PTR;
! else if (i == EXIT_BLOCK)
! bb = EXIT_BLOCK_PTR;
! else
! bb = BASIC_BLOCK (i);
FOR_EACH_EDGE (e, ei, bb->preds)
{
--- 1569,1583 ----
edge_iterator ei;
int count = 0;
! /* The outermost "loop" includes the exit block, which we can not
! look up via BASIC_BLOCK. Detect this and use EXIT_BLOCK_PTR
! directly. Do the same for the entry block. */
! if (i == (unsigned)ENTRY_BLOCK)
! bb = ENTRY_BLOCK_PTR;
! else if (i == (unsigned)EXIT_BLOCK)
! bb = EXIT_BLOCK_PTR;
! else
! bb = BASIC_BLOCK (i);
FOR_EACH_EDGE (e, ei, bb->preds)
{
*************** propagate_freq (struct loop *loop, bitma
*** 1589,1596 ****
fprintf (dump_file,
"Irreducible region hit, ignoring edge to %i->%i\n",
e->src->index, bb->index);
- BLOCK_INFO (bb)->npredecessors = count;
}
}
memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));
--- 1589,1596 ----
fprintf (dump_file,
"Irreducible region hit, ignoring edge to %i->%i\n",
e->src->index, bb->index);
}
+ BLOCK_INFO (bb)->npredecessors = count;
}
memcpy (&BLOCK_INFO (head)->frequency, &real_one, sizeof (real_one));