]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/90637 (ICE in vect_loop_versioning, at tree-vect...
authorRichard Biener <rguenther@suse.de>
Wed, 28 Aug 2019 12:12:20 +0000 (12:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 28 Aug 2019 12:12:20 +0000 (12:12 +0000)
2019-08-28  Richard Biener  <rguenther@suse.de>

Backport from mainline
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: r274989

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

index b8f883d5a01bef4a6946e1f1bfe2a41fe3d3f559..e7582f3e08f86620541727096c61f0211a5b373c 100644 (file)
@@ -1,3 +1,12 @@
+2019-08-28  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       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-08-26  Xiong Hu Luo  <luoxhu@linux.ibm.com>
 
        Backport r274411 from trunk to gcc-9-branch.
index bf696ab1730f885370669b61bece3e03a1cf6b82..73a0430b49662ab82fc70e20d3f262ce0419012c 100644 (file)
@@ -1,3 +1,11 @@
+2019-08-28  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2019-05-27  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/90637
+       * gcc.dg/gomp/pr90637.c: New testcase.
+
 2019-08-23  Mihailo Stojanovic  <mistojanovic@wavecomp.com>
 
        * gcc.target/mips/get-fcsr-3.c: 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 fe762f54d96e18c0e8975a2c01062b41b9b9ff60..8a64ab084e5defff9adfd873128e8bccdbc727fd 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;
        }