[Bug lto/94320] [OpenMP][Offloading] lto1 ICE during IPA pass: inline – offline_size at gcc/ipa-inline-analysis.c:453

2020-03-26 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94320

--- Comment #2 from Tobias Burnus  ---
(In reply to Jakub Jelinek from comment #1)
> tried
> +  && !lto_stream_offload_p

With that patch, I get 6 times "has been referenced in offloaded code but
hasn't been marked to be included in the offloaded code".

Thus, that's a useful patch for the code I looked at. All those those functions
are template functions. (With -O0, the nvptx run-time compilers complains only
about 3 of those functions.)

> I'm afraid we need to actually implement properly the OpenMP 5.0
> automatic omp declare target discovery

Yes, it looks like that. I think C++ code is mostly affected as one quickly
ends up using 'operator[]' and similar functions, which are not always inlined.

Additionally, template programming makes it harder for the user to mark those
functions as 'declare target'.

[Bug lto/94320] [OpenMP][Offloading] lto1 ICE during IPA pass: inline – offline_size at gcc/ipa-inline-analysis.c:453

2020-03-25 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94320

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
Perhaps related to PR92357?
I'm stuck there, tried
2020-02-07  Jakub Jelinek  

PR ipa/92357
* symtab.c (symtab_node::get_partitioning_class): Don't return
SYMBOL_DUPLICATE for DECL_ONE_ONLY symbols if lto_stream_offload_p.

--- gcc/symtab.c.jj 2020-01-15 11:05:19.589136168 +0100
+++ gcc/symtab.c2020-02-07 19:57:55.625108414 +0100
@@ -2003,6 +2003,7 @@ symtab_node::get_partitioning_class (voi
   if (DECL_ONE_ONLY (decl)
   && !force_output
   && !forced_by_abi
+  && !lto_stream_offload_p
   && !used_from_object_file_p ())
 return SYMBOL_DUPLICATE;

but it didn't work out.  I'm afraid we need to actually implement properly the
OpenMP 5.0 automatic omp declare target discovery and before IPA run perhaps
another iteration of that and make sure that if we offload something, we either
offload everything it refers to too (unless DECL_EXTERNAL), or diagnose it.