Handle global loop counters in fortran oacc kernels
Unable to have loop counters with a scope limited to the kernels region, and
the fact that function scope inhibits parallelization, at the technical level,
it seems possible to do DCE and get rid of the dead code that is inhibiting
parallelization (in other words, the code copying the loop iterator value out
of the region), but probably some effort would be involved.
Another possibility is to add an assign of the final value of the loop
iteration variable after the loop to cut the dependency, though this will only
work for loops where that value is know at compile time -- which is exactly
what pass_scev_cprop does.
gcc/
* passes.def: Add pass_scev_cprop to pass_oacc_kernels.
* tree-ssa-loop.c (pass_scev_cprop::clone): New function.
gcc/testsuite/
* gcc.dg/pr41488.c: Update for new pass_scev_cprop.
* gcc.dg/tree-ssa/loop-17.c: Likewise.
* gcc.dg/tree-ssa/loop-39.c: Likewise.
* gcc.dg/tree-ssa/scev-7.c: Likewise.
* gfortran.dg/goacc/kernels-loop-2.f95: New test.
* gfortran.dg/goacc/kernels-loop.f95: New test.
libgomp/
* testsuite/libgomp.oacc-fortran/kernels-loop-2.f95: New test.
* testsuite/libgomp.oacc-fortran/kernels-loop.f95: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@222286 138bc75d-0d04-0410-961f-82ee72b054a4
13 files changed: