This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Handle empty infinite loops in OpenACC for PR84955


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]