[patch] More precise cfg for omp constructs

Jakub Jelinek jakub@redhat.com
Tue Dec 18 23:13:00 GMT 2007


On Tue, Dec 18, 2007 at 06:42:51PM +0100, Zdenek Dvorak wrote:
> > Assuming all these changes are ok, one fix
> > would be avoid calling determine_parallel_type from within
> > build_omp_regions_1, but only when it finished (i.e. from
> > build_omp_regions_root/build_omp_regions), by walking the tree of
> > created regions and for OMP_PARALLEL regions calling determine_parallel_type
> > on them.
> 
> yes, the patch below seems to fix the problem.

This looks good to me.  Diego, are you ok with this if Zdenek writes a
ChangeLog entry?  I'll prepare testcases tomorrow.

> Index: omp-low.c
> ===================================================================
> *** omp-low.c	(revision 131013)
> --- omp-low.c	(working copy)
> *************** expand_omp (struct omp_region *region)
> *** 3952,3957 ****
> --- 3952,3962 ----
>   {
>     while (region)
>       {
> +       /* First, determine whether this is a combined parallel+workshare
> +        	 region.  */
> +       if (region->type == OMP_PARALLEL)
> + 	determine_parallel_type (region);
> + 
>         if (region->inner)
>   	expand_omp (region->inner);
>   
> *************** build_omp_regions_1 (basic_block bb, str
> *** 4028,4038 ****
>   	  region = parent;
>   	  region->exit = bb;
>   	  parent = parent->outer;
> - 
> - 	  /* If REGION is a parallel region, determine whether it is
> - 	     a combined parallel+workshare region.  */
> - 	  if (region->type == OMP_PARALLEL)
> - 	    determine_parallel_type (region);
>   	}
>         else if (code == OMP_ATOMIC_STORE)
>   	{
> --- 4033,4038 ----

	Jakub



More information about the Gcc-patches mailing list