OSDN Git Service

2010-11-09 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Nov 2010 16:54:05 +0000 (16:54 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Nov 2010 16:54:05 +0000 (16:54 +0000)
PR tree-optimization/46355
* tree-loop-distribution.c (tree_loop_distribution): Do not
distribute loops without a single exit.

* gcc.dg/pr46355.c: New testcase.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr46355.c [new file with mode: 0644]
gcc/tree-loop-distribution.c

index b41bb87..a828481 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-09  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/46355
+       * tree-loop-distribution.c (tree_loop_distribution): Do not
+       distribute loops without a single exit.
+
 2010-11-09  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        PR rtl-optimization/46237
index 70493d9..1473884 100644 (file)
@@ -1,5 +1,10 @@
 2010-11-09  Richard Guenther  <rguenther@suse.de>
 
+       PR tree-optimization/46355
+       * gcc.dg/pr46355.c: New testcase.
+
+2010-11-09  Richard Guenther  <rguenther@suse.de>
+
        PR tree-optimization/46177
        * gcc.dg/pr46177-2.c: New testcase.
 
diff --git a/gcc/testsuite/gcc.dg/pr46355.c b/gcc/testsuite/gcc.dg/pr46355.c
new file mode 100644 (file)
index 0000000..e644ec5
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-loop-distribution -fstrict-overflow" } */
+
+void
+foo (int *dest, int i, int u, int v)
+{
+  int j = i;
+  while (i)
+    {
+      dest[j--] = v;
+      dest[j--] = u;
+    }
+}
+
index 59585cd..007c4f3 100644 (file)
@@ -1145,7 +1145,12 @@ tree_loop_distribution (void)
 
   FOR_EACH_LOOP (li, loop, 0)
     {
-      VEC (gimple, heap) *work_list = VEC_alloc (gimple, heap, 3);
+      VEC (gimple, heap) *work_list = NULL;
+
+      /* If the loop doesn't have a single exit we will fail anyway,
+        so do that early.  */
+      if (!single_exit (loop))
+       continue;
 
       /* If both flag_tree_loop_distribute_patterns and
         flag_tree_loop_distribution are set, then only