re PR middle-end/67452 (LTO ICE with -fopenmp-simd)
authorJakub Jelinek <jakub@redhat.com>
Fri, 4 Sep 2015 18:32:00 +0000 (20:32 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 4 Sep 2015 18:32:00 +0000 (20:32 +0200)
PR middle-end/67452
* tree-ssa-live.c: Include cfgloop.h.
(remove_unused_locals): Clear loop->simduid if simduid is about
to be removed from cfun->local_decls.

* gcc.dg/lto/pr67452_0.c: New test.

From-SVN: r227498

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr67452_0.c [new file with mode: 0644]
gcc/tree-ssa-live.c

index 75c5957..43154ea 100644 (file)
@@ -1,3 +1,10 @@
+2015-09-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/67452
+       * tree-ssa-live.c: Include cfgloop.h.
+       (remove_unused_locals): Clear loop->simduid if simduid is about
+       to be removed from cfun->local_decls.
+
 2015-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
        PR target/65210
index 47b8700..fdec965 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/67452
+       * gcc.dg/lto/pr67452_0.c: New test.
+
 2015-09-02  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
 
        PR target/65210
diff --git a/gcc/testsuite/gcc.dg/lto/pr67452_0.c b/gcc/testsuite/gcc.dg/lto/pr67452_0.c
new file mode 100644 (file)
index 0000000..a4984ff
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -O2 -flto -fopenmp-simd } } } */
+
+float b[3][3];
+
+__attribute__((used, noinline)) void
+foo ()
+{
+  int v1, v2;
+#pragma omp simd collapse(2)
+  for (v1 = 0; v1 < 3; v1++)
+    for (v2 = 0; v2 < 3; v2++)
+      b[v1][v2] = 2.5;
+}
+
+int
+main ()
+{
+  asm volatile ("" : : "g" (b) : "memory");
+  foo ();
+  asm volatile ("" : : "g" (b) : "memory");
+  return 0;
+}
index 4772558..e944a9a 100644 (file)
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa.h"
 #include "cgraph.h"
 #include "ipa-utils.h"
+#include "cfgloop.h"
 
 #ifdef ENABLE_CHECKING
 static void  verify_live_on_entry (tree_live_info_p);
@@ -820,6 +821,14 @@ remove_unused_locals (void)
          }
       }
 
+  if (cfun->has_simduid_loops)
+    {
+      struct loop *loop;
+      FOR_EACH_LOOP (loop, 0)
+       if (loop->simduid && !is_used_p (loop->simduid))
+         loop->simduid = NULL_TREE;
+    }
+
   cfun->has_local_explicit_reg_vars = false;
 
   /* Remove unmarked local and global vars from local_decls.  */