From d160ae7814db14b36fc7eacc5fc14b77604837a1 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 26 Apr 2018 13:26:25 +0000 Subject: [PATCH] [lto] Fixup loops before lto write-out 2018-04-26 Richard Biener Tom de Vries PR lto/85422 * lto-streamer-out.c (output_function): Fixup loops if required to match discovery done in the reader. * testsuite/libgomp.oacc-c-c++-common/pr85422.c: New test. Co-Authored-By: Tom de Vries From-SVN: r259675 --- gcc/ChangeLog | 7 +++++++ gcc/lto-streamer-out.c | 4 ++++ libgomp/ChangeLog | 6 ++++++ .../testsuite/libgomp.oacc-c-c++-common/pr85422.c | 13 +++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/pr85422.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2fed948fd22..61d92f8fa8e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-04-26 Richard Biener + Tom de Vries + + PR lto/85422 + * lto-streamer-out.c (output_function): Fixup loops if required to match + discovery done in the reader. + 2018-04-26 Richard Biener PR tree-optimization/85116 diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 1d2ab9757f1..70476dc6da8 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2120,6 +2120,9 @@ output_function (struct cgraph_node *node) debug info. */ if (gimple_has_body_p (function)) { + /* Fixup loops if required to match discovery done in the reader. */ + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); + streamer_write_uhwi (ob, 1); output_struct_function_base (ob, fn); @@ -2177,6 +2180,7 @@ output_function (struct cgraph_node *node) output_cfg (ob, fn); + loop_optimizer_finalize (); pop_cfun (); } else diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 4d622d9ff1d..e498a0813e6 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,9 @@ +2018-04-26 Richard Biener + Tom de Vries + + PR lto/85422 + * testsuite/libgomp.oacc-c-c++-common/pr85422.c: New test. + 2018-04-26 Tom de Vries PR target/85519 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85422.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85422.c new file mode 100644 index 00000000000..bcc551d67e5 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85422.c @@ -0,0 +1,13 @@ +/* { dg-do link } */ + +int +main (void) +{ + #pragma acc parallel + #pragma acc loop + for (int i = 1; i < 10; i++) + for (;;) + ; + + return 0; +} -- 2.30.2