This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] resubmitted for review to fix modulo scheduling.


This is a ping for two patches, that I have combined here, since they
both are needed to fix modulo scheduling (and are both small).

The two patches being combined are
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00117.html
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00401.html
and the patch rot was fixed. 

This has been bootstrapped and regression tested on both powerpc-linux
and x86-64-linux
but the spec tests have only be rerun on powerpc-linux.  However, the
bugs are not specific to a platform, I believe that my patch,
http://gcc.gnu.org/ml/gcc-cvs/2006-01/msg00375.html, broke modulo
scheduling on all platforms. 

However, Janis has been bugging me to push on this because she wants to
get this fixed.

Kenny

2006-05-22  Kenneth Zadeck <zadeck@naturalbridge.com>

    PR rtl-optimization/26375
    PR rtl-optimization/26855
    * df-problems (df_ru_bb_local_compute_process_def): Removed update
    to gen set.
    (df_ru_bb_local_compute): Reversed statements and removed bogus
    comment explaining why they should be in wrong order.
    (df_ru_dump, df_rd_dump): Enhanced debug info. 
    * modulo-sched.c (sms_schedule, tree_opt_pass pass_sms): Enhanced
    debug info.   
    * ddg.c (add_deps_for_def): Converted use of reaching defs to   
        reaching uses and fixed space problem.
   

Index: ddg.c
===================================================================
--- ddg.c	(revision 113915)
+++ ddg.c	(working copy)
@@ -225,7 +225,7 @@ static void
 add_deps_for_def (ddg_ptr g, struct df *df, struct df_ref *rd)
 {
   int regno = DF_REF_REGNO (rd);
-  struct df_rd_bb_info *bb_info = DF_RD_BB_INFO (df, g->bb);
+  struct df_ru_bb_info *bb_info = DF_RU_BB_INFO (df, g->bb);
   struct df_link *r_use;
   int use_before_def = false;
   rtx def_insn = DF_REF_INSN (rd);
@@ -338,7 +338,7 @@ build_inter_loop_deps (ddg_ptr g, struct
 
       /* We are interested in uses of this BB.  */
       if (BLOCK_FOR_INSN (use->insn) == g->bb)
-      	add_deps_for_use (g, df,use);
+      	add_deps_for_use (g, df, use);
     }
 }
 
Index: modulo-sched.c
===================================================================
--- modulo-sched.c	(revision 113915)
+++ modulo-sched.c	(working copy)
@@ -940,6 +940,9 @@ sms_schedule (void)
   df_chain_add_problem (df, DF_DU_CHAIN | DF_UD_CHAIN);
   df_analyze (df);
 
+  if (dump_file)
+    df_dump (df, dump_file);
+
   /* Allocate memory to hold the DDG array one entry for each loop.
      We use loop->num as index into this array.  */
   g_arr = XCNEWVEC (ddg_ptr, loops->num);
@@ -2545,7 +2548,7 @@ struct tree_opt_pass pass_sms =
   0,                                    /* properties_required */
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
-  0,                                    /* todo_flags_start */
+  TODO_dump_func,                       /* todo_flags_start */
   TODO_dump_func |
   TODO_ggc_collect,                     /* todo_flags_finish */
   'm'                                   /* letter */
Index: df-problems.c
===================================================================
--- df-problems.c	(revision 113915)
+++ df-problems.c	(working copy)
@@ -440,15 +440,15 @@ df_ru_bb_local_compute_process_def (stru
 	  unsigned int n_uses = DF_REG_USE_GET (df, regno)->n_refs;
 	  if (!bitmap_bit_p (seen_in_block, regno))
 	    {
-	      /* The first def for regno, causes the kill info to be
-		 generated and the gen information to cleared.  */
+	      /* The first def for regno in the insn, causes the kill
+		 info to be generated.  Do not modify the gen set
+		 because the only values in it are the uses from here
+		 to the top of the block and this def does not effect
+		 them.  */
 	      if (!bitmap_bit_p (seen_in_insn, regno))
 		{
 		  if (n_uses > DF_SPARSE_THRESHOLD)
-		    {
-		      bitmap_set_bit (bb_info->sparse_kill, regno);
-		      bitmap_clear_range (bb_info->gen, begin, n_uses);
-		    }
+		    bitmap_set_bit (bb_info->sparse_kill, regno);
 		  else
 		    {
 		      struct df_ru_problem_data * problem_data
@@ -457,7 +457,6 @@ df_ru_bb_local_compute_process_def (stru
 			= df_ref_bitmap (problem_data->use_sites, regno, 
 				       begin, n_uses);
 		      bitmap_ior_into (bb_info->kill, uses);
-		      bitmap_and_compl_into (bb_info->gen, uses);
 		    }
 		}
 	      bitmap_set_bit (seen_in_insn, regno);
@@ -520,16 +519,12 @@ df_ru_bb_local_compute (struct dataflow 
       if (!INSN_P (insn))
 	continue;
 
-      df_ru_bb_local_compute_process_def (dflow, bb_info, 
-					  DF_INSN_UID_DEFS (df, uid), 0);
-
-      /* The use processing must happen after the defs processing even
-	 though the uses logically happen first since the defs clear
-	 the gen set. Otherwise, a use for regno occuring in the same
-	 instruction as a def for regno would be cleared.  */ 
       df_ru_bb_local_compute_process_use (bb_info, 
 					  DF_INSN_UID_USES (df, uid), 0);
 
+      df_ru_bb_local_compute_process_def (dflow, bb_info, 
+					  DF_INSN_UID_DEFS (df, uid), 0);
+
       bitmap_ior_into (seen_in_block, seen_in_insn);
       bitmap_clear (seen_in_insn);
     }
@@ -765,13 +760,13 @@ df_ru_dump (struct dataflow *dflow, FILE
       if (!bb_info->in)
 	continue;
       
-      fprintf (file, "  in  \t");
+      fprintf (file, "  in  \t(%d)\n", (int) bitmap_count_bits (bb_info->in));
       dump_bitmap (file, bb_info->in);
-      fprintf (file, "  gen \t");
+      fprintf (file, "  gen \t(%d)\n", (int) bitmap_count_bits (bb_info->gen));
       dump_bitmap (file, bb_info->gen);
-      fprintf (file, "  kill\t");
+      fprintf (file, "  kill\t(%d)\n", (int) bitmap_count_bits (bb_info->kill));
       dump_bitmap (file, bb_info->kill);
-      fprintf (file, "  out \t");
+      fprintf (file, "  out \t(%d)\n", (int) bitmap_count_bits (bb_info->out));
       dump_bitmap (file, bb_info->out);
     }
 }
@@ -1276,13 +1271,13 @@ df_rd_dump (struct dataflow *dflow, FILE
       if (!bb_info->in)
 	continue;
       
-      fprintf (file, "  in\t(%d)\n", (int) bitmap_count_bits (bb_info->in));
+      fprintf (file, "  in  \t(%d)\n", (int) bitmap_count_bits (bb_info->in));
       dump_bitmap (file, bb_info->in);
       fprintf (file, "  gen \t(%d)\n", (int) bitmap_count_bits (bb_info->gen));
       dump_bitmap (file, bb_info->gen);
       fprintf (file, "  kill\t(%d)\n", (int) bitmap_count_bits (bb_info->kill));
       dump_bitmap (file, bb_info->kill);
-      fprintf (file, "  out\t(%d)\n", (int) bitmap_count_bits (bb_info->out));
+      fprintf (file, "  out \t(%d)\n", (int) bitmap_count_bits (bb_info->out));
       dump_bitmap (file, bb_info->out);
     }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]