* [PATCH] Fix PR90637
@ 2019-05-27 10:49 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2019-05-27 10:49 UTC (permalink / raw)
To: gcc-patches
The following fixes GIMPLE stmt sinking to not sink a stmt into a loop.
It actually chooses the correct basic-block to sink to but just
ignores that when computing the stmt iterator to sink to...
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
Richard.
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.
Index: gcc/tree-ssa-sink.c
===================================================================
--- gcc/tree-ssa-sink.c (revision 271644)
+++ gcc/tree-ssa-sink.c (working copy)
@@ -439,7 +439,10 @@ statement_sink_location (gimple *stmt, b
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;
}
Index: gcc/testsuite/gcc.dg/gomp/pr90637.c
===================================================================
--- gcc/testsuite/gcc.dg/gomp/pr90637.c (nonexistent)
+++ gcc/testsuite/gcc.dg/gomp/pr90637.c (working copy)
@@ -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;
+}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-27 10:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 10:49 [PATCH] Fix PR90637 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).