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

            Bug ID: 106752
           Summary: [OpenMP] reverse offload – avoid emitting 'nohost'
                    variant on the host / cleanup
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

For reverse offload, GCC generates a
  <...>._omp_fn.0.nohost
function on all devices and on the host it also generates
  <...>._omp_fn.0

However, the 'nohost' version is not used on the host and could be removed.
(Cleanup + size optimization.) - Or in other words:


(Pre-remark: DECL_IGNORE_P is set in omp-expand.cc's expand_omp_target
while the quote below is from omp-offload.cc execute_omp_device_lower.)

>From https://gcc.gnu.org/pipermail/gcc-patches/2022-August/600387.html:

> +       case IFN_GOMP_TARGET_REV:
...
> +           /* FIXME: Find a way to actually prevent outputting the empty-body
> +              old_decl as debug symbol + function in the assembly file.  */

The debug stuff ought to be through DECL_IGNORED_P on the FUNCTION_DECL.
If you want it set just on one side and clear on the other side, perhaps set
or clear it during lto streaming it in in offload lto1?

As for emitting it, perhaps turning it into an external declaration from
definition afterwards?


Cf. also original patch:
  https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598662.html
albeit the longer description is in
  https://gcc.gnu.org/pipermail/gcc-patches/2022-July/598654.html

This patch was committed as r13-2218.

Reply via email to