]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
nvptx/mkoffload.cc: Fix "$nohost" check
authorTobias Burnus <tobias@codesourcery.com>
Wed, 16 Nov 2022 10:19:46 +0000 (11:19 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Wed, 16 Nov 2022 10:19:46 +0000 (11:19 +0100)
If lhd_set_decl_assembler_name is invoked - in particular if
!TREE_PUBLIC (decl) && !DECL_FILE_SCOPE_P (decl) - the '.nohost' suffix
might change to '.nohost.2'. This happens for the existing reverse offload
testcases via cgraph_node::analyze and is a side effect of
r13-3455-g178ac530fe67e4f2fc439cc4ce89bc19d571ca31 for some reason.

The solution is to not only check for a tailing '$nohost' but also for
'$nohost$' in nvptx/mkoffload.cc.

gcc/ChangeLog:

* config/nvptx/mkoffload.cc (process): Recognize '$nohost$...'
besides tailing '$nohost' as being for reverse offload.

(cherry picked from commit d59858f6ee7f356f27ccc2d29129826781f9483f)

gcc/ChangeLog.omp
gcc/config/nvptx/mkoffload.cc

index 2fd66c63cbba4cd7a8c77287b545a93be34c1bf3..61651fbfe37c3f0d84b4acff6f272ee1ffdfaf14 100644 (file)
@@ -1,3 +1,11 @@
+2022-11-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       Backported from master:
+       2022-11-16  Tobias Burnus  <tobias@codesourcery.com>
+
+       * config/nvptx/mkoffload.cc (process): Recognize '$nohost$...'
+       besides tailing '$nohost' as being for reverse offload.
+
 2022-11-07  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
        * config/gcn/gcn.cc (gcn_expand_builtin_1): Expand first argument
index 854cd72f3c74778694dc5977b9322f7e6129d8f7..5d89ba8a78882564ed6241d6ab9841f48af1dc6b 100644 (file)
@@ -364,7 +364,8 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
             Alternatively, besides searching for 'BEGIN FUNCTION DECL',
             checking for '.visible .entry ' + id->ptx_name would be
             required.  */
-         if (!endswith (id->ptx_name, "$nohost"))
+         if (!endswith (id->ptx_name, "$nohost")
+             && !strstr (id->ptx_name, "$nohost$"))
            continue;
          fprintf (out, "\t\".extern ");
          const char *p = input + file_idx[fidx];
@@ -402,7 +403,8 @@ process (FILE *in, FILE *out, uint32_t omp_requires)
                    "$offload_func_table[] = {");
       for (comma = "", id = func_ids; id; comma = ",", id = id->next)
        fprintf (out, "%s\"\n\t\t\"%s", comma,
-                endswith (id->ptx_name, "$nohost") ? id->ptx_name : "0");
+                (endswith (id->ptx_name, "$nohost")
+                 || strstr (id->ptx_name, "$nohost$")) ? id->ptx_name : "0");
       fprintf (out, "};\\n\";\n\n");
     }