]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/39132 (wrong code generated with -ftree-loop-disttribution)
authorRichard Guenther <rguenther@suse.de>
Tue, 10 Feb 2009 14:54:13 +0000 (14:54 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 10 Feb 2009 14:54:13 +0000 (14:54 +0000)
2009-02-10  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/39132
* tree-loop-distribution.c (todo): New global var.
(generate_memset_zero): Trigger TODO_rebuild_alias.
(tree_loop_distribution): Return todo.

* gcc.dg/torture/pr39132.c: New testcase.

From-SVN: r144060

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

index d18f8cc1c22eba507b1f2f3a6843e21b8d3a7888..d29668a7ff4e1367170867dbfc49c95e8cf82994 100644 (file)
@@ -1,3 +1,10 @@
+2009-02-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39132
+       * tree-loop-distribution.c (todo): New global var.
+       (generate_memset_zero): Trigger TODO_rebuild_alias.
+       (tree_loop_distribution): Return todo.
+
 2009-02-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/39119
index 15a7facc31ff4ca889a3921e2e5239dd28acf4db..02a65b9335ea145d9116c8274899488679736a12 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-10  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/39132
+       * gcc.dg/torture/pr39132.c: New testcase.
+
 2009-02-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/39119
diff --git a/gcc/testsuite/gcc.dg/torture/pr39132.c b/gcc/testsuite/gcc.dg/torture/pr39132.c
new file mode 100644 (file)
index 0000000..f6e2907
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do run } */
+/* { dg-options "-ftree-loop-distribution" } */
+
+extern void abort(void);
+
+struct epic_private
+{
+  unsigned int *rx_ring;
+  unsigned int rx_skbuff[5];
+};
+
+int
+main (void)
+{
+  struct epic_private ep;
+  unsigned int rx_ring[5];
+  int i;
+
+  ep.rx_skbuff[0] = 5;
+
+  ep.rx_ring = rx_ring;
+
+  for (i = 0; i < 5; i++)
+    {
+      ep.rx_ring[i] = i;
+      ep.rx_skbuff[i] = 0;
+    }
+
+  if (ep.rx_skbuff[0] != 0)
+    abort ();
+
+  return 0;
+}
+
index 8eca7c021666bb3e6b70f6636e7a3183e0d3ac63..080eceacb55b679281609d76b1455bd6f3c913f5 100644 (file)
@@ -77,6 +77,9 @@ static bitmap remaining_stmts;
    predecessor a node that writes to memory.  */
 static bitmap upstream_mem_writes;
 
+/* TODOs we need to run after the pass.  */
+static unsigned int todo;
+
 /* Update the PHI nodes of NEW_LOOP.  NEW_LOOP is a duplicate of
    ORIG_LOOP.  */
 
@@ -331,6 +334,8 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "generated memset zero\n");
 
+  todo |= TODO_rebuild_alias;
+
  end:
   free_data_ref (dr);
   return res;
@@ -1206,6 +1211,8 @@ tree_loop_distribution (void)
   loop_iterator li;
   int nb_generated_loops = 0;
 
+  todo = 0;
+
   FOR_EACH_LOOP (li, loop, 0)
     {
       VEC (gimple, heap) *work_list = VEC_alloc (gimple, heap, 3);
@@ -1237,7 +1244,7 @@ tree_loop_distribution (void)
       VEC_free (gimple, heap, work_list);
     }
 
-  return 0;
+  return todo;
 }
 
 static bool