[PATCH][GRAPHITE] Tame down dumping

Richard Biener rguenther@suse.de
Fri Oct 20 10:50:00 GMT 2017


This tames dumping a bit and adjusts whitespacing and order of dumping.

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

2017-10-20  Richard Biener  <rguenther@suse.de>

	* graphite-isl-ast-to-gimple.c
	(translate_isl_ast_to_gimple::graphite_copy_stmts_from_block):
	Remove return value and simplify, dump copied stmt after lhs
	adjustment.
	(translate_isl_ast_to_gimple::translate_isl_ast_node_user):
	Reduce dump verbosity.
	(gsi_insert_earliest): Likewise.
	(translate_isl_ast_to_gimple::copy_bb_and_scalar_dependences): Adjust.
	* graphite.c (print_global_statistics): Adjust dumping.
	(print_graphite_scop_statistics): Likewise.
	(print_graphite_statistics): Do not dump loops here.
	(graphite_transform_loops): But here.

Index: gcc/graphite-isl-ast-to-gimple.c
===================================================================
--- gcc/graphite-isl-ast-to-gimple.c	(revision 253926)
+++ gcc/graphite-isl-ast-to-gimple.c	(working copy)
@@ -191,7 +191,7 @@ class translate_isl_ast_to_gimple
 
   tree get_rename_from_scev (tree old_name, gimple_seq *stmts, loop_p loop,
 			     vec<tree> iv_map);
-  bool graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
+  void graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
 				       vec<tree> iv_map);
   edge copy_bb_and_scalar_dependences (basic_block bb, edge next_e,
 				       vec<tree> iv_map);
@@ -791,13 +810,12 @@ translate_isl_ast_node_user (__isl_keep
   isl_ast_expr_free (user_expr);
 
   basic_block old_bb = GBB_BB (gbb);
-  if (dump_file)
+  if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file,
 	       "[codegen] copying from bb_%d on edge (bb_%d, bb_%d)\n",
 	       old_bb->index, next_e->src->index, next_e->dest->index);
       print_loops_bb (dump_file, GBB_BB (gbb), 0, 3);
-
     }
 
   next_e = copy_bb_and_scalar_dependences (old_bb, next_e, iv_map);
@@ -807,7 +825,7 @@ translate_isl_ast_node_user (__isl_keep
   if (codegen_error_p ())
     return NULL;
 
-  if (dump_file)
+  if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file, "[codegen] (after copy) new basic block\n");
       print_loops_bb (dump_file, next_e->src, 0, 3);
@@ -1049,9 +1067,9 @@ gsi_insert_earliest (gimple_seq seq)
 
       if (dump_file)
 	{
-	  fprintf (dump_file, "[codegen] inserting statement: ");
+	  fprintf (dump_file, "[codegen] inserting statement in BB %d: ",
+		   gimple_bb (use_stmt)->index);
 	  print_gimple_stmt (dump_file, use_stmt, 0, TDF_VOPS | TDF_MEMSYMS);
-	  print_loops_bb (dump_file, gimple_bb (use_stmt), 0, 3);
 	}
     }
 }
@@ -1122,7 +1140,7 @@ should_copy_to_new_region (gimple *stmt,
 /* Duplicates the statements of basic block BB into basic block NEW_BB
    and compute the new induction variables according to the IV_MAP.  */
 
-bool translate_isl_ast_to_gimple::
+void translate_isl_ast_to_gimple::
 graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
 				vec<tree> iv_map)
 {
@@ -1139,7 +1157,6 @@ graphite_copy_stmts_from_block (basic_bl
       /* Create a new copy of STMT and duplicate STMT's virtual
 	 operands.  */
       gimple *copy = gimple_copy (stmt);
-      gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT);
 
       /* Rather than not copying debug stmts we reset them.
          ???  Where we can rewrite uses without inserting new
@@ -1154,12 +1171,6 @@ graphite_copy_stmts_from_block (basic_bl
 	    gcc_unreachable ();
 	}
 
-      if (dump_file)
-	{
-	  fprintf (dump_file, "[codegen] inserting statement: ");
-	  print_gimple_stmt (dump_file, copy, 0);
-	}
-
       maybe_duplicate_eh_stmt (copy, stmt);
       gimple_duplicate_stmt_histograms (cfun, copy, cfun, stmt);
 
@@ -1172,8 +1183,12 @@ graphite_copy_stmts_from_block (basic_bl
 	  create_new_def_for (old_name, copy, def_p);
 	}
 
-      if (codegen_error_p ())
-	return false;
+      gsi_insert_after (&gsi_tgt, copy, GSI_NEW_STMT);
+      if (dump_file)
+	{
+	  fprintf (dump_file, "[codegen] inserting statement: ");
+	  print_gimple_stmt (dump_file, copy, 0);
+	}
 
       /* For each SCEV analyzable SSA_NAME, rename their usage.  */
       ssa_op_iter iter;
@@ -1198,8 +1213,6 @@ graphite_copy_stmts_from_block (basic_bl
 
       update_stmt (copy);
     }
-
-  return true;
 }
 
 
