re PR tree-optimization/82321 (ICE in check_loop_closed_ssa_use, at tree-ssa-loop...
authorRichard Biener <rguenther@suse.de>
Tue, 26 Sep 2017 11:05:42 +0000 (11:05 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 26 Sep 2017 11:05:42 +0000 (11:05 +0000)
2017-09-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/82321
* graphite.c (canonicalize_loop_closed_ssa): Properly check
for the def being inside the loop.

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

From-SVN: r253199

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

index 87801a43cc3c9db41dd800e4ffad0d79bef9a316..73823fc5e2b0209a42af6eadd97b3bc53e07f122 100644 (file)
@@ -1,3 +1,9 @@
+2017-09-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82321
+       * graphite.c (canonicalize_loop_closed_ssa): Properly check
+       for the def being inside the loop.
+
 2017-09-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * config/s390/vx-builtins.md ("vmslg"): Add missing operand in
index 7e6ba5078ecc3d7d96947a7d8fd347fd00b87ad2..6713df625148ae6c9d1a9e79e53934992679ebad 100644 (file)
@@ -326,7 +326,9 @@ canonicalize_loop_closed_ssa (loop_p loop)
 
          /* Only add close phi nodes for SSA_NAMEs defined in LOOP.  */
          if (TREE_CODE (arg) != SSA_NAME
-             || loop_containing_stmt (SSA_NAME_DEF_STMT (arg)) != loop)
+             || SSA_NAME_IS_DEFAULT_DEF (arg)
+             || ! flow_bb_inside_loop_p (loop,
+                                         gimple_bb (SSA_NAME_DEF_STMT (arg))))
            continue;
 
          tree res = copy_ssa_name (arg);
index 72cf8c3aeef21b93ae4e4e97f698c0937edf8d18..5beffb30ff88ea60471447bf07af54dc6e40fc79 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/82321
+       * gcc.dg/graphite/pr82321.c: New testcase.
+
 2017-09-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
 
        * lib/target-supports.exp: Enable tests for S/390.
diff --git a/gcc/testsuite/gcc.dg/graphite/pr82321.c b/gcc/testsuite/gcc.dg/graphite/pr82321.c
new file mode 100644 (file)
index 0000000..9232147
--- /dev/null
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int y8;
+
+void
+dm (int io)
+{
+  if (y8 != 0)
+    {
+      int pu = 1;
+
+      while (io < 2)
+       {
+         int xo = (pu != 0) ? y8 : 0;
+
+         while (y8 != 0)
+           if (xo != 0)
+             {
+gi:
+               xo = (__INTPTR_TYPE__)&io;
+               pu = 0;
+             }
+       }
+    }
+
+  if (io != 0)
+    {
+      y8 = 1;
+      while (y8 != 0)
+       if (io / !y8 != 0)
+         y8 = 0;
+
+      goto gi;
+    }
+}