Patchwork Small adjustment in tree-ssa-loop-im.c

login
register
mail settings
Submitter Eric Botcazou
Date May 14, 2011, 7:39 p.m.
Message ID <201105142139.25094.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/95585/
State New
Headers show

Comments

Eric Botcazou - May 14, 2011, 7:39 p.m.
The Tree LIM pass keeps track of the execution status of statements by means of

/* The outermost loop for that execution of the header guarantees that the
   block will be executed.  */
#define ALWAYS_EXECUTED_IN(BB) ((struct loop *) (BB)->aux)

and there is a fill_always_executed_in function:

/* Fills ALWAYS_EXECUTED_IN information for basic blocks of LOOP, i.e.
   for each such basic block bb records the outermost loop for that execution
   of its header implies execution of bb.  CONTAINS_CALL is the bitmap of
   blocks that contain a nonpure call.  */

It turns out that the function never references ALWAYS_EXECUTED_IN, which is a 
little confusing.  Instead it accesses the AUX field directly.

Changed to using ALWAYS_EXECUTED_IN in all cases.  Tested on i586-suse-linux, 
applied on the mainline as obvious.


2011-05-14  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-ssa-loop-im.c (SET_ALWAYS_EXECUTED_IN): New macro.
	(fill_always_executed_in): Use [SET_]ALWAYS_EXECUTED_IN.
	(tree_ssa_lim_finalize): Likewise.

Patch

Index: tree-ssa-loop-im.c
===================================================================
--- tree-ssa-loop-im.c	(revision 173756)
+++ tree-ssa-loop-im.c	(working copy)
@@ -197,9 +197,10 @@  static bool ref_indep_loop_p (struct loo
 /* Minimum cost of an expensive expression.  */
 #define LIM_EXPENSIVE ((unsigned) PARAM_VALUE (PARAM_LIM_EXPENSIVE))
 
-/* The outermost loop for that execution of the header guarantees that the
+/* The outermost loop for which execution of the header guarantees that the
    block will be executed.  */
 #define ALWAYS_EXECUTED_IN(BB) ((struct loop *) (BB)->aux)
+#define SET_ALWAYS_EXECUTED_IN(BB, VAL) ((BB)->aux = (void *) (VAL))
 
 static struct lim_aux_data *
 init_lim_data (gimple stmt)
@@ -2440,7 +2441,7 @@  fill_always_executed_in (struct loop *lo
   edge e;
   struct loop *inn_loop = loop;
 
-  if (!loop->header->aux)
+  if (ALWAYS_EXECUTED_IN (loop->header) == NULL)
     {
       bbs = get_loop_body_in_dom_order (loop);
 
@@ -2482,7 +2483,7 @@  fill_always_executed_in (struct loop *lo
 
       while (1)
 	{
-	  last->aux = loop;
+	  SET_ALWAYS_EXECUTED_IN (last, loop);
 	  if (last == loop->header)
 	    break;
 	  last = get_immediate_dominator (CDI_DOMINATORS, last);
@@ -2537,9 +2538,7 @@  tree_ssa_lim_finalize (void)
   htab_t h;
 
   FOR_EACH_BB (bb)
-    {
-      bb->aux = NULL;
-    }
+    SET_ALWAYS_EXECUTED_IN (bb, NULL);
 
   pointer_map_destroy (lim_aux_data_map);