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] fix PR37828: ICE in expand_scalar_variables_expr, at graphite.c:3421 with -floop-block


Hi,

This patch should fix most of the SPEC and polyhedron benchmarks
code generation ICEs for the -floop-block.  This still should fail with
-fgraphite-identity, but that's another fix.

Okay for trunk?

Sebastian
2008-10-14  Sebastian Pop  <sebastian.pop@amd.com>
    	    Harsha Jagasia  <harsha.jagasia@amd.com>

	PR tree-optimization/37828
	* testsuite/gcc.dg/graphite/pr37828.c: New.
	* graphite.c (graphite_trans_loop_block): Do not loop block
	single nested loops.

Index: testsuite/gcc.dg/graphite/pr37828.c
===================================================================
--- testsuite/gcc.dg/graphite/pr37828.c	(revision 0)
+++ testsuite/gcc.dg/graphite/pr37828.c	(revision 0)
@@ -0,0 +1,25 @@
+/* { dg-options "-O2 -floop-block" } */
+
+typedef struct foo
+{
+  struct foo **Node;
+} foo;
+
+static int sort_and_split (foo **Root, foo **Finite, long first)
+{
+  foo *cd;
+  long i;
+  for (i = 0; i < first; i++)
+    cd->Node[i] = Finite[first+i];
+
+  sort_and_split(Root, Finite, first);
+  return (0);
+}
+
+
+void Build_foo(foo **Root, foo **Finite, foo **Infinite)
+{
+  long low, high;
+  while (sort_and_split(Root, Finite, low) == 0);
+}
+
Index: graphite.c
===================================================================
--- graphite.c	(revision 140978)
+++ graphite.c	(working copy)
@@ -4768,13 +4768,19 @@ graphite_trans_loop_block (VEC (graphite
   /* TODO: - Calculate the stride size automatically.  */
   int stride_size = 64;
 
+  /* It makes no sense to block a single loop.  */
+  for (i = 0; VEC_iterate (graphite_bb_p, bbs, i, gb); i++)
+    if (gbb_nb_loops (gb) < 2)
+      return false;
+
   for (i = 0; VEC_iterate (graphite_bb_p, bbs, i, gb); i++)
     transform_done |= graphite_trans_bb_block (gb, stride_size, loops);
 
   return transform_done;
 }
 
-/* Loop block all basic blocks of SCOP.  */
+/* Loop block all basic blocks of SCOP.  Return false when the
+   transform is not performed.  */
 
 static bool
 graphite_trans_scop_block (scop_p scop)
@@ -4791,10 +4797,10 @@ graphite_trans_scop_block (scop_p scop)
   lambda_vector last_schedule = lambda_vector_new (max_schedule);
 
   if (VEC_length (graphite_bb_p, SCOP_BBS (scop)) == 0)
-    return transform_done;
+    return false;
 
   /* Get the data of the first bb.  */
-  gb = VEC_index (graphite_bb_p, SCOP_BBS (scop), 0); 
+  gb = VEC_index (graphite_bb_p, SCOP_BBS (scop), 0);
   last_nb_loops = gbb_nb_loops (gb);
   lambda_vector_copy (GBB_STATIC_SCHEDULE (gb), last_schedule,
                       last_nb_loops + 1);

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