Basic block renumbering removal, part 4

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Mon May 27 15:12:00 GMT 2002


Hello.

This patch finally removes basic block renumbering and uses this fact on
several places.

Bootstrapped on i686 and SUN Ultra 60, regtested on i686.

Zdenek Dvorak

Changelog:
	* basic-block.h (last_basic_block): Declare.
	(expunge_block_nocompact): Declaration removed.
	(compact_blocks): Declare.
	* cfg.c (last_basic_block): New variable.
	(expunge_block_nocompact): Removed.
	(expunge_block): Do not compact basic blocks.
	(compact_blocks): New.
	* cfganal.c (flow_call_edges_add): Use the fact that bb indices no
	longer change.
	* cfgbuild.c (find_basic_blocks_1, find_basic_blocks): Set
	last_basic_block.
	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): Do not change
	real positions of blocks.
	(delete_unreachable_blocks): Simplified -- quadratic behavior now
	cannot occur.
	(cleanup_cfg): Compact blocks.
	* cfgrtl.c (create_basic_block): Insert basic blocks to the end of
	basic_block_info varray.
	(flow_delete_block): Comment update.
	(back_edge_of_syntactic_loop_p): Modify position check code.
	(verify_flow_info): Update checking.
	* flow.c (calculate_global_regs_live): Use FOR_EACH_BB.
	* ifcvt.c (SET_ORIG_INDEX, ORIG_INDEX): Removed.
	(find_if_case_1, find_if_case_2, if_convert): Use the fact that bb
	indices no longer change.
	* lcm.c (optimize_mode_switching): Replace n_basic_blocks with
	last_basic_block.
	* predict.c (estimate_bb_frequencies): Remove unneccessary code.
	* profile.c (branch_prob): Compact blocks.
	* sched-rgn.c (find_rgns): Replace n_basic_blocks with
	last_basic_block.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.148
diff -c -3 -p -r1.148 basic-block.h
*** basic-block.h	27 May 2002 13:45:09 -0000	1.148
--- basic-block.h	27 May 2002 17:19:00 -0000
*************** extern int n_basic_blocks;
*** 235,241 ****
  
  /* First free basic block number.  */
  
! #define last_basic_block n_basic_blocks
  
  /* Number of edges in the current function.  */
  
--- 235,241 ----
  
  /* First free basic block number.  */
  
! extern int last_basic_block;
  
  /* Number of edges in the current function.  */
  
*************** extern void allocate_bb_life_data	PARAMS
*** 670,676 ****
  extern void expunge_block		PARAMS ((basic_block));
  extern void link_block			PARAMS ((basic_block, basic_block));
  extern void unlink_block		PARAMS ((basic_block));
! extern void expunge_block_nocompact	PARAMS ((basic_block));
  extern basic_block alloc_block		PARAMS ((void));
  extern void find_unreachable_blocks	PARAMS ((void));
  extern int delete_noop_moves		PARAMS ((rtx));
--- 670,676 ----
  extern void expunge_block		PARAMS ((basic_block));
  extern void link_block			PARAMS ((basic_block, basic_block));
  extern void unlink_block		PARAMS ((basic_block));
! extern void compact_blocks		PARAMS ((void));
  extern basic_block alloc_block		PARAMS ((void));
  extern void find_unreachable_blocks	PARAMS ((void));
  extern int delete_noop_moves		PARAMS ((rtx));
Index: cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfg.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 cfg.c
*** cfg.c	26 May 2002 19:05:52 -0000	1.31
--- cfg.c	27 May 2002 17:19:00 -0000
*************** static char *flow_firstobj;
*** 65,70 ****
--- 65,74 ----
  
  int n_basic_blocks;
  
+ /* First free basic block number.  */
+ 
+ int last_basic_block;
+ 
  /* Number of edges in the current function.  */
  
  int n_edges;
*************** unlink_block (b)
*** 243,281 ****
    b->prev_bb->next_bb = b->next_bb;
  }
  
  
! /* Remove block B from the basic block array and compact behind it.  */
  
  void
