[patch] Remove loop->level

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Tue Nov 21 01:31:00 GMT 2006


Hello,

loop->level field is not used anywhere; this patch removes it.
Bootstrapped & regtested on i686, I will commit this in a moment.

Zdenek

	* cfgloopmanip.c (add_loop, duplicate_loop): Do not set level
	of the loop.
	* cfgloop.c (flow_loop_level_compute, flow_loops_level_compute):
	Removed.
	(flow_loop_dump): Do not dump loop level.
	(flow_loops_find): Do not call flow_loops_level_compute.
	* cfgloop.h (struct loop): Remove level field.

Index: cfgloopmanip.c
===================================================================
*** cfgloopmanip.c	(revision 119015)
--- cfgloopmanip.c	(working copy)
*************** add_loop (struct loops *loops, struct lo
*** 379,385 ****
    /* Add it to loop structure.  */
    place_new_loop (loops, loop);
    flow_loop_tree_node_add (outer, loop);
-   loop->level = 1;
  
    /* Find its nodes.  */
    bbs = XCNEWVEC (basic_block, n_basic_blocks);
--- 379,384 ----
*************** duplicate_loop (struct loops *loops, str
*** 653,662 ****
    cloop = XCNEW (struct loop);
    place_new_loop (loops, cloop);
  
!   /* Initialize copied loop.  */
!   cloop->level = loop->level;
! 
!   /* Set it as copy of loop.  */
    loop->copy = cloop;
  
    /* Add it to target.  */
--- 652,658 ----
    cloop = XCNEW (struct loop);
    place_new_loop (loops, cloop);
  
!   /* Mark the new loop as copy of LOOP.  */
    loop->copy = cloop;
  
    /* Add it to target.  */
Index: cfgloop.c
===================================================================
*** cfgloop.c	(revision 119015)
--- cfgloop.c	(working copy)
*************** Software Foundation, 51 Franklin Street,
*** 41,48 ****
  #define LATCH_EDGE(E) (*(int *) (E)->aux)
  
  static void flow_loops_cfg_dump (const struct loops *, FILE *);
- static int flow_loop_level_compute (struct loop *);
- static void flow_loops_level_compute (struct loops *);
  static void establish_preds (struct loop *);
  static void canonicalize_loop_headers (void);
  static bool glb_enum_p (basic_block, void *);
--- 41,46 ----
*************** flow_loop_dump (const struct loop *loop,
*** 110,118 ****
  
    fprintf (file, ";;  header %d, latch %d\n",
  	   loop->header->index, loop->latch->index);
!   fprintf (file, ";;  depth %d, level %d, outer %ld\n",
! 	   loop->depth, loop->level,
! 	   (long) (loop->outer ? loop->outer->num : -1));
  
    fprintf (file, ";;  nodes:");
    bbs = get_loop_body (loop);
--- 108,115 ----
  
    fprintf (file, ";;  header %d, latch %d\n",
  	   loop->header->index, loop->latch->index);
!   fprintf (file, ";;  depth %d, outer %ld\n",
! 	   loop->depth, (long) (loop->outer ? loop->outer->num : -1));
  
    fprintf (file, ";;  nodes:");
    bbs = get_loop_body (loop);
*************** flow_loop_tree_node_remove (struct loop 
*** 355,399 ****
    loop->pred = NULL;
  }
  
- /* Helper function to compute loop nesting depth and enclosed loop level
-    for the natural loop specified by LOOP.  Returns the loop level.  */
- 
- static int
- flow_loop_level_compute (struct loop *loop)
- {
-   struct loop *inner;
-   int level = 1;
- 
-   if (! loop)
-     return 0;
- 
-   /* Traverse loop tree assigning depth and computing level as the
-      maximum level of all the inner loops of this loop.  The loop
-      level is equivalent to the height of the loop in the loop tree
-      and corresponds to the number of enclosed loop levels (including
-      itself).  */
-   for (inner = loop->inner; inner; inner = inner->next)
-     {
-       int ilevel = flow_loop_level_compute (inner) + 1;
- 
-       if (ilevel > level)
- 	level = ilevel;
-     }
- 
-   loop->level = level;
-   return level;
- }
- 
- /* Compute the loop nesting depth and enclosed loop level for the loop
-    hierarchy tree specified by LOOPS.  Return the maximum enclosed loop
-    level.  */
- 
- static void
- flow_loops_level_compute (struct loops *loops)
- {
-   flow_loop_level_compute (loops->tree_root);
- }
- 
  /* A callback to update latch and header info for basic block JUMP created
     by redirecting an edge.  */
  
--- 352,357 ----
*************** flow_loops_find (struct loops *loops)
*** 707,716 ****
  	  loop->num_nodes = flow_loop_nodes_find (loop->header, loop);
  	}
  
-       /* Assign the loop nesting depth and enclosed loop level for each
- 	 loop.  */
-       flow_loops_level_compute (loops);
- 
        loops->num = num_loops;
        initialize_loops_parallel_p (loops);
  
--- 665,670 ----
Index: cfgloop.h
===================================================================
*** cfgloop.h	(revision 119015)
--- cfgloop.h	(working copy)
*************** struct loop
*** 104,113 ****
    /* Superloops of the loop.  */
    struct loop **pred;
  
-   /* The height of the loop (enclosed loop levels) within the loop
-      hierarchy tree.  */
-   int level;
- 
    /* The outer (parent) loop or NULL if outermost loop.  */
    struct loop *outer;
  
--- 104,109 ----



More information about the Gcc-patches mailing list