From 0ce17020fdd73b2590c7f08e8ed381f5ddf6a801 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 28 Aug 2019 12:12:20 +0000 Subject: 2019-08-28 Richard Biener Backport from mainline 2019-05-27 Richard Biener 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@274989 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 8 ++++++++ gcc/testsuite/gcc.dg/gomp/pr90637.c | 14 ++++++++++++++ gcc/tree-ssa-sink.c | 5 ++++- 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr90637.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8f883d5a01..e7582f3e08f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-08-28 Richard Biener + + Backport from mainline + 2019-05-27 Richard Biener + + 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 Backport r274411 from trunk to gcc-9-branch. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf696ab1730..73a0430b496 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-08-28 Richard Biener + + Backport from mainline + 2019-05-27 Richard Biener + + PR tree-optimization/90637 + * gcc.dg/gomp/pr90637.c: New testcase. + 2019-08-23 Mihailo Stojanovic * 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 index 00000000000..983e03e7574 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr90637.c @@ -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; +} diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c index fe762f54d96..8a64ab084e5 100644 --- a/gcc/tree-ssa-sink.c +++ b/gcc/tree-ssa-sink.c @@ -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; } -- cgit v1.2.3