]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2008-10-15 Sebastian Pop <sebastian.pop@amd.com>
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2008 16:17:45 +0000 (16:17 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Oct 2008 16:17:45 +0000 (16:17 +0000)
         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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141142 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/graphite.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr37828.c [new file with mode: 0644]

index 1ac849fed6f1d5be6216741abafc5f1afec576cd..cc80609191124916f44a64b514214257ee8be506 100644 (file)
@@ -1,3 +1,10 @@
+2008-10-15  Sebastian Pop  <sebastian.pop@amd.com>
+           Harsha Jagasia  <harsha.jagasia@amd.com>
+
+       PR tree-optimization/37828
+       * graphite.c (graphite_trans_loop_block): Do not loop block
+       single nested loops.
+
 2008-10-15  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/37686
index a615e2c1e494e16e3f0b613b93bcb44e9d77d61a..c31c305cf99af9a83f6175f1b0cb14e7f5b46255 100644 (file)
@@ -4767,13 +4767,19 @@ graphite_trans_loop_block (VEC (graphite_bb_p, heap) *bbs, int loops)
   /* 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)
@@ -4790,10 +4796,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 328a51412b0462b10a53a04bdae42abbba4a1d6c..91966c4a2886e75fbf3b984a15ebebb4c874fc46 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-15  Sebastian Pop  <sebastian.pop@amd.com>
+           Harsha Jagasia  <harsha.jagasia@amd.com>
+
+       PR tree-optimization/37828
+       * testsuite/gcc.dg/graphite/pr37828.c: New.
+
 2008-10-15  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR tree-optimization/37686
diff --git a/gcc/testsuite/gcc.dg/graphite/pr37828.c b/gcc/testsuite/gcc.dg/graphite/pr37828.c
new file mode 100644 (file)
index 0000000..0a0412d
--- /dev/null
@@ -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);
+}
+