[PATCH 2/n] OpenMP 4.0 offloading infrastructure: LTO streaming
Jakub Jelinek
jakub@redhat.com
Mon Nov 3 09:24:00 GMT 2014
On Tue, Oct 28, 2014 at 10:30:47PM +0300, Ilya Verbin wrote:
> --- 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,13 @@ cgraph_node::create (tree decl)
> gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
>
> node->decl = decl;
> +
> + if (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (decl)))
> + {
> + node->offloadable = 1;
> + g->have_offload = true;
> + }
I wonder if we shouldn't optimize here and call lookup_attribute only
if there is a chance that the attribute might be present, so guard with
flag_openmp (and flag_openacc later on?). During LTO the cgraph nodes
are streamed in and supposedly the flag offloadable too.
> @@ -2129,8 +2141,12 @@ symbol_table::compile (void)
> fprintf (stderr, "Performing interprocedural optimizations\n");
> state = IPA;
>
> + /* OpenMP offloading requires LTO infrastructure. */
> + if (!in_lto_p && flag_openmp && g->have_offload)
> + flag_generate_lto = 1;
On the other side, do you need flag_openmp here? Supposedly g->have_offload
would already been set if needed.
Jakub
More information about the Gcc-patches
mailing list