public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] nvptx/mkoffload.cc: Fix "$nohost" check
Date: Wed, 16 Nov 2022 10:20:51 +0000 (GMT)	[thread overview]
Message-ID: <20221116102051.02DC83959C83@sourceware.org> (raw)

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

commit b4acb91ca45c8e0e1ad66c7f245f8cff8c481be0
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Nov 16 11:19:46 2022 +0100

    nvptx/mkoffload.cc: Fix "$nohost" check
    
    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)

Diff:
---
 gcc/ChangeLog.omp             | 8 ++++++++
 gcc/config/nvptx/mkoffload.cc | 6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 2fd66c63cbb..61651fbfe37 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -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
diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc
index 854cd72f3c7..5d89ba8a788 100644
--- a/gcc/config/nvptx/mkoffload.cc
+++ b/gcc/config/nvptx/mkoffload.cc
@@ -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");
     }

                 reply	other threads:[~2022-11-16 10:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221116102051.02DC83959C83@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).