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

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Prathamesh Kulkarni
<prathamesh3...@gcc.gnu.org>:

https://gcc.gnu.org/g:f5ee372b012594830f6d5f7f4b7e01bae810b1da

commit r15-3816-gf5ee372b012594830f6d5f7f4b7e01bae810b1da
Author: Prathamesh Kulkarni <prathame...@nvidia.com>
Date:   Tue Sep 24 08:18:48 2024 +0530

    nvptx: Partial support for aliases to aliases.

    For the following test (adapted from pr96390.c):

    __attribute__((noipa)) int foo () { return 42; }
    int bar () __attribute__((alias ("foo")));
    int baz () __attribute__((alias ("bar")));

    int main ()
    {
      int n;
      #pragma omp target map(from:n)
        n = baz ();
      return n;
    }

    gcc emits following ptx for baz:
    .visible .func (.param.u32 %value_out) bar;
    .alias bar,foo;
    .visible .func (.param.u32 %value_out) baz;
    .alias baz,bar;

    which is incorrect since PTX requires aliasee to be a defined function.
    The patch instead uses cgraph_node::get(name)->ultimate_alias_target,
    which generates the following PTX:

    .visible .func (.param.u32 %value_out) baz;
    .alias baz,foo;

    gcc/ChangeLog:
            PR target/104957
            * config/nvptx/nvptx.cc (nvptx_asm_output_def_from_decls): Use
            cgraph_node::get(name)->ultimate_alias_target instead of value.

    gcc/testsuite/ChangeLog:
            PR target/104957
            * gcc.target/nvptx/alias-to-alias-1.c: Adjust.

    Signed-off-by: Prathamesh Kulkarni <prathame...@nvidia.com>
    Co-authored-by: Thomas Schwinge <tschwi...@baylibre.com>

Reply via email to