From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1534) id 8F6E63959C4C; Wed, 16 Nov 2022 08:00:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F6E63959C4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668585613; bh=KlrLEeBZ/giQp9H5E/y/HnbO5dtOv+QDqLDwkyhkYBE=; h=From:To:Subject:Date:From; b=W9tw2+yHjJBUGjo8QdxMgq6Wi3C5Yfoy7dDPQ4a4AFFS6MyINtsDHlN3Gjcv4FSq+ jFZX7Fc1NolrdyAx4bRveS2e7lbjLqFUu3I0FrFQwgbUaAMufvWaFasNKYIQl1zzAQ pWpM0+flVsAWteE3yvrhsvGptwpaSy6vyvvd74co= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Tobias Burnus To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4083] nvptx/mkoffload.cc: Fix "$nohost" check X-Act-Checkin: gcc X-Git-Author: Tobias Burnus X-Git-Refname: refs/heads/master X-Git-Oldrev: 7f014022861b5b3f00be9bb32fe3fe772517ddac X-Git-Newrev: d59858f6ee7f356f27ccc2d29129826781f9483f Message-Id: <20221116080013.8F6E63959C4C@sourceware.org> Date: Wed, 16 Nov 2022 08:00:13 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d59858f6ee7f356f27ccc2d29129826781f9483f commit r13-4083-gd59858f6ee7f356f27ccc2d29129826781f9483f Author: Tobias Burnus Date: Wed Nov 16 08:58:44 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. Diff: --- gcc/config/nvptx/mkoffload.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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"); }