From d6b3654a9ace038ddce90f4c671d5edb4b3479e2 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 27 May 2019 13:18:12 +0000 Subject: [PATCH] re PR tree-optimization/90637 (ICE in vect_loop_versioning, at tree-vect-loop-manip.c:3055) 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. From-SVN: r271661 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/gomp/pr90637.c | 14 ++++++++++++++ gcc/tree-ssa-sink.c | 5 ++++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr90637.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec30909166b..a7a941e238f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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-05-27 Richard Biener PR middle-end/90610 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2884de12cc8..de157051094 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-27 Richard Biener + + PR tree-optimization/90637 + * gcc.dg/gomp/pr90637.c: New testcase. + 2019-05-27 Eric Botcazou * 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 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 77abe3aa4b6..67dc127e3fc 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; } -- 2.30.2