@@ -1236,11 +1249,7 @@ copy_bb_and_scalar_dependences (basic_bl
       gsi_insert_after (&gsi_tgt, ass, GSI_NEW_STMT);
     }
 
-  if (!graphite_copy_stmts_from_block (bb, new_bb, iv_map))
-    {
-      set_codegen_error ();
-      return NULL;
-    }
+  graphite_copy_stmts_from_block (bb, new_bb, iv_map);
 
   /* Insert out-of SSA copies on the original BB outgoing edges.  */
   gsi_tgt = gsi_last_bb (new_bb);
Index: gcc/graphite.c
===================================================================
--- gcc/graphite.c	(revision 253926)
+++ gcc/graphite.c	(working copy)
@@ -111,7 +111,7 @@ print_global_statistics (FILE* file)
   fprintf (file, "LOOPS:%ld, ", n_loops);
   fprintf (file, "CONDITIONS:%ld, ", n_conditions);
   fprintf (file, "STMTS:%ld)\n", n_stmts);
-  fprintf (file, "\nGlobal profiling statistics (");
+  fprintf (file, "Global profiling statistics (");
   fprintf (file, "BBS:");
   n_p_bbs.dump (file);
   fprintf (file, ", LOOPS:");
@@ -120,7 +120,7 @@ print_global_statistics (FILE* file)
   n_p_conditions.dump (file);
   fprintf (file, ", STMTS:");
   n_p_stmts.dump (file);
-  fprintf (file, ")\n");
+  fprintf (file, ")\n\n");
 }
 
 /* Print statistics for SCOP to FILE.  */
@@ -185,7 +185,7 @@ print_graphite_scop_statistics (FILE* fi
   fprintf (file, "LOOPS:%ld, ", n_loops);
   fprintf (file, "CONDITIONS:%ld, ", n_conditions);
   fprintf (file, "STMTS:%ld)\n", n_stmts);
-  fprintf (file, "\nSCoP profiling statistics (");
+  fprintf (file, "SCoP profiling statistics (");
   fprintf (file, "BBS:");
   n_p_bbs.dump (file);
   fprintf (file, ", LOOPS:");
@@ -194,7 +194,7 @@ print_graphite_scop_statistics (FILE* fi
   n_p_conditions.dump (file);
   fprintf (file, ", STMTS:");
   n_p_stmts.dump (file);
-  fprintf (file, ")\n");
+  fprintf (file, ")\n\n");
 }
 
 /* Print statistics for SCOPS to FILE.  */
@@ -203,15 +203,10 @@ static void
 print_graphite_statistics (FILE* file, vec<scop_p> scops)
 {
   int i;
-
   scop_p scop;
 
   FOR_EACH_VEC_ELT (scops, i, scop)
     print_graphite_scop_statistics (file, scop);
-
-  /* Print the loop structure.  */
-  print_loops (file, 2);
-  print_loops (file, 3);
 }
 
 /* Deletes all scops in SCOPS.  */
@@ -358,6 +353,13 @@ graphite_transform_loops (void)
   sort_sibling_loops (cfun);
   canonicalize_loop_closed_ssa_form ();
 
+  /* Print the loop structure.  */
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    {
+      print_loops (dump_file, 2);
+      print_loops (dump_file, 3);
+    }
+
   calculate_dominance_info (CDI_POST_DOMINATORS);
   build_scops (&scops);
   free_dominance_info (CDI_POST_DOMINATORS);



More information about the Gcc-patches mailing list