! expunge_block_nocompact (b)
       basic_block b;
  {
    unlink_block (b);
  
    /* Invalidate data to make bughunting easier.  */
    memset (b, 0, sizeof *b);
    b->index = -3;
    b->succ = (edge) first_deleted_block;
    first_deleted_block = (basic_block) b;
- }
- 
- void
- expunge_block (b)
-      basic_block b;
- {
-   int i, n = n_basic_blocks;
- 
-   for (i = b->index; i + 1 < n; ++i)
-     {
-       basic_block x = BASIC_BLOCK (i + 1);
-       BASIC_BLOCK (i) = x;
-       x->index = i;
-     }
- 
-   n_basic_blocks--;
-   basic_block_info->num_elements--;
- 
-   expunge_block_nocompact (b);
  }
  
  /* Create an edge connecting SRC and DST with FLAGS optionally using
--- 247,289 ----
    b->prev_bb->next_bb = b->next_bb;
  }
  
+ /* Sequentially order blocks and compact the arrays.  */
+ void
+ compact_blocks ()
+ {
+   int i;
+   basic_block bb;
+  
+   i = 0;
+   FOR_EACH_BB (bb)
+     {
+       BASIC_BLOCK (i) = bb;
+       bb->index = i;
+       i++;
+     }
+ 
+   if (i != n_basic_blocks)
+     abort ();
+ 
+   last_basic_block = n_basic_blocks;
+ }
+ 
  
! /* Remove block B from the basic block array.  */
  
  void
! expunge_block (b)
       basic_block b;
  {
    unlink_block (b);
+   BASIC_BLOCK (b->index) = NULL;
+   n_basic_blocks--;
  
    /* Invalidate data to make bughunting easier.  */
    memset (b, 0, sizeof *b);
    b->index = -3;
    b->succ = (edge) first_deleted_block;
    first_deleted_block = (basic_block) b;
  }
  
  /* Create an edge connecting SRC and DST with FLAGS optionally using
Index: cfganal.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfganal.c,v
retrieving revision 1.23
diff -c -3 -p -r1.23 cfganal.c
*** cfganal.c	27 May 2002 13:45:10 -0000	1.23
--- cfganal.c	27 May 2002 17:19:00 -0000
*************** flow_call_edges_add (blocks)
*** 258,286 ****
  {
    int i;
    int blocks_split = 0;
!   int bb_num = 0;
!   basic_block *bbs, bb;
    bool check_last_block = false;
  
!   /* Map bb indices into basic block pointers since split_block
!      will renumber the basic blocks.  */
! 
!   bbs = xmalloc (n_basic_blocks * sizeof (*bbs));
  
    if (! blocks)
!     {
!       FOR_EACH_BB (bb)
! 	bbs[bb_num++] = bb;
! 
!       check_last_block = true;
!     }
    else
!     EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
! 			       {
! 				 bbs[bb_num++] = BASIC_BLOCK (i);
! 				 if (i == n_basic_blocks - 1)
! 				   check_last_block = true;
! 			       });
  
    /* In the last basic block, before epilogue generation, there will be
       a fallthru edge to EXIT.  Special care is required if the last insn
--- 258,273 ----
  {
    int i;
    int blocks_split = 0;
!   int last_bb = last_basic_block;
    bool check_last_block = false;
  
!   if (n_basic_blocks == 0)
!     return 0;
  
    if (! blocks)
!     check_last_block = true;
    else
!     check_last_block = TEST_BIT (blocks, EXIT_BLOCK_PTR->prev_bb->index);
  
    /* In the last basic block, before epilogue generation, there will be
       a fallthru edge to EXIT.  Special care is required if the last insn
*************** flow_call_edges_add (blocks)
*** 321,332 ****
       calls since there is no way that we can determine if they will
       return or not...  */
  
