On 12/09/2016 07:05 AM, Cesar Philippidis wrote:
On 12/08/2016 04:37 PM, Jeff Law wrote:
On 12/08/2016 04:05 PM, Cesar Philippidis wrote:
PR78027 was classified as a fortran bug, but the underlying problem
turned out to be more generic. Basically, the IPA-ICF pass usually
ignores functions with omp decl attributes as candidates for aliasing.
Usually that works for OpenACC, because offloaded functions generated by
OpenACC PARALLEL or KERNELS regions usually have an 'omp target
entrypoint' attribute. However that is not the case in two situations:
1. ACC ROUTINES do not have an 'omp target entrypoint' attribute.
2. Nested offloaded regions inside 'omp declare target' functions do not
have 'omp target entrypoint' attributes either.
The solution I chose for this problem is to teach the IPA-ICF pass to
ignore function with 'oacc *' decl attributes. Arguably 2) should be a
parser error when an OpenACC offloaded region is embedded within an
OpenMP offloaded function. The LTO linker does report an error for nvptx
targets, but not the host. With that in mind, this patch is still
necessary for case 1.
Is this OK for trunk?
Cesar
trunk-pr78027.diff
2016-12-08 Cesar Philippidis <ce...@codesourcery.com>
PR fortran/78027
gcc/
* ipa-icf.c (sem_function::parse): Don't process functions with
oacc decl attributes, as they may be OpenACC routines.
gcc/testsuite/
* c-c++-common/goacc/acc-icf.c: New test.
* gfortran.dg/goacc/pr78027.f90: New test.
This follows the same approach as we do for openmp. This is fine for
the trunk.
Is this also OK for gcc-6?
Your call -- I don't think folks are really using OpenACC much in gcc-6,
but if you think it's worth the time, go ahead.
jeff