From patchwork Tue Nov 15 18:47:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 20506 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2888471wru; Tue, 15 Nov 2022 10:48:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Hk7BlHggiq9XAPaG4bhFMZgLv6y+xGenWYGdS2c9hXZDNOBg/fgkEpf7OTOixbF3Xu89+ X-Received: by 2002:a17:906:e204:b0:780:93d2:8510 with SMTP id gf4-20020a170906e20400b0078093d28510mr14740523ejb.457.1668538083172; Tue, 15 Nov 2022 10:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668538083; cv=none; d=google.com; s=arc-20160816; b=izv9YvxQkgRohYB+cWae56L7ylZaL9+p7Uk0K7av6/VUzHUWQ+GuDJrOFTcI/3nhIV c9PNkcTH/emJtHQS3gkK0yw+5wGXYOWRJmNm1IVks6Y2pGnqXYj/YOp3ECT2apgQum/n Qpup5M2moF8hvGM2R/HtAaP4VuBpKVRTL8DW2etL191VYd6UXOC9I7DiDFpeAZbw9X9K YRoTqdFzlns8585MjykVcmeKuRPRoxIS+CmnS6NvVVA1RipZXnn/uBMcrcJH1bVCU37D pupYp2u2gd2ueeNTbn+2OSLmhLXtb2DqB/UxOrUfeKNvqXLzFFglCy0y29yD85zQ0aWr V8HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:from:to :content-language:user-agent:mime-version:date:message-id :ironport-sdr:dmarc-filter:delivered-to; bh=8kNi9ei+Abac0KPtorv6dTSIwl53GlVr6ZxMYEp1rpE=; b=bdROtPpKU9vka5D70D3PKgVQLgV8OlSltT6Gcw2OM8bT6BkaYJcKNZjxHNE5euMcyP YXTtBuNfmwV90xpdQ7WOGbGEqwLUoznuhbZjwyO6PB9phUb0ojsa1tAXDIozKyICvtPI z2ARj3XDBDIahplxyUiAFfOOpVmmIcBnL1W42Gvaq0CCoEueYCb7kXNJb3p39qe5YHb9 v0gUBONH5HQFsPz+QIAjPQrSeK92x8wUvvS1la+zr4d1/smDfrOY0LLDXw6ybs+RME+Q sK/GS4nPlwL+flIsSJGEeh4TQ9offb9xP+sFq588C+udX2HLmnIiSIeUMLdXxczaZ0Md u1nQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id k23-20020a170906971700b007a00aaf659csi10542429ejx.198.2022.11.15.10.48.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 10:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 383DE38A9096 for ; Tue, 15 Nov 2022 18:47:58 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 8D9BB38A9096 for ; Tue, 15 Nov 2022 18:47:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D9BB38A9096 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.96,166,1665475200"; d="diff'?scan'208";a="87216298" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 15 Nov 2022 10:47:31 -0800 IronPort-SDR: V3HbV9gJu/0FLhq+SqK3bZsOFVvwa6aRMJ1s1Mr0aj8JKeynyXJI/BvXUIilhHBrN7WU6teVcL xypnpL4Ay0hnsUQiCQ6aVHKblUZ8ClzbTWnQtqP937o0AH79h/cAwG7eMuwGO7Ive9MXxhd96R b4ZXUEUaGecCoukaCDSMQf3Dwd42rSFklbFkFUx7RkFoC1coleSlSWJy0592K9QwQI4KvCHQFi Fv4JR0vJ0FMT+MkBl1/s9f+oVX57pnhY+0qnRsxBkL5klX/XcX1yHqRyMQKJu/HaO/E541M2jl RrA= Message-ID: <1fbc0c22-96d7-dc6d-b2b7-8a07f4ba0ac4@codesourcery.com> Date: Tue, 15 Nov 2022 19:47:25 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: en-US To: gcc-patches , Jakub Jelinek From: Tobias Burnus Subject: [Patch] nvptx/mkoffload.cc: Fix "$nohost" check X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749588988815356630?= X-GMAIL-MSGID: =?utf-8?q?1749588988815356630?= Found when working on real reverse offload - as the reverse-offload stub function was added to the reverse-offload table. Reason - as mentioned in the commit log: lhd_set_decl_assembler_name. I intent to commit it tomorrow as obvious, unless there are further comments. Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 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. 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"); }