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

--- Comment #13 from Tobias Burnus <burnus at gcc dot gnu.org> ---
I think the example was something like:
--------------------
#include <openacc.h>

void bogus_fn();
void f()
{
  if (!acc_on_device (acc_device_host))
    bogus_fn();
}
--------------------

And I do recall that the result for, e.g.,
  gcc -fopenacc -c example.c
differed between a GCC with
   '--enable-offload-targets=nvptx-none,amdgcn-amdhsa'
and
   '--disable-offload-targets'

In the debugger, it seemed as if gimple_fold_builtin_acc_on_device would be
called twice for the former and with disable only once – and the simplification
only happened in the second round.

Hence, the goal of the original patch was to ensure that also with
--disable-offload-targets the optimization would be done.

Obviously, I do not recall the details of the debugging done back then, nor
do I feel like rebuilding old versions or trying very hard to come up with more
tests.

However, I tried it with the current trunk version (for either variant).
Result:


I can currently NOT REPRODUCE my old issue; namely:

* With -O0, both variants (the former also with -foffload={disable,default}
and with trying the offload-enabled distro version of GCC 14) give with 'nm':
                   U acc_on_device
                   U bogus_fn
  0000000000000000 T f

* With -O1, for all variants, only
  0000000000000000 T f
remains.

Thus, it seems to be consistent and there seems to be no issue (or it hides
very well).

Reply via email to