Handle global loop counters in fortran oacc kernels
commit0c33234340aa17536c2c86e0982c42070c89226b
authortschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Apr 2015 20:22:54 +0000 (21 20:22 +0000)
committertschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 Apr 2015 20:22:54 +0000 (21 20:22 +0000)
treef32dd61cebdb19ca82c983f605a8287cfff965f7
parent74e09b9dbbe43321fb20b0174f926893bf2111bc
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:
gcc/ChangeLog.gomp
gcc/passes.def
gcc/testsuite/ChangeLog.gomp
gcc/testsuite/gcc.dg/pr41488.c
gcc/testsuite/gcc.dg/tree-ssa/loop-17.c
gcc/testsuite/gcc.dg/tree-ssa/loop-39.c
gcc/testsuite/gcc.dg/tree-ssa/scev-7.c
gcc/testsuite/gfortran.dg/goacc/kernels-loop-2.f95 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/kernels-loop.f95 [new file with mode: 0644]
gcc/tree-ssa-loop.c
libgomp/ChangeLog.gomp
libgomp/testsuite/libgomp.oacc-fortran/kernels-loop-2.f95 [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-fortran/kernels-loop.f95 [new file with mode: 0644]