On Wed, Nov 05, 2014 at 03:46:55PM +0300, Ilya Verbin wrote: > Maybe also with this change? > > diff --git a/gcc/omp-low.c b/gcc/omp-low.c > index 4e9ed25..beae5b5 100644 > --- a/gcc/omp-low.c > +++ b/gcc/omp-low.c > @@ -1653,8 +1653,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) > if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP > && DECL_P (decl) > && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) > - && lookup_attribute ("omp declare target", > - DECL_ATTRIBUTES (decl))) > + && varpool_node::get_create (decl)->offloadable) > break; > if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP > && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER) > @@ -1794,8 +1793,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) > decl = OMP_CLAUSE_DECL (c); > if (DECL_P (decl) > && is_global_var (maybe_lookup_decl_in_outer_ctx (decl, ctx)) > - && lookup_attribute ("omp declare target", > - DECL_ATTRIBUTES (decl))) > + && varpool_node::get_create (decl)->offloadable) > break; > if (DECL_P (decl)) > {
That looks reasonable (of course if the other patch is committed). > --- a/gcc/cgraph.c > +++ b/gcc/cgraph.c > @@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see > #include "tree-dfa.h" > #include "profile.h" > #include "params.h" > +#include "context.h" > > /* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. > */ > #include "tree-pass.h" > @@ -474,6 +475,14 @@ cgraph_node::create (tree decl) > gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); > > node->decl = decl; > + > + if (flag_openmp > + && lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl))) > + { > + node->offloadable = 1; > + g->have_offload = true; > + } > + > node->register_symbol (); LGTM. Jakub