On Fri, Nov 27, 2015 at 01:03:52PM +0100, Tom de Vries wrote: > Handle non-declared variables in kernels alias analysis > > 2015-11-27 Tom de Vries <t...@codesourcery.com> > > * gimplify.c (gimplify_scan_omp_clauses): Initialize > OMP_CLAUSE_ORIG_DECL. > * omp-low.c (install_var_field_1): Handle base_pointers_restrict for > pointers. > (map_ptr_clause_points_to_clause_p) > (nr_map_ptr_clauses_pointing_to_clause): New function. > (omp_target_base_pointers_restrict_p): Handle GOMP_MAP_POINTER. > * tree-pretty-print.c (dump_omp_clause): Print OMP_CLAUSE_ORIG_DECL. > * tree.c (omp_clause_num_ops): Set num_ops for OMP_CLAUSE_MAP to 3. > * tree.h (OMP_CLAUSE_ORIG_DECL): New macro. > > * c-c++-common/goacc/kernels-alias-10.c: New test. > * c-c++-common/goacc/kernels-alias-9.c: New test.
I don't like this (mainly the addition of OMP_CLAUSE_ORIG_DECL), but it also sounds wrong to me. The primary question is how do you handle GOMP_MAP_POINTER (which is something we don't use for C/C++ OpenMP anymore, and Fortran OpenMP will stop using it in GCC 7 or 6.2?) on the OpenACC libgomp side, does it work like GOMP_MAP_ALLOC or GOMP_MAP_FORCE_ALLOC? Similarly GOMP_MAP_TO_PSET. If it works like GOMP_MAP_ALLOC (it does on the OpenMP side in target.c, so if something is already mapped, no further pointer assignment happens), then your change looks wrong. If it works like GOMP_MAP_FORCE_ALLOC, then you just should treat GOMP_MAP_POINTER on all OpenACC constructs as opcode that allows the restrict operation. If it should behave differently depending on if the corresponding array section has been mapped with GOMP_MAP_FORCE_* or without it, then supposedly you should use a different code for those two. Jakub