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]

[graphite] Backend fixes


Hi,

Jan committed on Saturday some large parts for the code generation. Here
the next fixes to hit some more bugs.


Always generate graphite code.
==============================

 * graphite.c (graphite_transform_loops): Always call gloog and
 find_transform.

At the moment we call the GRAPHITE code generation only, if we applied a
transformation like "-floop-block". GRAPHITE does not change the CFG,
if we call gcc only with "-fgraphite",

I propose to always generate code, if "-fgraphite" is enables. This has
some advantages.

 - Better code coverage -> More testing of the backend
 - We can check the performance for a NULL transformation
   GIMPLE -> GRAPHITE -> GIMPLE
 - If cloog optimizations are not disabled, the cloog output is
   always optimized in control flow.

   for (i = 0; i < 100; i ++)
 	if (i < 30 && i > 60)
 		A
   becomes
   for (i = 0; i < 30; i++)
 	A
   for (i = 61; i < 100; i++)
 	A

Patch: graphite-Always_generate_graphite_code_2008-08-25.patch


Disable cloog optimizations
===========================

 * graphite.c (set_cloog_options): Disable optimizations.

Cloog optimizes the output in control flow.

Example:

          for (i = 0; i < 100; i ++)
                if (i < 30 && i > 60)
                        A
          becomes:

          for (i = 0; i < 30; i++)
                A
          for (i = 61; i < 100; i++)
                A

This breaks the current code generation, as some bbs may appear twice
or more often in the clast output.

Wait until codegen is updated.

Patch: graphite-Disable_cloog_optimizations_2008-08-25.patch


Fix SEGFAULT in remove_cond_exprs
=================================

 graphite.c (remove_cond_exprs): Do not fail on empty bbs.

Patch: graphite-Fix_SEGFAULT_in_remove_cond_exprs_2008-08-25.patch


Update dominator info
=====================

 * graphite.c (gloog): Update dominator info.

Patch: graphite-Update_dominator_info_2008-08-25.patch


Together with my latest cloog-ppl patch graphite can generate code for
the first SCoPs. That means we pass about half of the Polyhedron.

See you
Tobi
Always generate graphite code.

2008-08-25  Tobias Grosser  <grosser@fim.uni-passau.de>

	* graphite.c (graphite_transform_loops): Always call gloog and
	find_transform.

At the moment we call the GRAPHITE code generation only, if we applied a
transformation like "-floop-block". GRAPHITE does not change the CFG,
if we call gcc only with "-fgraphite",

I propose to always generate code, if "-fgraphite" is enables. This has
some advantages.

	- Better code coverage -> More testing of the backend
	- We can check the performance for a NULL transformation
	  GIMPLE -> GRAPHITE -> GIMPLE
	- If cloog optimizations are not disabled, the cloog output is
	  always optimized in control flow.

	  for (i = 0; i < 100; i ++)
		if (i < 30 && i > 60)
			A
	  becomes
	  for (i = 0; i < 30; i++)
		A
	  for (i = 61; i < 100; i++)
		A

diff --git a/gcc/graphite.c b/gcc/graphite.c
index 9ff9cd0..b3ded30 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -4496,16 +4496,15 @@ graphite_transform_loops (void)
 	  fprintf (dump_file, "\nnumber of data refs: %d\n", nbrefs);
 	}
 
-      /* We only build new graphite code, if we applied a transformation. But
-         call find_transform always to get more test coverage during
-         developement.  */
-      if (graphite_apply_transformations (scop))
+      /* Always generate code, even if we did not apply any transformation.
+	 Reason:
+        - Better code coverage -> More testing of the backend
+        - We can check the performance for a NULL transformation 
+          GIMPLE -> GRAPHITE -> GIMPLE
+        - If cloog optimizations are not disabled, the cloog output is
+          always optimized in control flow.  */
+      if (1 || graphite_apply_transformations (scop))
         gloog (scop, find_transform (scop));