!   for (i = 0; i < bb_num; i++)
      {
!       basic_block bb = bbs[i];
        rtx insn;
        rtx prev_insn;
  
        for (insn = bb->end; ; insn = prev_insn)
  	{
  	  prev_insn = PREV_INSN (insn);
--- 308,325 ----
       calls since there is no way that we can determine if they will
       return or not...  */
  
!   for (i = 0; i < last_bb; i++)
      {
!       basic_block bb = BASIC_BLOCK (i);
        rtx insn;
        rtx prev_insn;
  
+       if (!bb)
+ 	continue;
+ 
+       if (blocks && !TEST_BIT (blocks, i))
+ 	continue;
+ 
        for (insn = bb->end; ; insn = prev_insn)
  	{
  	  prev_insn = PREV_INSN (insn);
*************** flow_call_edges_add (blocks)
*** 374,380 ****
    if (blocks_split)
      verify_flow_info ();
  
-   free (bbs);
    return blocks_split;
  }
  
--- 367,372 ----
Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 cfgbuild.c
*** cfgbuild.c	27 May 2002 13:45:11 -0000	1.20
--- cfgbuild.c	27 May 2002 17:19:00 -0000
*************** find_basic_blocks_1 (f)
*** 471,477 ****
       rtx f;
  {
    rtx insn, next;
-   int i = 0;
    rtx bb_note = NULL_RTX;
    rtx lvl = NULL_RTX;
    rtx trll = NULL_RTX;
--- 471,476 ----
*************** find_basic_blocks_1 (f)
*** 494,500 ****
        if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
  	  && head)
  	{
! 	  prev = create_basic_block_structure (i++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
--- 493,499 ----
        if ((GET_CODE (insn) == CODE_LABEL || GET_CODE (insn) == BARRIER)
  	  && head)
  	{
! 	  prev = create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
*************** find_basic_blocks_1 (f)
*** 508,514 ****
  
        if (head && control_flow_insn_p (insn))
  	{
! 	  prev = create_basic_block_structure (i++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
--- 507,513 ----
  
        if (head && control_flow_insn_p (insn))
  	{
! 	  prev = create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
  	  head = end = NULL_RTX;
  	  bb_note = NULL_RTX;
  	}
*************** find_basic_blocks_1 (f)
*** 590,600 ****
      }
  
    if (head != NULL_RTX)
!     create_basic_block_structure (i++, head, end, bb_note, prev);
    else if (bb_note)
      delete_insn (bb_note);
  
!   if (i != n_basic_blocks)
      abort ();
  
    label_value_list = lvl;
--- 589,599 ----
      }
  
    if (head != NULL_RTX)
!     create_basic_block_structure (last_basic_block++, head, end, bb_note, prev);
    else if (bb_note)
      delete_insn (bb_note);
  
!   if (last_basic_block != n_basic_blocks)
      abort ();
  
    label_value_list = lvl;
*************** find_basic_blocks (f, nregs, file)
*** 635,640 ****
--- 634,640 ----
      }
  
    n_basic_blocks = count_basic_blocks (f);
+   last_basic_block = 0;
    ENTRY_BLOCK_PTR->next_bb = EXIT_BLOCK_PTR;
    EXIT_BLOCK_PTR->prev_bb = ENTRY_BLOCK_PTR;
  
Index: cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
retrieving revision 1.60
diff -c -3 -p -r1.60 cfgcleanup.c
*** cfgcleanup.c	23 May 2002 19:23:37 -0000	1.60
--- cfgcleanup.c	27 May 2002 17:19:00 -0000
*************** merge_blocks_move_predecessor_nojumps (a
*** 688,694 ****
       basic_block a, b;
  {
    rtx barrier;
-   int index;
  
    barrier = next_nonnote_insn (a->end);
    if (GET_CODE (barrier) != BARRIER)
--- 688,693 ----
*************** merge_blocks_move_predecessor_nojumps (a
*** 714,727 ****
      fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
  	     a->index, b->index);
  
!   /* Swap the records for the two blocks around.  Although we are deleting B,
!      A is now where B was and we want to compact the BB array from where
!      A used to be.  */
!   BASIC_BLOCK (a->index) = b;
!   BASIC_BLOCK (b->index) = a;
!   index = a->index;
!   a->index = b->index;
!   b->index = index;
  
    unlink_block (a);
    link_block (a, b->prev_bb);
--- 713,719 ----
      fprintf (rtl_dump_file, "Moved block %d before %d and merged.\n",
  	     a->index, b->index);
  
!   /* Swap the records for the two blocks around.  */
  
    unlink_block (a);
    link_block (a, b->prev_bb);
*************** delete_unreachable_blocks ()
*** 1755,1767 ****
  {
    bool changed = false;
    basic_block b, next_bb;
-   int j = 0;
  
    find_unreachable_blocks ();
  
!   /* Delete all unreachable basic blocks.  Do compaction concurrently,
!      as otherwise we can wind up with O(N^2) behaviour here when we
!      have oodles of dead code.  */
  
    for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
      {
--- 1747,1756 ----
  {
    bool changed = false;
    basic_block b, next_bb;
  
    find_unreachable_blocks ();
  
!   /* Delete all unreachable basic blocks.  */
  
    for (b = ENTRY_BLOCK_PTR->next_bb; b != EXIT_BLOCK_PTR; b = next_bb)
      {
*************** delete_unreachable_blocks ()
*** 1769,1786 ****
  
        if (!(b->flags & BB_REACHABLE))
  	{
! 	  flow_delete_block_noexpunge (b);
! 	  expunge_block_nocompact (b);
  	  changed = true;
  	}
-       else
- 	{
- 	  BASIC_BLOCK (j) = b;
- 	  b->index = j++;
- 	}
      }
-   n_basic_blocks = j;
-   basic_block_info->num_elements = j;
  
    if (changed)
      tidy_fallthru_edges ();
--- 1758,1767 ----
  
        if (!(b->flags & BB_REACHABLE))
  	{
! 	  flow_delete_block (b);
  	  changed = true;
  	}
      }
  
    if (changed)
      tidy_fallthru_edges ();
*************** cleanup_cfg (mode)
*** 1806,1811 ****
--- 1787,1795 ----
  	  && !reload_completed)
  	delete_trivially_dead_insns (get_insns(), max_reg_num ());
      }
+ 
+   compact_blocks ();
+ 
    while (try_optimize_cfg (mode))
      {
        delete_unreachable_blocks (), changed = true;
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.52
diff -c -3 -p -r1.52 cfgrtl.c
*** cfgrtl.c	27 May 2002 13:45:12 -0000	1.52
--- cfgrtl.c	27 May 2002 17:19:00 -0000
*************** create_basic_block (head, end, after)
*** 336,357 ****
       basic_block after;
  {
    basic_block bb;
!   int i;
!   int index = after->index + 1;
  
!   /* Place the new block just after the block being split.  */
!   VARRAY_GROW (basic_block_info, ++n_basic_blocks);
  
!   /* Some parts of the compiler expect blocks to be number in
!      sequential order so insert the new block immediately after the
!      block being split..  */
!   for (i = n_basic_blocks - 1; i > index; --i)
!     {
!       basic_block tmp = BASIC_BLOCK (i - 1);
! 
!       BASIC_BLOCK (i) = tmp;
!       tmp->index = i;
!     }
  
    bb = create_basic_block_structure (index, head, end, NULL, after);
    bb->aux = NULL;
--- 336,347 ----
       basic_block after;
  {
    basic_block bb;
!   int index = last_basic_block++;
  
!   /* Place the new block just after the end.  */
!   VARRAY_GROW (basic_block_info, last_basic_block);
  
!   n_basic_blocks++;
  
    bb = create_basic_block_structure (index, head, end, NULL, after);
    bb->aux = NULL;
*************** flow_delete_block (b)
*** 435,441 ****
  {
    int deleted_handler = flow_delete_block_noexpunge (b);
  
!   /* Remove the basic block from the array, and compact behind it.  */
    expunge_block (b);
  
    return deleted_handler;
--- 425,431 ----
  {
    int deleted_handler = flow_delete_block_noexpunge (b);
  
!   /* Remove the basic block from the array.  */
    expunge_block (b);
  
    return deleted_handler;
*************** back_edge_of_syntactic_loop_p (bb1, bb2)
*** 1210,1221 ****
  {
    rtx insn;
    int count = 0;
  
!   if (bb1->index > bb2->index)
!     return false;
!   else if (bb1->index == bb2->index)
      return true;
  
    for (insn = bb1->end; insn != bb2->head && count >= 0;
         insn = NEXT_INSN (insn))
      if (GET_CODE (insn) == NOTE)
--- 1200,1216 ----
  {
    rtx insn;
    int count = 0;
+   basic_block bb;
  
!   if (bb1 == bb2)
      return true;
  
+   for (bb = bb1; bb && bb != bb2; bb = bb->next_bb)
+     continue;
+ 
+   if (!bb)
+     return false;
+ 
    for (insn = bb1->end; insn != bb2->head && count >= 0;
         insn = NEXT_INSN (insn))
      if (GET_CODE (insn) == NOTE)
*************** verify_flow_info ()
*** 1708,1714 ****
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int i, num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
--- 1703,1709 ----
    basic_block *bb_info, *last_visited;
    size_t *edge_checksum;
    rtx x;
!   int num_bb_notes, err = 0;
    basic_block bb, last_bb_seen;
  
    bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block));
*************** verify_flow_info ()
*** 1734,1754 ****
  	  err = 1;
  	}
  
-       /* For now, also check that we didn't change the order.  */
-       if (bb != EXIT_BLOCK_PTR && bb->index != last_bb_seen->index + 1)
- 	{
- 	  error ("Wrong order of blocks %d and %d",
- 		 last_bb_seen->index, bb->index);
- 	  err = 1;
- 	}
- 
-       if (bb == EXIT_BLOCK_PTR && last_bb_seen->index != n_basic_blocks - 1)
- 	{
- 	  error ("Only %d of %d blocks in chain",
- 		 last_bb_seen->index + 1, n_basic_blocks);
- 	  err = 1;
- 	}
- 
        last_bb_seen = bb;
      }
  
--- 1729,1734 ----
*************** verify_flow_info ()
*** 2065,2074 ****
        edge_checksum[e->dest->index + 2] -= (size_t) e;
    }
  
!   for (i = -2; i < n_basic_blocks; ++i)
!     if (edge_checksum[i + 2])
        {
! 	error ("basic block %i edge lists are corrupted", i);
  	err = 1;
        }
  
--- 2045,2054 ----
        edge_checksum[e->dest->index + 2] -= (size_t) e;
    }
  
!   FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
!     if (edge_checksum[bb->index + 2])
        {
! 	error ("basic block %i edge lists are corrupted", bb->index);
  	err = 1;
        }
  
*************** verify_flow_info ()
*** 2079,2085 ****
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
  	{
! 	  basic_block bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
  	  if (bb != last_bb_seen->next_bb)
--- 2059,2065 ----
      {
        if (NOTE_INSN_BASIC_BLOCK_P (x))
  	{
! 	  bb = NOTE_BASIC_BLOCK (x);
  
  	  num_bb_notes++;
  	  if (bb != last_bb_seen->next_bb)
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.526
diff -c -3 -p -r1.526 flow.c
*** flow.c	27 May 2002 13:45:22 -0000	1.526
--- flow.c	27 May 2002 17:19:01 -0000
*************** calculate_global_regs_live (blocks_in, b
*** 1108,1116 ****
      }
    else
      {
!       for (i = 0; i < n_basic_blocks; ++i)
  	{
- 	  basic_block bb = BASIC_BLOCK (i);
  	  *--qhead = bb;
  	  bb->aux = bb;
  	}
--- 1108,1115 ----
      }
    else
      {
!       FOR_EACH_BB (bb)
  	{
  	  *--qhead = bb;
  	  bb->aux = bb;
  	}
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 ifcvt.c
*** ifcvt.c	27 May 2002 13:45:29 -0000	1.92
--- ifcvt.c	27 May 2002 17:19:01 -0000
*************** static int dead_or_predicable		PARAMS ((
*** 111,124 ****
  						 basic_block, basic_block, int));
  static void noce_emit_move_insn		PARAMS ((rtx, rtx));
  
- /* Abuse the basic_block AUX field to store the original block index,
-    as well as a flag indicating that the block should be rescaned for
-    life analysis.  */
- 
- #define SET_ORIG_INDEX(BB,I)	((BB)->aux = (void *)((size_t)(I)))
- #define ORIG_INDEX(BB)		((size_t)(BB)->aux)
- 
- 
  /* Count the number of non-jump active insns in BB.  */
  
  static int
--- 111,116 ----
*************** find_if_case_1 (test_bb, then_edge, else
*** 2279,2284 ****
--- 2271,2277 ----
    basic_block then_bb = then_edge->dest;
    basic_block else_bb = else_edge->dest, new_bb;
    edge then_succ = then_bb->succ;
+   int then_bb_index;
  
    /* THEN has one successor.  */
    if (!then_succ || then_succ->succ_next != NULL)
*************** find_if_case_1 (test_bb, then_edge, else
*** 2319,2329 ****
  		    then_bb->global_live_at_end, BITMAP_IOR);
    
    new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
    /* Make rest of code believe that the newly created block is the THEN_BB
!      block we are going to remove.  */
    if (new_bb)
!     new_bb->aux = then_bb->aux;
!   flow_delete_block (then_bb);
    /* We've possibly created jump to next insn, cleanup_cfg will solve that
       later.  */
  
--- 2312,2326 ----
  		    then_bb->global_live_at_end, BITMAP_IOR);
    
    new_bb = redirect_edge_and_branch_force (FALLTHRU_EDGE (test_bb), else_bb);
+   then_bb_index = then_bb->index;
+   flow_delete_block (then_bb);
    /* Make rest of code believe that the newly created block is the THEN_BB
!      block we removed.  */
    if (new_bb)
!     {
!       new_bb->index = then_bb_index;
!       BASIC_BLOCK (then_bb_index) = new_bb;
!     }
    /* We've possibly created jump to next insn, cleanup_cfg will solve that
       later.  */
  
*************** find_if_case_2 (test_bb, then_edge, else
*** 2366,2373 ****
    if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2)
      ;
    else if (else_succ->dest->index < 0
! 	   || TEST_BIT (post_dominators[ORIG_INDEX (then_bb)], 
! 			ORIG_INDEX (else_succ->dest)))
      ;
    else
      return FALSE;
--- 2363,2370 ----
    if (note && INTVAL (XEXP (note, 0)) >= REG_BR_PROB_BASE / 2)
      ;
    else if (else_succ->dest->index < 0
! 	   || TEST_BIT (post_dominators[then_bb->index], 
! 			else_succ->dest->index))
      ;
    else
      return FALSE;
*************** if_convert (x_life_data_ok)
*** 2705,2714 ****
      }
    if (life_data_ok)
      clear_bb_flags ();
- 
-   /* Record initial block numbers.  */
-   FOR_EACH_BB (bb)
-     SET_ORIG_INDEX (bb, bb->index);
  
    /* Go through each of the basic blocks looking for things to convert.  */
    FOR_EACH_BB (bb)
--- 2702,2707 ----
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/lcm.c,v
retrieving revision 1.45
diff -c -3 -p -r1.45 lcm.c
*** lcm.c	27 May 2002 13:45:30 -0000	1.45
--- lcm.c	27 May 2002 17:19:01 -0000
*************** optimize_mode_switching (file)
*** 1290,1296 ****
  
  #ifdef NORMAL_MODE
    /* Restore the special status of EXIT_BLOCK.  */
!   n_basic_blocks--;
    VARRAY_POP (basic_block_info);
    EXIT_BLOCK_PTR->index = EXIT_BLOCK;
  #endif
--- 1290,1296 ----
  
  #ifdef NORMAL_MODE
    /* Restore the special status of EXIT_BLOCK.  */
!   last_basic_block--;
    VARRAY_POP (basic_block_info);
    EXIT_BLOCK_PTR->index = EXIT_BLOCK;
  #endif
Index: predict.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/predict.c,v
retrieving revision 1.69
diff -c -3 -p -r1.69 predict.c
*** predict.c	27 May 2002 13:45:31 -0000	1.69
--- predict.c	27 May 2002 17:19:01 -0000
*************** estimate_bb_frequencies (loops)
*** 1206,1213 ****
        FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
  	BLOCK_INFO (bb)->tovisit = 1;
  
-       BLOCK_INFO (ENTRY_BLOCK_PTR)->tovisit = 1;
-       BLOCK_INFO (EXIT_BLOCK_PTR)->tovisit = 1;
        propagate_freq (ENTRY_BLOCK_PTR);
  
        memcpy (&freq_max, &real_zero, sizeof (real_zero));
--- 1206,1211 ----
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 profile.c
*** profile.c	27 May 2002 13:45:34 -0000	1.90
--- profile.c	27 May 2002 17:19:01 -0000
*************** branch_prob ()
*** 831,836 ****
--- 831,839 ----
    num_edges = NUM_EDGES (el);
    alloc_aux_for_edges (sizeof (struct edge_info));
  
+   /* The basic blocks are expected to be numbered sequentially.  */
+   compact_blocks ();
+ 
    ignored_edges = 0;
    for (i = 0 ; i < num_edges ; i++)
      {
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.42
diff -c -3 -p -r1.42 sched-rgn.c
*** sched-rgn.c	27 May 2002 13:45:42 -0000	1.42
--- sched-rgn.c	27 May 2002 17:19:01 -0000
*************** find_rgns (edge_list, dom)
*** 680,686 ****
    in_stack = sbitmap_alloc (last_basic_block);
    sbitmap_zero (in_stack);
  
!   for (i = 0; i < n_basic_blocks; i++)
      max_hdr[i] = -1;
  
    /* DFS traversal to find inner loops in the cfg.  */
--- 680,686 ----
    in_stack = sbitmap_alloc (last_basic_block);
    sbitmap_zero (in_stack);
  
!   for (i = 0; i < last_basic_block; i++)
      max_hdr[i] = -1;
  
    /* DFS traversal to find inner loops in the cfg.  */



More information about the Gcc-patches mailing list