Mikael Morin wrote:
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...
I had also a glance at the patch - and it looks reasonable; in
particular, I failed to generate a failing test case.
Besides the
!$omp parallel
!$omp workshare
one should also add a test for - it can also be in the same file -:
!$omp parallel workshare
Regarding the test case: You cannot place a "dg-do run" OpenMP test case
into gcc/testsuite/gfortran.dg/gomp/workshare2.f90; you have to use
libgomp/testsuite/libgomp.fortran. The former directory only allows
"dg-do compile" test cases. (By the way, running "make check" for
libgomp does never harm.)
Jakub, what do you think?
Tobias
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.