-      else
-        {
-          struct clast_stmt* stmt = find_transform (scop);
-          cloog_clast_free (stmt);
-        }
     }
 
   if (dump_file && (dump_flags & TDF_DETAILS))
Disable cloog optimizations

2008-08-25  Tobias Grosser  <grosser@fim.uni-passau.de>

	* graphite.c (set_cloog_options): Disable optimizations.

Cloog optimizes the output in control flow.

Example:

          for (i = 0; i < 100; i ++)
                if (i < 30 && i > 60)
                        A
          becomes:

          for (i = 0; i < 30; i++)
                A
          for (i = 61; i < 100; i++)
                A

This breaks the current code generation, as some bbs may appear twice
or more often in the clast output.

Wait until codegen is updated.

diff --git a/gcc/graphite.c b/gcc/graphite.c
index b3ded30..38940b2 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -3247,9 +3247,18 @@ set_cloog_options (void)
      input.  This is useful for debugging,  but later we want the optimized
      code.
 
-     XXX: We can not disable optimizations, as loop blocking is not working
-     without them.  */
-  if (0)
+     Cloog optimizes the code in control flow.
+
+     Example:
+          for (i = 0; i < 100; i ++)
+                if (i < 30 && i > 60)
+                        A
+          becomes
+          for (i = 0; i < 30; i++)
+                A
+          for (i = 61; i < 100; i++)
+                A  */
+  if (1)
     {
       options->f = -1;
       options->l = INT_MAX;
Fix SEGFAULT in remove_cond_exprs

2008-08-25  Tobias Grosser  <grosser@fim.uni-passau.de>

	graphite.c (remove_cond_exprs): Do not fail on empty bbs.

diff --git a/gcc/graphite.c b/gcc/graphite.c
index 38940b2..5316833 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -3001,7 +3001,9 @@ move_phi_nodes (scop_p scop, loop_p old_loop_father, basic_block from,
 static void
 remove_cond_exprs (basic_block bb)
 {
-  if (gimple_code (last_stmt (bb)) == GIMPLE_COND)
+  gimple last = last_stmt (bb);
+
+  if (last && gimple_code (last) == GIMPLE_COND)
     {
       gimple_stmt_iterator gsi = gsi_last_bb (bb);
       gsi_remove (&gsi, true);
Update dominator info

2008-08-25  Tobias Grosser  <grosser@fim.uni-passau.de>

	* graphite.c (gloog): Update dominator info.

diff --git a/gcc/graphite.c b/gcc/graphite.c
index 5316833..2a1ddd3 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -3637,6 +3637,14 @@ gloog (scop_p scop, struct clast_stmt *stmt)
 					construction_edge->src->loop_father,
 					stmt, construction_edge, &ivstack);
   redirect_edge_succ (new_scop_exit_edge, scop_exit);
+  if (!old_scop_exit_idom
+      || !dominated_by_p (CDI_DOMINATORS, SCOP_ENTRY (scop),
+			  old_scop_exit_idom)
+      || SCOP_ENTRY (scop) == old_scop_exit_idom)
+    set_immediate_dominator (CDI_DOMINATORS,
+			     new_scop_exit_edge->dest,
+			     new_scop_exit_edge->src);
+
   cloog_clast_free (stmt);
 
   if (new_scop_exit_edge->dest == EXIT_BLOCK_PTR)
@@ -3649,12 +3657,6 @@ gloog (scop_p scop, struct clast_stmt *stmt)
   patch_phis_for_virtual_defs ();
 
   find_unreachable_blocks ();
-  if (old_scop_exit_idom 
-      && !(old_scop_exit_idom->flags & BB_REACHABLE))
-    set_immediate_dominator (CDI_DOMINATORS,
-			     new_scop_exit_edge->dest,
-			     new_scop_exit_edge->src);
-
   delete_unreachable_blocks();
   mark_old_loops (scop);
   remove_dead_loops ();

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