On Tuesday 25 October 2011 07:39:44 Thomas Koenig wrote: > Ping ** 0.571428 > Let's keep Jakub CC-ed for mixes of OpenMP and frontend optimizations. ;-)
There are two commented lines in the testcase. Is it expected? Otherwise doesn't look too bad... Mikael > > Jakub Jelinek wrote: > >> Though, what could be done is just special case OpenMP workshare > >> regions, insert everything into BLOCK local vars unless in OpenMP > >> workshare, in that > >> case put the BLOCK with the temporary around the workshare rather than > >> inside of it. In the case of omp parallel workshare it would need > >> to go in between omp parallel and omp workshare. > > > > Well, here's a patch which implements this concept. I chose to insert > > the BLOCK in a separate pass because it was the cleanest way to avoid > > infinite recursion when inserting a block. > > > > Regression-tested. OK for trunk? > > > > Thomas > > > > 2011-10-21 Thomas Koenig <tkoe...@gcc.gnu.org> > > > > PR fortran/50690 > > * frontend-passes.c (workshare_level): New variable. > > (create_var): Put the newly created variable into the block > > around the WORKSHARE. > > (enclose_workshare): New callback function to enclose > > WORKSHAREs in blocks. > > (optimize_namespace): Use it. > > (gfc_code_walker): Save/restore current namespace when > > following a BLOCK. Keep track of workshare level. > > > > 2011-10-21 Thomas Koenig <tkoe...@gcc.gnu.org> > > > > PR fortran/50690 > > * gfortran.dg/gomp/workshare2.f90: New test.