* [PATCH] Handle empty infinite loops in OpenACC for PR84955 @ 2018-04-06 13:49 Cesar Philippidis 2018-04-06 15:35 ` Jakub Jelinek 0 siblings, 1 reply; 12+ messages in thread From: Cesar Philippidis @ 2018-04-06 13:49 UTC (permalink / raw) To: gcc-patches [-- Attachment #1: Type: text/plain, Size: 1775 bytes --] As shown in PR84955, GCC has problems empty infinite loops of the form #pragma acc loop tile (2, 2) for (...) for (...) { for (...) /* do nothing */ ; } I also observed that it generates bad code for the following loop #pragma acc loop for (...) { for (...) /* do nothing */ ; } There are two problems here. First, for the tiled loop, as expand_oacc_for splits the first basic block of the loop body to add a branch to perform the tiling control logic, it does not consider fact that the body may not have an exit when it contains an infinite loop. This situation can occur when region->cont is NULL. The fix here was to add a dummy false edge to exit_bb. The second problem involves fixing up the CFG. Unlike OpenMP which defers a lot of the scheduling control to libgomp, OpenACC makes heavy use of calls to internal functions. The problem here is that the fixup_cfg pass was largely ignoring calls to internal functions when it decides to set PROP_cleanup_cfg. When the CFG isn't cleaned up, the LTO streamer will report that there are fewer loops than there actually are and that causes an ICE because the empty infinite loop is never accounted for. This patch resolves this issue by relaxing the fixup_cfg pass to treat all functions calls, including those to internal functions, the same. An alternative approach to resolve this issue would have been to teach ipa_write_summaries to check if the loop structure needs to be fixed up and call cleanup_cfg as necessary. But I wanted to keep the OMP and OACC code paths similar, so I took the former approach. I regression tested this patch on x86_64-linux using nvptx offloading. Is this patch OK for trunk and GCC 7 (and probably GCC 6). Thanks, Cesar [-- Attachment #2: trunk-pr84955.diff --] [-- Type: text/x-patch, Size: 3218 bytes --] Fix PR84955 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> PR middle-end/84955 gcc/ * cfgloop.c (flow_loops_find): Add assert. * omp-expand.c (expand_oacc_for): Add dummy false branch for tiled basic blocks without omp continue statements. * tree-cfg.c (execute_fixup_cfg): Handle calls to internal functions like regular functions. libgomp/ * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 8af793c6015..6e68639452c 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -462,6 +462,9 @@ flow_loops_find (struct loops *loops) { struct loop *loop; + if (!from_scratch) + gcc_assert (header->loop_father != NULL); + /* The current active loop tree has valid loop-fathers for header blocks. */ if (!from_scratch diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index bb204906ea6..1c7b68fbd8c 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -5439,6 +5439,13 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; + /* Add a dummy exit for the tiled block when cont_bb is missing. */ + if (cont_bb == NULL) + { + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); + e->probability = profile_probability::even (); + } + /* Initialize the user's loop vars. */ gsi = gsi_start_bb (elem_body_bb); expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9485f73f341..cb676d78128 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) { gimple *stmt = gsi_stmt (gsi); - tree decl = is_gimple_call (stmt) - ? gimple_call_fndecl (stmt) - : NULL; - if (decl) + if (is_gimple_call (stmt)) { int flags = gimple_call_flags (stmt); if (flags & (ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c new file mode 100644 index 00000000000..5910b57b68d --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int +main () +{ + int i, j; + +#pragma acc parallel loop tile(2,3) + for (i = 1; i < 10; i++) + for (j = 1; j < 10; j++) + for (;;) + ; + +#pragma acc parallel loop + for (i = 1; i < 10; i++) + for (;;) + ; + + return i + j; +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 new file mode 100644 index 00000000000..878d8a89f41 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } + +subroutine s + integer :: i, j + !$acc parallel loop tile(2,3) + do i = 1, 10 + do j = 1, 10 + do + end do + end do + end do + !$acc end parallel loop + + !$acc parallel loop + do i = 1, 10 + do + end do + end do + !$acc end parallel loop +end subroutine s ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-06 13:49 [PATCH] Handle empty infinite loops in OpenACC for PR84955 Cesar Philippidis @ 2018-04-06 15:35 ` Jakub Jelinek 2018-04-09 11:32 ` Richard Biener 0 siblings, 1 reply; 12+ messages in thread From: Jakub Jelinek @ 2018-04-06 15:35 UTC (permalink / raw) To: Cesar Philippidis, Richard Biener; +Cc: gcc-patches On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: > 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> > > PR middle-end/84955 > > gcc/ > * cfgloop.c (flow_loops_find): Add assert. > * omp-expand.c (expand_oacc_for): Add dummy false branch for > tiled basic blocks without omp continue statements. > * tree-cfg.c (execute_fixup_cfg): Handle calls to internal > functions like regular functions. > > libgomp/ > * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. > * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to mention that: > --- a/gcc/tree-cfg.c > +++ b/gcc/tree-cfg.c > @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) > for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) > { > gimple *stmt = gsi_stmt (gsi); > - tree decl = is_gimple_call (stmt) > - ? gimple_call_fndecl (stmt) > - : NULL; > - if (decl) > + if (is_gimple_call (stmt)) This change doesn't affect just internal functions, but also all indirect calls through function pointers with const, pure or noreturn attributes. > --- a/gcc/omp-expand.c > +++ b/gcc/omp-expand.c > @@ -5439,6 +5439,13 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) > > split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; > > + /* Add a dummy exit for the tiled block when cont_bb is missing. */ > + if (cont_bb == NULL) > + { > + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); > + e->probability = profile_probability::even (); > + } I miss here updating of split->probability, if you make e even (the other edge needs to have probability of 100%-the probability, i.e. even as well. Jakub ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-06 15:35 ` Jakub Jelinek @ 2018-04-09 11:32 ` Richard Biener 2018-04-11 19:31 ` Cesar Philippidis 0 siblings, 1 reply; 12+ messages in thread From: Richard Biener @ 2018-04-09 11:32 UTC (permalink / raw) To: Jakub Jelinek; +Cc: Cesar Philippidis, gcc-patches On Fri, 6 Apr 2018, Jakub Jelinek wrote: > On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: > > 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> > > > > PR middle-end/84955 > > > > gcc/ > > * cfgloop.c (flow_loops_find): Add assert. > > * omp-expand.c (expand_oacc_for): Add dummy false branch for > > tiled basic blocks without omp continue statements. > > * tree-cfg.c (execute_fixup_cfg): Handle calls to internal > > functions like regular functions. > > > > libgomp/ > > * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. > > * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. > > I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to > mention that: > > > --- a/gcc/tree-cfg.c > > +++ b/gcc/tree-cfg.c > > @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) > > for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) > > { > > gimple *stmt = gsi_stmt (gsi); > > - tree decl = is_gimple_call (stmt) > > - ? gimple_call_fndecl (stmt) > > - : NULL; > > - if (decl) > > + if (is_gimple_call (stmt)) > > This change doesn't affect just internal functions, but also all indirect > calls through function pointers with const, pure or noreturn attributes. I think the change is desirable nevertheless. The question is if we want to do it at this point in time. The description of the problem sounds more like LTO writing writing out loops without previously fixing up state. So sth like the following which I'd prefer at this stage (the above hunk is ok for stage1 then). Index: gcc/lto-streamer-out.c =================================================================== --- gcc/lto-streamer-out.c (revision 259227) +++ gcc/lto-streamer-out.c (working copy) @@ -2084,6 +2151,9 @@ output_function (struct cgraph_node *nod /* Set current_function_decl and cfun. */ push_cfun (fn); + /* Fixup loops if required to match discovery done in the reader. */ + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); + /* Make string 0 be a NULL string. */ streamer_write_char_stream (ob->string_stream, 0); @@ -2176,12 +2246,13 @@ output_function (struct cgraph_node *nod streamer_write_record_start (ob, LTO_null); output_cfg (ob, fn); - - pop_cfun (); } else streamer_write_uhwi (ob, 0); + loop_optimizer_finalize (); + pop_cfun (); + /* Create a section to hold the pickled output of this function. */ produce_asm (ob, function); > > --- a/gcc/omp-expand.c > > +++ b/gcc/omp-expand.c > > @@ -5439,6 +5439,13 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) > > > > split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; > > > > + /* Add a dummy exit for the tiled block when cont_bb is missing. */ > > + if (cont_bb == NULL) > > + { > > + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); > > + e->probability = profile_probability::even (); > > + } > > I miss here updating of split->probability, if you make e even (the other edge > needs to have probability of 100%-the probability, i.e. even as well. > > Jakub > > -- Richard Biener <rguenther@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-09 11:32 ` Richard Biener @ 2018-04-11 19:31 ` Cesar Philippidis 2018-04-12 8:02 ` Richard Biener 2018-04-12 18:27 ` H.J. Lu 0 siblings, 2 replies; 12+ messages in thread From: Cesar Philippidis @ 2018-04-11 19:31 UTC (permalink / raw) To: Richard Biener, Jakub Jelinek; +Cc: gcc-patches [-- Attachment #1: Type: text/plain, Size: 2749 bytes --] On 04/09/2018 04:31 AM, Richard Biener wrote: > On Fri, 6 Apr 2018, Jakub Jelinek wrote: > >> On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: >>> 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> >>> >>> PR middle-end/84955 >>> >>> gcc/ >>> * cfgloop.c (flow_loops_find): Add assert. >>> * omp-expand.c (expand_oacc_for): Add dummy false branch for >>> tiled basic blocks without omp continue statements. >>> * tree-cfg.c (execute_fixup_cfg): Handle calls to internal >>> functions like regular functions. >>> >>> libgomp/ >>> * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. >>> * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. >> >> I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to >> mention that: >> >>> --- a/gcc/tree-cfg.c >>> +++ b/gcc/tree-cfg.c >>> @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) >>> for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) >>> { >>> gimple *stmt = gsi_stmt (gsi); >>> - tree decl = is_gimple_call (stmt) >>> - ? gimple_call_fndecl (stmt) >>> - : NULL; >>> - if (decl) >>> + if (is_gimple_call (stmt)) >> >> This change doesn't affect just internal functions, but also all indirect >> calls through function pointers with const, pure or noreturn attributes. > > I think the change is desirable nevertheless. The question is if we > want to do it at this point in time. > > The description of the problem sounds more like LTO writing writing out > loops without previously fixing up state. So sth like the following > which I'd prefer at this stage (the above hunk is ok for stage1 then). OK, I'll save that hunk for stage 1. > Index: gcc/lto-streamer-out.c > =================================================================== > --- gcc/lto-streamer-out.c (revision 259227) > +++ gcc/lto-streamer-out.c (working copy) > @@ -2084,6 +2151,9 @@ output_function (struct cgraph_node *nod > /* Set current_function_decl and cfun. */ > push_cfun (fn); > > + /* Fixup loops if required to match discovery done in the reader. */ > + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); > + > /* Make string 0 be a NULL string. */ > streamer_write_char_stream (ob->string_stream, 0); > > @@ -2176,12 +2246,13 @@ output_function (struct cgraph_node *nod > streamer_write_record_start (ob, LTO_null); > > output_cfg (ob, fn); > - > - pop_cfun (); > } > else > streamer_write_uhwi (ob, 0); > > + loop_optimizer_finalize (); > + pop_cfun (); > + > /* Create a section to hold the pickled output of this function. */ > produce_asm (ob, function); That worked. Is this patch OK for trunk, GCC 6 and GCC 7? Thanks, Cesar [-- Attachment #2: trunk-pr84955.diff --] [-- Type: text/x-patch, Size: 3615 bytes --] 2018-04-11 Cesar Philippidis <cesar@codesourcery.com> Richard Biener <rguenther@suse.de> PR middle-end/84955 gcc/ * cfgloop.c (flow_loops_find): Add assert. * lto-streamer-out.c (output_function): Fix CFG loop state before streaming out. * omp-expand.c (expand_oacc_for): Handle calls to internal functions like regular functions. libgomp/ * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index 8af793c6015..6e68639452c 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -462,6 +462,9 @@ flow_loops_find (struct loops *loops) { struct loop *loop; + if (!from_scratch) + gcc_assert (header->loop_father != NULL); + /* The current active loop tree has valid loop-fathers for header blocks. */ if (!from_scratch diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 1d2ab9757f1..fd6788a69b0 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -2084,6 +2084,9 @@ output_function (struct cgraph_node *node) /* Set current_function_decl and cfun. */ push_cfun (fn); + /* Fixup loops if required to match discovery done in the reader. */ + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); + /* Make string 0 be a NULL string. */ streamer_write_char_stream (ob->string_stream, 0); @@ -2176,12 +2179,13 @@ output_function (struct cgraph_node *node) streamer_write_record_start (ob, LTO_null); output_cfg (ob, fn); - - pop_cfun (); } else streamer_write_uhwi (ob, 0); + loop_optimizer_finalize (); + pop_cfun (); + /* Create a section to hold the pickled output of this function. */ produce_asm (ob, function); diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index bb204906ea6..c7d30ea3964 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -5439,6 +5439,14 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; + /* Add a dummy exit for the tiled block when cont_bb is missing. */ + if (cont_bb == NULL) + { + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); + e->probability = profile_probability::even (); + split->probability = profile_probability::even (); + } + /* Initialize the user's loop vars. */ gsi = gsi_start_bb (elem_body_bb); expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c new file mode 100644 index 00000000000..5910b57b68d --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +int +main () +{ + int i, j; + +#pragma acc parallel loop tile(2,3) + for (i = 1; i < 10; i++) + for (j = 1; j < 10; j++) + for (;;) + ; + +#pragma acc parallel loop + for (i = 1; i < 10; i++) + for (;;) + ; + + return i + j; +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 new file mode 100644 index 00000000000..878d8a89f41 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } + +subroutine s + integer :: i, j + !$acc parallel loop tile(2,3) + do i = 1, 10 + do j = 1, 10 + do + end do + end do + end do + !$acc end parallel loop + + !$acc parallel loop + do i = 1, 10 + do + end do + end do + !$acc end parallel loop +end subroutine s ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-11 19:31 ` Cesar Philippidis @ 2018-04-12 8:02 ` Richard Biener 2018-04-12 18:27 ` H.J. Lu 1 sibling, 0 replies; 12+ messages in thread From: Richard Biener @ 2018-04-12 8:02 UTC (permalink / raw) To: Cesar Philippidis; +Cc: Richard Biener, Jakub Jelinek, gcc-patches On Wed, Apr 11, 2018 at 9:30 PM, Cesar Philippidis <cesar@codesourcery.com> wrote: > On 04/09/2018 04:31 AM, Richard Biener wrote: >> On Fri, 6 Apr 2018, Jakub Jelinek wrote: >> >>> On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: >>>> 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> >>>> >>>> PR middle-end/84955 >>>> >>>> gcc/ >>>> * cfgloop.c (flow_loops_find): Add assert. >>>> * omp-expand.c (expand_oacc_for): Add dummy false branch for >>>> tiled basic blocks without omp continue statements. >>>> * tree-cfg.c (execute_fixup_cfg): Handle calls to internal >>>> functions like regular functions. >>>> >>>> libgomp/ >>>> * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. >>>> * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. >>> >>> I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to >>> mention that: >>> >>>> --- a/gcc/tree-cfg.c >>>> +++ b/gcc/tree-cfg.c >>>> @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) >>>> for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) >>>> { >>>> gimple *stmt = gsi_stmt (gsi); >>>> - tree decl = is_gimple_call (stmt) >>>> - ? gimple_call_fndecl (stmt) >>>> - : NULL; >>>> - if (decl) >>>> + if (is_gimple_call (stmt)) >>> >>> This change doesn't affect just internal functions, but also all indirect >>> calls through function pointers with const, pure or noreturn attributes. >> >> I think the change is desirable nevertheless. The question is if we >> want to do it at this point in time. >> >> The description of the problem sounds more like LTO writing writing out >> loops without previously fixing up state. So sth like the following >> which I'd prefer at this stage (the above hunk is ok for stage1 then). > > OK, I'll save that hunk for stage 1. > >> Index: gcc/lto-streamer-out.c >> =================================================================== >> --- gcc/lto-streamer-out.c (revision 259227) >> +++ gcc/lto-streamer-out.c (working copy) >> @@ -2084,6 +2151,9 @@ output_function (struct cgraph_node *nod >> /* Set current_function_decl and cfun. */ >> push_cfun (fn); >> >> + /* Fixup loops if required to match discovery done in the reader. */ >> + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); >> + >> /* Make string 0 be a NULL string. */ >> streamer_write_char_stream (ob->string_stream, 0); >> >> @@ -2176,12 +2246,13 @@ output_function (struct cgraph_node *nod >> streamer_write_record_start (ob, LTO_null); >> >> output_cfg (ob, fn); >> - >> - pop_cfun (); >> } >> else >> streamer_write_uhwi (ob, 0); >> >> + loop_optimizer_finalize (); >> + pop_cfun (); >> + >> /* Create a section to hold the pickled output of this function. */ >> produce_asm (ob, function); > > That worked. Is this patch OK for trunk, GCC 6 and GCC 7? Ok if you remove the cfgloop.c hunk. There's no point in an assert of sth being non-NULL when the immediately following stmt will dereference it. You get an ICE anyway. Thanks, Richard. > Thanks, > Cesar > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-11 19:31 ` Cesar Philippidis 2018-04-12 8:02 ` Richard Biener @ 2018-04-12 18:27 ` H.J. Lu 2018-04-12 18:39 ` Cesar Philippidis 1 sibling, 1 reply; 12+ messages in thread From: H.J. Lu @ 2018-04-12 18:27 UTC (permalink / raw) To: Cesar Philippidis; +Cc: Richard Biener, Jakub Jelinek, gcc-patches On Wed, Apr 11, 2018 at 12:30 PM, Cesar Philippidis <cesar@codesourcery.com> wrote: > On 04/09/2018 04:31 AM, Richard Biener wrote: >> On Fri, 6 Apr 2018, Jakub Jelinek wrote: >> >>> On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: >>>> 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> >>>> >>>> PR middle-end/84955 >>>> >>>> gcc/ >>>> * cfgloop.c (flow_loops_find): Add assert. >>>> * omp-expand.c (expand_oacc_for): Add dummy false branch for >>>> tiled basic blocks without omp continue statements. >>>> * tree-cfg.c (execute_fixup_cfg): Handle calls to internal >>>> functions like regular functions. >>>> >>>> libgomp/ >>>> * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. >>>> * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. >>> >>> I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to >>> mention that: >>> >>>> --- a/gcc/tree-cfg.c >>>> +++ b/gcc/tree-cfg.c >>>> @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) >>>> for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) >>>> { >>>> gimple *stmt = gsi_stmt (gsi); >>>> - tree decl = is_gimple_call (stmt) >>>> - ? gimple_call_fndecl (stmt) >>>> - : NULL; >>>> - if (decl) >>>> + if (is_gimple_call (stmt)) >>> >>> This change doesn't affect just internal functions, but also all indirect >>> calls through function pointers with const, pure or noreturn attributes. >> >> I think the change is desirable nevertheless. The question is if we >> want to do it at this point in time. >> >> The description of the problem sounds more like LTO writing writing out >> loops without previously fixing up state. So sth like the following >> which I'd prefer at this stage (the above hunk is ok for stage1 then). > > OK, I'll save that hunk for stage 1. > >> Index: gcc/lto-streamer-out.c >> =================================================================== >> --- gcc/lto-streamer-out.c (revision 259227) >> +++ gcc/lto-streamer-out.c (working copy) >> @@ -2084,6 +2151,9 @@ output_function (struct cgraph_node *nod >> /* Set current_function_decl and cfun. */ >> push_cfun (fn); >> >> + /* Fixup loops if required to match discovery done in the reader. */ >> + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); >> + >> /* Make string 0 be a NULL string. */ >> streamer_write_char_stream (ob->string_stream, 0); >> >> @@ -2176,12 +2246,13 @@ output_function (struct cgraph_node *nod >> streamer_write_record_start (ob, LTO_null); >> >> output_cfg (ob, fn); >> - >> - pop_cfun (); >> } >> else >> streamer_write_uhwi (ob, 0); >> >> + loop_optimizer_finalize (); >> + pop_cfun (); >> + >> /* Create a section to hold the pickled output of this function. */ >> produce_asm (ob, function); > > That worked. Is this patch OK for trunk, GCC 6 and GCC 7? This caused: https://gcc.gnu.org/ml/gcc-regression/2018-04/msg00099.html FAIL: g++.dg/ipa/pr46984.C -std=gnu++11 (internal compiler error) FAIL: g++.dg/ipa/pr46984.C -std=gnu++11 (test for excess errors) FAIL: g++.dg/ipa/pr46984.C -std=gnu++14 (internal compiler error) FAIL: g++.dg/ipa/pr46984.C -std=gnu++14 (test for excess errors) FAIL: g++.dg/ipa/pr46984.C -std=gnu++98 (internal compiler error) FAIL: g++.dg/ipa/pr46984.C -std=gnu++98 (test for excess errors) FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O0 -flto -flto-partition=none -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O2 -flto -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O0 -flto -flto-partition=none -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O2 -flto -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20081219 cp_lto_20081219_0.o assemble, -fPIC -flto -flto-partition=1to1 -O2 (internal compiler error) FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O0 -flto -flto-partition=none -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O2 -flto -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O2 -flto -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/pr60567 cp_lto_pr60567_0.o assemble, -flto -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/pr64076 cp_lto_pr64076_0.o assemble, -O0 -flto -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) FAIL: g++.dg/lto/pr64076 cp_lto_pr64076_0.o assemble, -O0 -flto -flto-partition=none -fuse-linker-plugin (internal compiler error) FAIL: g++.dg/lto/pr64076 cp_lto_pr64076_0.o assemble, -O0 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/lto/pr69133 cp_lto_pr69133_1.o assemble, -flto -O2 (internal compiler error) FAIL: g++.dg/lto/pr69729 cp_lto_pr69729_0.o assemble, -fcheck-pointer-bounds -mmpx -flto -flto-partition=max (internal compiler error) FAIL: g++.dg/lto/pr82027 cp_lto_pr82027_0.o assemble, -O3 -flto (internal compiler error) FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr41257.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr41257.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr41257.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr41257.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr43068.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr43068.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr43068.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr43068.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr45699.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr45699.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr45699.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr45699.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr46287.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr46287.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr46287.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr46287.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr48661.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr48661.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr48661.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr48661.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O0 (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O0 (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O1 (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O1 (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O2 (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O2 (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess errors) FAIL: g++.dg/torture/pr48954.C -O3 -g (internal compiler error) FAIL: g++.dg/torture/pr48954.C -O3 -g (test for excess errors) FAIL: g++.dg/torture/pr48954.C -Os (internal compiler error) FAIL: g++.dg/torture/pr48954.C -Os (test for excess errors) FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr58252.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr58252.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr58252.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr58252.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr58585.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr58585.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr58585.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr58585.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr59226.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr59226.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr59226.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr59226.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr60871.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr60871.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr60871.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr60871.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr64988.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr64988.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr64988.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr64988.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr68184.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr68184.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr68184.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr68184.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr71571.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr71571.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr71571.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr71571.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr78692.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr78692.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr78692.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr78692.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr81812.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr81812.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr81812.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr81812.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/torture/pr83619.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/torture/pr83619.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/torture/pr83619.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/torture/pr83619.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (internal compiler error) FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fno-use-linker-plugin -flto-partition=none (test for excess errors) FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects (test for excess errors) on Linux/x86 -- H.J. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-12 18:27 ` H.J. Lu @ 2018-04-12 18:39 ` Cesar Philippidis 2018-04-12 20:35 ` Jakub Jelinek 0 siblings, 1 reply; 12+ messages in thread From: Cesar Philippidis @ 2018-04-12 18:39 UTC (permalink / raw) To: H.J. Lu; +Cc: Richard Biener, Jakub Jelinek, gcc-patches On 04/12/2018 11:27 AM, H.J. Lu wrote: > On Wed, Apr 11, 2018 at 12:30 PM, Cesar Philippidis > <cesar@codesourcery.com> wrote: >> On 04/09/2018 04:31 AM, Richard Biener wrote: >>> On Fri, 6 Apr 2018, Jakub Jelinek wrote: >>> >>>> On Fri, Apr 06, 2018 at 06:48:52AM -0700, Cesar Philippidis wrote: >>>>> 2018-04-06 Cesar Philippidis <cesar@codesourcery.com> >>>>> >>>>> PR middle-end/84955 >>>>> >>>>> gcc/ >>>>> * cfgloop.c (flow_loops_find): Add assert. >>>>> * omp-expand.c (expand_oacc_for): Add dummy false branch for >>>>> tiled basic blocks without omp continue statements. >>>>> * tree-cfg.c (execute_fixup_cfg): Handle calls to internal >>>>> functions like regular functions. >>>>> >>>>> libgomp/ >>>>> * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. >>>>> * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. >>>> >>>> I'd like to defer the cfgloop.c and tree-cfg.c changes to Richard, just want to >>>> mention that: >>>> >>>>> --- a/gcc/tree-cfg.c >>>>> +++ b/gcc/tree-cfg.c >>>>> @@ -9586,10 +9586,7 @@ execute_fixup_cfg (void) >>>>> for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) >>>>> { >>>>> gimple *stmt = gsi_stmt (gsi); >>>>> - tree decl = is_gimple_call (stmt) >>>>> - ? gimple_call_fndecl (stmt) >>>>> - : NULL; >>>>> - if (decl) >>>>> + if (is_gimple_call (stmt)) >>>> >>>> This change doesn't affect just internal functions, but also all indirect >>>> calls through function pointers with const, pure or noreturn attributes. >>> >>> I think the change is desirable nevertheless. The question is if we >>> want to do it at this point in time. >>> >>> The description of the problem sounds more like LTO writing writing out >>> loops without previously fixing up state. So sth like the following >>> which I'd prefer at this stage (the above hunk is ok for stage1 then). >> >> OK, I'll save that hunk for stage 1. >> >>> Index: gcc/lto-streamer-out.c >>> =================================================================== >>> --- gcc/lto-streamer-out.c (revision 259227) >>> +++ gcc/lto-streamer-out.c (working copy) >>> @@ -2084,6 +2151,9 @@ output_function (struct cgraph_node *nod >>> /* Set current_function_decl and cfun. */ >>> push_cfun (fn); >>> >>> + /* Fixup loops if required to match discovery done in the reader. */ >>> + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); >>> + >>> /* Make string 0 be a NULL string. */ >>> streamer_write_char_stream (ob->string_stream, 0); >>> >>> @@ -2176,12 +2246,13 @@ output_function (struct cgraph_node *nod >>> streamer_write_record_start (ob, LTO_null); >>> >>> output_cfg (ob, fn); >>> - >>> - pop_cfun (); >>> } >>> else >>> streamer_write_uhwi (ob, 0); >>> >>> + loop_optimizer_finalize (); >>> + pop_cfun (); >>> + >>> /* Create a section to hold the pickled output of this function. */ >>> produce_asm (ob, function); >> >> That worked. Is this patch OK for trunk, GCC 6 and GCC 7? > > This caused: > > https://gcc.gnu.org/ml/gcc-regression/2018-04/msg00099.html > > FAIL: g++.dg/ipa/pr46984.C -std=gnu++11 (internal compiler error) > FAIL: g++.dg/ipa/pr46984.C -std=gnu++11 (test for excess errors) > FAIL: g++.dg/ipa/pr46984.C -std=gnu++14 (internal compiler error) > FAIL: g++.dg/ipa/pr46984.C -std=gnu++14 (test for excess errors) > FAIL: g++.dg/ipa/pr46984.C -std=gnu++98 (internal compiler error) > FAIL: g++.dg/ipa/pr46984.C -std=gnu++98 (test for excess errors) > FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O0 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O0 -flto > -flto-partition=none -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O0 -flto > -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O2 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O2 -flto > -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects > (internal compiler error) > FAIL: g++.dg/lto/20081217-1 cp_lto_20081217-1_0.o assemble, -O2 -flto > -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O0 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O0 -flto > -flto-partition=none -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O0 -flto > -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O2 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O2 -flto > -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects > (internal compiler error) > FAIL: g++.dg/lto/20081217-2 cp_lto_20081217-2_0.o assemble, -O2 -flto > -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20081219 cp_lto_20081219_0.o assemble, -fPIC -flto > -flto-partition=1to1 -O2 (internal compiler error) > FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O0 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O0 -flto > -flto-partition=none -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O0 -flto > -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O2 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O2 -flto > -flto-partition=none -fuse-linker-plugin -fno-fat-lto-objects > (internal compiler error) > FAIL: g++.dg/lto/20091210-1 cp_lto_20091210-1_0.o assemble, -O2 -flto > -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/pr60567 cp_lto_pr60567_0.o assemble, -flto > -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/pr64076 cp_lto_pr64076_0.o assemble, -O0 -flto > -flto-partition=1to1 -fno-use-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/pr64076 cp_lto_pr64076_0.o assemble, -O0 -flto > -flto-partition=none -fuse-linker-plugin (internal compiler error) > FAIL: g++.dg/lto/pr64076 cp_lto_pr64076_0.o assemble, -O0 -flto > -fuse-linker-plugin -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/lto/pr69133 cp_lto_pr69133_1.o assemble, -flto -O2 > (internal compiler error) > FAIL: g++.dg/lto/pr69729 cp_lto_pr69729_0.o assemble, > -fcheck-pointer-bounds -mmpx -flto -flto-partition=max (internal > compiler error) > FAIL: g++.dg/lto/pr82027 cp_lto_pr82027_0.o assemble, -O3 -flto > (internal compiler error) > FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/covariant-1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr41257.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr41257.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr41257.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr41257.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr43068.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr43068.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr43068.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr43068.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr45699.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr45699.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr45699.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr45699.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr46287.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr46287.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr46287.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr46287.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr48661.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr48661.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr48661.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr48661.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -O0 (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -O0 (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -O1 (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -O1 (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -O2 (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -O2 (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -O3 -fomit-frame-pointer > -funroll-loops -fpeel-loops -ftracer -finline-functions (internal > compiler error) > FAIL: g++.dg/torture/pr48954.C -O3 -fomit-frame-pointer > -funroll-loops -fpeel-loops -ftracer -finline-functions (test for > excess errors) > FAIL: g++.dg/torture/pr48954.C -O3 -g (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -O3 -g (test for excess errors) > FAIL: g++.dg/torture/pr48954.C -Os (internal compiler error) > FAIL: g++.dg/torture/pr48954.C -Os (test for excess errors) > FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr58201_0.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr58201_1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr58252.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr58252.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr58252.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr58252.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr58585.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr58585.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr58585.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr58585.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr59226.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr59226.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr59226.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr59226.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr60871.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr60871.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr60871.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr60871.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr64988.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr64988.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr64988.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr64988.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr68184.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr68184.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr68184.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr68184.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr71571.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr71571.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr71571.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr71571.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr78692.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr78692.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr78692.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr78692.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr81812.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr81812.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr81812.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr81812.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/torture/pr83619.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/torture/pr83619.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/torture/pr83619.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/torture/pr83619.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/pr64632.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/pr65000.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/pr70147-1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/vptr-10.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/vptr-11.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/vptr-1.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/vptr-2.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (internal compiler error) > FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fno-use-linker-plugin > -flto-partition=none (test for excess errors) > FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (internal compiler error) > FAIL: g++.dg/ubsan/vptr-3.C -O2 -flto -fuse-linker-plugin > -fno-fat-lto-objects (test for excess errors) > > on Linux/x86 Strange. I didn't observe any regressions when I tested it. But, then again, I was testing against revision r259092 | jason | 2018-04-04 09:42:55 -0700 (Wed, 04 Apr 2018) | 4 lines which is over a week old. I'll revert that patch for now, and revisit this issue in stage1. Cesar ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-12 18:39 ` Cesar Philippidis @ 2018-04-12 20:35 ` Jakub Jelinek 2018-04-16 18:13 ` Tom de Vries 0 siblings, 1 reply; 12+ messages in thread From: Jakub Jelinek @ 2018-04-12 20:35 UTC (permalink / raw) To: Cesar Philippidis; +Cc: H.J. Lu, Richard Biener, gcc-patches On Thu, Apr 12, 2018 at 11:39:43AM -0700, Cesar Philippidis wrote: > Strange. I didn't observe any regressions when I tested it. But, then > again, I was testing against revision > > r259092 | jason | 2018-04-04 09:42:55 -0700 (Wed, 04 Apr 2018) | 4 lines > > which is over a week old. I'll revert that patch for now, and revisit > this issue in stage1. You should have kept the omp-expand.c chunk, that is correct and shouldn't cause issues. Jakub ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-12 20:35 ` Jakub Jelinek @ 2018-04-16 18:13 ` Tom de Vries 2018-04-23 12:07 ` [PATCH, lto, PR85422] Fixup loops before lto write-out Tom de Vries 2018-05-01 13:31 ` [PATCH] Handle empty infinite loops in OpenACC for PR84955 Tom de Vries 0 siblings, 2 replies; 12+ messages in thread From: Tom de Vries @ 2018-04-16 18:13 UTC (permalink / raw) To: Jakub Jelinek, Cesar Philippidis; +Cc: H.J. Lu, Richard Biener, gcc-patches [-- Attachment #1: Type: text/plain, Size: 983 bytes --] On 04/12/2018 08:58 PM, Jakub Jelinek wrote: > On Thu, Apr 12, 2018 at 11:39:43AM -0700, Cesar Philippidis wrote: >> Strange. I didn't observe any regressions when I tested it. But, then >> again, I was testing against revision >> >> r259092 | jason | 2018-04-04 09:42:55 -0700 (Wed, 04 Apr 2018) | 4 lines >> >> which is over a week old. I'll revert that patch for now, and revisit >> this issue in stage1. > > You should have kept the omp-expand.c chunk, that is correct and shouldn't > cause issues. Committed as attached (with correct changelog entry, the previously committed patch had an incorrect one). I've filed the lto ICE (described as "the second problem" in this thread) as PR85422 - "[openacc] ICE at cfgloop.c:468: segfault in flow_loops_find". [ When changing dg-do compile to link in the test-cases in this patch, we run into PR85422, which shows that in the reverted patch the problematic fix was actually not exercised by the test-cases. ] Thanks, - Tom [-- Attachment #2: 0001-openacc-Fix-ICE-when-compiling-tile-loop-containing-infinite-loop.patch --] [-- Type: text/x-patch, Size: 2336 bytes --] [openacc] Fix ICE when compiling tile loop containing infinite loop 2018-04-16 Cesar Philippidis <cesar@codesourcery.com> Tom de Vries <tom@codesourcery.com> PR middle-end/84955 * omp-expand.c (expand_oacc_for): Add dummy false branch for tiled basic blocks without omp continue statements. * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. --- gcc/omp-expand.c | 8 ++++++++ libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c | 15 +++++++++++++++ libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index bb20490..c7d30ea 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -5439,6 +5439,14 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; + /* Add a dummy exit for the tiled block when cont_bb is missing. */ + if (cont_bb == NULL) + { + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); + e->probability = profile_probability::even (); + split->probability = profile_probability::even (); + } + /* Initialize the user's loop vars. */ gsi = gsi_start_bb (elem_body_bb); expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c new file mode 100644 index 0000000..e528faa --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int +main (void) +{ + int i, j; + +#pragma acc parallel loop tile(2,3) + for (i = 1; i < 10; i++) + for (j = 1; j < 10; j++) + for (;;) + ; + + return i + j; +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 new file mode 100644 index 0000000..dc85865 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } + +subroutine s + integer :: i, j + !$acc parallel loop tile(2,3) + do i = 1, 10 + do j = 1, 10 + do + end do + end do + end do + !$acc end parallel loop +end subroutine s ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH, lto, PR85422] Fixup loops before lto write-out 2018-04-16 18:13 ` Tom de Vries @ 2018-04-23 12:07 ` Tom de Vries 2018-04-23 12:11 ` Richard Biener 2018-05-01 13:31 ` [PATCH] Handle empty infinite loops in OpenACC for PR84955 Tom de Vries 1 sibling, 1 reply; 12+ messages in thread From: Tom de Vries @ 2018-04-23 12:07 UTC (permalink / raw) To: Richard Biener; +Cc: Jakub Jelinek, Cesar Philippidis, H.J. Lu, gcc-patches [-- Attachment #1: Type: text/plain, Size: 1324 bytes --] [ was: Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 ] On 04/16/2018 08:13 PM, Tom de Vries wrote: > On 04/12/2018 08:58 PM, Jakub Jelinek wrote: >> On Thu, Apr 12, 2018 at 11:39:43AM -0700, Cesar Philippidis wrote: >>> Strange. I didn't observe any regressions when I tested it. But, then >>> again, I was testing against revision >>> >>> r259092 | jason | 2018-04-04 09:42:55 -0700 (Wed, 04 Apr 2018) | 4 lines >>> >>> which is over a week old. I'll revert that patch for now, and revisit >>> this issue in stage1. >> >> You should have kept the omp-expand.c chunk, that is correct and >> shouldn't >> cause issues. > > Committed as attached (with correct changelog entry, the previously > committed patch had an incorrect one). > > I've filed the lto ICE (described as "the second problem" in this > thread) as PR85422 - "[openacc] ICE at cfgloop.c:468: segfault in > flow_loops_find". > Hi, your updated patch [ as posted here ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85422#c9 ) ] fixes the flow_loops_find segfault, without causing the regressions mentioned here ( https://gcc.gnu.org/ml/gcc-patches/2018-04/msg00628.html ). Build x86_64 with nvptx accelerator, ran libgomp testsuite. Bootstrapped and reg-tested x86_64 with -m64/-m32. OK for stage4/stage1 trunk? Thanks, - Tom [-- Attachment #2: 0001-lto-Fixup-loops-before-lto-write-out.patch --] [-- Type: text/x-patch, Size: 1572 bytes --] [lto] Fixup loops before lto write-out 2018-04-23 Richard Biener <rguenther@suse.de> Tom de Vries <tom@codesourcery.com> 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. --- gcc/lto-streamer-out.c | 4 ++++ libgomp/testsuite/libgomp.oacc-c-c++-common/pr85422.c | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 1d2ab97..70476dc 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/testsuite/libgomp.oacc-c-c++-common/pr85422.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr85422.c new file mode 100644 index 0000000..bcc551d --- /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; +} ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH, lto, PR85422] Fixup loops before lto write-out 2018-04-23 12:07 ` [PATCH, lto, PR85422] Fixup loops before lto write-out Tom de Vries @ 2018-04-23 12:11 ` Richard Biener 0 siblings, 0 replies; 12+ messages in thread From: Richard Biener @ 2018-04-23 12:11 UTC (permalink / raw) To: Tom de Vries; +Cc: Jakub Jelinek, Cesar Philippidis, H.J. Lu, gcc-patches On Mon, 23 Apr 2018, Tom de Vries wrote: > [ was: Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 ] > > On 04/16/2018 08:13 PM, Tom de Vries wrote: > > On 04/12/2018 08:58 PM, Jakub Jelinek wrote: > > > On Thu, Apr 12, 2018 at 11:39:43AM -0700, Cesar Philippidis wrote: > > > > Strange. I didn't observe any regressions when I tested it. But, then > > > > again, I was testing against revision > > > > > > > > r259092 | jason | 2018-04-04 09:42:55 -0700 (Wed, 04 Apr 2018) | 4 lines > > > > > > > > which is over a week old. I'll revert that patch for now, and revisit > > > > this issue in stage1. > > > > > > You should have kept the omp-expand.c chunk, that is correct and shouldn't > > > cause issues. > > > > Committed as attached (with correct changelog entry, the previously > > committed patch had an incorrect one). > > > > I've filed the lto ICE (described as "the second problem" in this thread) as > > PR85422 - "[openacc] ICE at cfgloop.c:468: segfault in flow_loops_find". > > > > Hi, > > your updated patch [ as posted here ( > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85422#c9 ) ] fixes the > flow_loops_find segfault, without causing the regressions mentioned here ( > https://gcc.gnu.org/ml/gcc-patches/2018-04/msg00628.html ). > > Build x86_64 with nvptx accelerator, ran libgomp testsuite. > > Bootstrapped and reg-tested x86_64 with -m64/-m32. > > OK for stage4/stage1 trunk? OK for stage1. Thanks, Richard. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955 2018-04-16 18:13 ` Tom de Vries 2018-04-23 12:07 ` [PATCH, lto, PR85422] Fixup loops before lto write-out Tom de Vries @ 2018-05-01 13:31 ` Tom de Vries 1 sibling, 0 replies; 12+ messages in thread From: Tom de Vries @ 2018-05-01 13:31 UTC (permalink / raw) To: Richard Biener; +Cc: Jakub Jelinek, Cesar Philippidis, H.J. Lu, gcc-patches [-- Attachment #1: Type: text/plain, Size: 1502 bytes --] On 04/16/2018 08:13 PM, Tom de Vries wrote: > On 04/12/2018 08:58 PM, Jakub Jelinek wrote: >> On Thu, Apr 12, 2018 at 11:39:43AM -0700, Cesar Philippidis wrote: >>> Strange. I didn't observe any regressions when I tested it. But, then >>> again, I was testing against revision >>> >>> r259092 | jason | 2018-04-04 09:42:55 -0700 (Wed, 04 Apr 2018) | 4 lines >>> >>> which is over a week old. I'll revert that patch for now, and revisit >>> this issue in stage1. >> >> You should have kept the omp-expand.c chunk, that is correct and >> shouldn't >> cause issues. > > Committed as attached (with correct changelog entry, the previously > committed patch had an incorrect one). > Backported to gcc-7-branch as attached. Thanks, - Tom > diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c > index bb20490..c7d30ea 100644 > --- a/gcc/omp-expand.c > +++ b/gcc/omp-expand.c > @@ -5439,6 +5439,14 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) > > split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; > > + /* Add a dummy exit for the tiled block when cont_bb is missing. */ > + if (cont_bb == NULL) > + { > + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); > + e->probability = profile_probability::even (); > + split->probability = profile_probability::even (); > + } > + > /* Initialize the user's loop vars. */ > gsi = gsi_start_bb (elem_body_bb); > expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset); [-- Attachment #2: 0001-backport-openacc-Fix-ICE-when-compiling-tile-loop-containing-infinite-loop.patch --] [-- Type: text/x-patch, Size: 2383 bytes --] backport "[openacc] Fix ICE when compiling tile loop containing infinite loop" 2018-04-16 Tom de Vries <tom@codesourcery.com> backport from trunk: 2018-04-16 Cesar Philippidis <cesar@codesourcery.com> Tom de Vries <tom@codesourcery.com> PR middle-end/84955 * omp-expand.c (expand_oacc_for): Add dummy false branch for tiled basic blocks without omp continue statements. * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test. * testsuite/libgomp.oacc-fortran/pr84955.f90: New test. --- gcc/omp-expand.c | 8 ++++++++ libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c | 15 +++++++++++++++ libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 | 13 +++++++++++++ 3 files changed, 36 insertions(+) diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index a1e668d..549a5db 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -5628,6 +5628,14 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE; + /* Add a dummy exit for the tiled block when cont_bb is missing. */ + if (cont_bb == NULL) + { + edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE); + e->probability = PROB_EVEN; + split->probability = PROB_EVEN; + } + /* Initialize the user's loop vars. */ gsi = gsi_start_bb (elem_body_bb); expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset); diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c new file mode 100644 index 0000000..e528faa --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int +main (void) +{ + int i, j; + +#pragma acc parallel loop tile(2,3) + for (i = 1; i < 10; i++) + for (j = 1; j < 10; j++) + for (;;) + ; + + return i + j; +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 new file mode 100644 index 0000000..dc85865 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 @@ -0,0 +1,13 @@ +! { dg-do compile } + +subroutine s + integer :: i, j + !$acc parallel loop tile(2,3) + do i = 1, 10 + do j = 1, 10 + do + end do + end do + end do + !$acc end parallel loop +end subroutine s ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-05-01 13:31 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-04-06 13:49 [PATCH] Handle empty infinite loops in OpenACC for PR84955 Cesar Philippidis 2018-04-06 15:35 ` Jakub Jelinek 2018-04-09 11:32 ` Richard Biener 2018-04-11 19:31 ` Cesar Philippidis 2018-04-12 8:02 ` Richard Biener 2018-04-12 18:27 ` H.J. Lu 2018-04-12 18:39 ` Cesar Philippidis 2018-04-12 20:35 ` Jakub Jelinek 2018-04-16 18:13 ` Tom de Vries 2018-04-23 12:07 ` [PATCH, lto, PR85422] Fixup loops before lto write-out Tom de Vries 2018-04-23 12:11 ` Richard Biener 2018-05-01 13:31 ` [PATCH] Handle empty infinite loops in OpenACC for PR84955 Tom de Vries
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).