re PR tree-optimization/83277 ([graphite] Wrong code w/ -O2 -floop-nest-optimize)
authorRichard Biener <rguenther@suse.de>
Tue, 5 Dec 2017 15:10:23 +0000 (15:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 5 Dec 2017 15:10:23 +0000 (15:10 +0000)
2017-12-05  Richard Biener  <rguenther@suse.de>

PR tree-optimization/83277
* graphite-isl-ast-to-gimple.c (should_copy_to_new_region): Make sure
to code-gen liveout vars.

* gcc.dg/graphite/pr83277.c: New testcase.

From-SVN: r255424

gcc/ChangeLog
gcc/graphite-isl-ast-to-gimple.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr83277.c [new file with mode: 0644]

index 87d2b12c7a71c8022de18b334b5ec33cd1f29e13..cfda6b3c691b8bbfe386af9d85f84f4110507e21 100644 (file)
@@ -1,3 +1,9 @@
+2017-12-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83277
+       * graphite-isl-ast-to-gimple.c (should_copy_to_new_region): Make sure
+       to code-gen liveout vars.
+
 2017-12-05  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * config/aarch64/aarch64-simd.md (aarch64_simd_bsldi_internal)
index c565cf003794b61b82ccc3e22d869d316321bafc..ab7f0e786ba2c89c9d3be7169509a2d3838d8458 100644 (file)
@@ -1137,8 +1137,10 @@ should_copy_to_new_region (gimple *stmt, sese_info_p region)
   if (is_gimple_assign (stmt)
       && (lhs = gimple_assign_lhs (stmt))
       && TREE_CODE (lhs) == SSA_NAME
-      && is_gimple_reg (lhs)
-      && scev_analyzable_p (lhs, region->region))
+      && scev_analyzable_p (lhs, region->region)
+      /* But to code-generate liveouts - liveout PHI generation is
+         in generic sese.c code that cannot do code generation.  */
+      && ! bitmap_bit_p (region->liveout, SSA_NAME_VERSION (lhs)))
     return false;
 
   return true;
index 6a9ce85fee526461f7de05474f2bf6e3ad73f7e7..b4f02a70046c688e43208c40e00be7dcc49b3484 100644 (file)
@@ -1,3 +1,8 @@
+2017-12-05  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83277
+       * gcc.dg/graphite/pr83277.c: New testcase.
+
 2017-12-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/83283
diff --git a/gcc/testsuite/gcc.dg/graphite/pr83277.c b/gcc/testsuite/gcc.dg/graphite/pr83277.c
new file mode 100644 (file)
index 0000000..aef4fee
--- /dev/null
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int rk, si = 0;
+int jr[2];
+
+int
+wv (signed char n8)
+{
+  const int tw = 8;
+  int xq[tw];
+  int bj, pu = 0;
+
+  for (bj = 0; bj < tw; ++bj)
+    xq[bj] = 0;
+
+  bj = 0;
+  while (bj < 1)
+    {
+      int gs = n8 ^ 128;
+
+      if (gs != 0)
+       {
+         int u7[3];
+
+         while (bj < 2)
+           {
+             u7[bj] = 0;
+             ++bj;
+           }
+
+         jr[0] = u7[0];
+         rk = xq[0];
+         pu = n8;
+
+         if (si != 0)
+           return si;
+       }
+    }
+
+  return pu;
+}
+
+int
+main (void)
+{
+  signed char ax = 1;
+
+  if (wv (ax) != ax)
+    __builtin_abort ();
+  return 0;
+}