https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89499

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Looking more closely, the thing is that this stuff (e.g. the .UNIQUE calls)
require the execute_oacc_device_lower pass to transform it or clean it up.

But that pass starts with:
  tree attrs = oacc_get_fn_attrib (current_function_decl);

  if (!attrs)
    /* Not an offloaded function.  */
    return 0;
so does nothing in functions that don't have the OpenACC attributes.

Thus, either we must prevent inlining of functions with those attributes into
functions without those attributes (are there any other incompatibilities?  I
admit I'm not familiar enough with OpenACC to judge if inlining say #pragma acc
routine vector into #pragma acc routine gang (if such things exists) or vice
versa etc. is ok), which would be something that could be done in
can_inline_edge_p.

Or it is inlinable, but we need some cleanup, in that case perhaps have some
cfun->* flag that would be initially set to whether the function has
oacc_get_fn_attrib and would be ored into functions into which those functions
were inlined, and then the oaccdevlower pass would clean that stuff up or
whatever.

At least short term the first option seems easier (and backportable).
Do all oacc_get_fn_attrib functions have these IFN_UNIQUE calls, or only some
subset of them (e.g. only if they contain certain other OpenACC constructs in
them)?

Reply via email to