re PR tree-optimization/87898 (ICE in separate_decls_in_region_debug, at tree-parloop...
authorJakub Jelinek <jakub@redhat.com>
Wed, 14 Nov 2018 00:02:35 +0000 (01:02 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 14 Nov 2018 00:02:35 +0000 (01:02 +0100)
PR tree-optimization/87898
* omp-simd-clone.c (ipa_simd_modify_stmt_ops): Formatting fix.
(ipa_simd_modify_function_body): Remove debug stmts where the first
argument was changed into a non-decl.

* gcc.dg/gomp/pr87898.c: New test.

From-SVN: r266093

gcc/ChangeLog
gcc/omp-simd-clone.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr87898.c [new file with mode: 0644]

index da5a5382f5677d3a016af8a8c8d6f48a383dbf98..fa13fdd0a718781f33864b9b37c584d1a144d91a 100644 (file)
@@ -1,3 +1,10 @@
+2018-11-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/87898
+       * omp-simd-clone.c (ipa_simd_modify_stmt_ops): Formatting fix.
+       (ipa_simd_modify_function_body): Remove debug stmts where the first
+       argument was changed into a non-decl.
+
 2018-11-13  Peter Bergner  <bergner@linux.ibm.com>
 
        PR rtl-optimization/87899
index 7bafe39b1778c6e7c1af2507f258ac8dec1c614c..7aa362a5e70e1ff151e6c69ebdb14fbaa05ea042 100644 (file)
@@ -834,11 +834,8 @@ ipa_simd_modify_stmt_ops (tree *tp, int *walk_subtrees, void *data)
   struct ipa_parm_adjustment *cand = NULL;
   if (TREE_CODE (*tp) == PARM_DECL)
     cand = ipa_get_adjustment_candidate (&tp, NULL, info->adjustments, true);
-  else
-    {
-      if (TYPE_P (*tp))
-       *walk_subtrees = 0;
-    }
+  else if (TYPE_P (*tp))
+    *walk_subtrees = 0;
 
   tree repl = NULL_TREE;
   if (cand)
@@ -1014,6 +1011,21 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
          if (info.modified)
            {
              update_stmt (stmt);
+             /* If the above changed the var of a debug bind into something
+                different, remove the debug stmt.  We could also for all the
+                replaced parameters add VAR_DECLs for debug info purposes,
+                add debug stmts for those to be the simd array accesses and
+                replace debug stmt var operand with that var.  Debugging of
+                vectorized loops doesn't work too well, so don't bother for
+                now.  */
+             if ((gimple_debug_bind_p (stmt)
+                  && !DECL_P (gimple_debug_bind_get_var (stmt)))
+                 || (gimple_debug_source_bind_p (stmt)
+                     && !DECL_P (gimple_debug_source_bind_get_var (stmt))))
+               {
+                 gsi_remove (&gsi, true);
+                 continue;
+               }
              if (maybe_clean_eh_stmt (stmt))
                gimple_purge_dead_eh_edges (gimple_bb (stmt));
            }
index 9a9cd82dd3e34d28b80e6640189f88612964a24a..be7cf2880caa22539e5f2349a2b613b358aebf5e 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/87898
+       * gcc.dg/gomp/pr87898.c: New test.
+
 2018-11-13  David Malcolm  <dmalcolm@redhat.com>
 
        * g++.dg/plugin/comment_plugin.c: Replace "source_location" with
diff --git a/gcc/testsuite/gcc.dg/gomp/pr87898.c b/gcc/testsuite/gcc.dg/gomp/pr87898.c
new file mode 100644 (file)
index 0000000..ba42c64
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR tree-optimization/87898 */
+/* { dg-do compile { target fgraphite } } */
+/* { dg-options "-O1 -floop-parallelize-all -fopenmp -ftree-parallelize-loops=2 -g" } */
+
+#pragma omp declare simd
+void
+foo (int x)
+{
+  x = 0;
+}