re PR tree-optimization/90637 (ICE in vect_loop_versioning, at tree-vect-loop-manip...
authorRichard Biener <rguenther@suse.de>
Mon, 27 May 2019 13:18:12 +0000 (13:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 27 May 2019 13:18:12 +0000 (13:18 +0000)
2019-05-27  Richard Biener  <rguenther@suse.de>

PR tree-optimization/90637
* tree-ssa-sink.c (statement_sink_location): Honor the
computed sink location for single-uses.

* gcc.dg/gomp/pr90637.c: New testcase.

From-SVN: r271661

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr90637.c [new file with mode: 0644]
gcc/tree-ssa-sink.c

index ec30909166ba58b471e9d2f60759eb23a1fc5b0c..a7a941e238f3545c7f80c08dc7efa54b06674039 100644 (file)
@@ -1,3 +1,9 @@
+2019-05-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90637
+       * tree-ssa-sink.c (statement_sink_location): Honor the
+       computed sink location for single-uses.
+
 2019-05-27  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/90610
index 2884de12cc855f79d005877e8dd6e0206f3dc666..de1570510946d0a53de90743eac29182defd8534 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90637
+       * gcc.dg/gomp/pr90637.c: New testcase.
+
 2019-05-27  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/expect2.adb: New test.
diff --git a/gcc/testsuite/gcc.dg/gomp/pr90637.c b/gcc/testsuite/gcc.dg/gomp/pr90637.c
new file mode 100644 (file)
index 0000000..983e03e
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR tree-optimization/90637 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -O1 --param sink-frequency-threshold=90" } */
+
+int v;
+
+void
+foo (int c)
+{
+  int i;
+#pragma omp for simd if (c) lastprivate (v) schedule (static, 16)
+  for (i = 0; i < 64; ++i)
+    v = i;
+}
index 77abe3aa4b649e763cb05aee368fa249cf0368b8..67dc127e3fcea271b761821b90d620c1fe42b3ff 100644 (file)
@@ -439,7 +439,10 @@ statement_sink_location (gimple *stmt, basic_block frombb,
          if (sinkbb == frombb)
            return false;
 
-         *togsi = gsi_for_stmt (use);
+         if (sinkbb == gimple_bb (use))
+           *togsi = gsi_for_stmt (use);
+         else
+           *togsi = gsi_after_labels (sinkbb);
 
          return true;
        }