From patchwork Fri Nov 13 22:33:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1400165 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CXtXZ38DXz9sPB for ; Sat, 14 Nov 2020 09:33:15 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E04413951C2B; Fri, 13 Nov 2020 22:33:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 35BAB3854802 for ; Fri, 13 Nov 2020 22:33:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 35BAB3854802 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Thomas_Schwinge@mentor.com IronPort-SDR: 2MTHU1dhbNASlwd5ud0sDiDF+XGn9zV9IsFchay4W/co+JsMgTlf1qOAAVTlP4kN3axRgoI3px nPnGjHig3OmqWmI+mA9osUhBAcK/H6UQboqNavl9DEQx12rv0I1cUGvJyUbUDhIIW5DS1vi09y HYTwtU23t7FlF8KlSdgFoSytKELKzwINwHqb22gIZNkMTjADkoNEwlVqk7R/CuRCDz0uhi+R1u htNBp8O+vBcdG+E4LqYVcpkL4vmbCW/JPB857khYElAsoikD5fADrMO6Rqgf+AQuN3bndp3QNx PAg= X-IronPort-AV: E=Sophos;i="5.77,476,1596528000"; d="scan'208,223";a="55158587" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 13 Nov 2020 14:33:09 -0800 IronPort-SDR: 05fo5NLI2rFNISP86GzWTrQKIDxbGOgIrtggiRMxUMbXWJ3lfxnj+vNY9OhwzrtQnsWoQYff3/ eWRHgDRjlryRcqSMiDPWGReSwJXAn8V4Me6isOiPeTeqa50Ugg0MZ7hiZyOud/bHycnY4Bfhb+ SgvFUNOmcHD+Gd3agmrW5hs5d2V19ytAKp8s3OxfZ4AynxDigP/jJERZkv8gTytt7sXonHSJqx 2zJbbhfSgNfNB5biBLADJcFqvlg09BHJNGlM28iA9tKwzyrVgPmFdPv41Sxyl4lpWWPOnjDo84 GK4= From: Thomas Schwinge To: Kwok Cheung Yeung , Jakub Jelinek , Subject: In 'gcc/omp-oacc-kernels-decompose.cc', use langhook instead of accessing language-specific decl information (was: [PATCH 04/10, OpenACC] Turn OpenACC kernels regions into a sequence of, parallel regions) In-Reply-To: References: <5e191259-d5d5-34ce-7fd5-fc8d2e6d982e@codesourcery.com> <77db4d0a-0ff6-6700-9b9e-423629843ada@codesourcery.com> <20190718093036.GN2125@tucnak> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Fri, 13 Nov 2020 23:33:02 +0100 Message-ID: <871rgwdh0h.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@gcc.gnu.org Sender: "Gcc-patches" Hi! On 2019-08-05T22:51:22+0100, Kwok Cheung Yeung wrote: > On 18/07/2019 10:30 am, Jakub Jelinek wrote: >> On Wed, Jul 17, 2019 at 10:06:07PM +0100, Kwok Cheung Yeung wrote: >>> --- a/gcc/omp-oacc-kernels.c >>> +++ b/gcc/omp-oacc-kernels.c >>> @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see >>> #include "backend.h" >>> #include "target.h" >>> #include "tree.h" >>> +#include "cp/cp-tree.h" >> >> No, you certainly don't want to do this. Use langhooks if needed ACK. >> though >> that can be only for stuff done before IPA. After IPA, because of LTO FE, you >> must not rely on anything that is not in the IL generically. ACK, and this is very early: NEXT_PASS (pass_diagnose_omp_blocks); NEXT_PASS (pass_diagnose_tm_blocks); + NEXT_PASS (pass_omp_oacc_kernels_decompose); NEXT_PASS (pass_lower_omp); > I have modified the patch to use the get_generic_function_decl langhook > to determine whether current_function_decl is an instantiation of a > template (in this case, we don't care what the generic decl is - just > whether the function decl has one). To me, it's not obvious that the original: (DECL_LANG_SPECIFIC (current_function_decl) && DECL_TEMPLATE_INSTANTIATION (current_function_decl))) ... may be replaced with: (lang_hooks.decls.get_generic_function_decl (current_function_decl) != NULL) ..., so thanks, Kwok, that you've figured that out. :-) I've just pushed to master branch commit ccd56db89806a5f6eb3be99fc3b4fe364cf35e98 "In 'gcc/omp-oacc-kernels-decompose.cc', use langhook instead of accessing language-specific decl information", see attached. Grüße Thomas ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter From ccd56db89806a5f6eb3be99fc3b4fe364cf35e98 Mon Sep 17 00:00:00 2001 From: Kwok Cheung Yeung Date: Mon, 5 Aug 2019 22:51:22 +0100 Subject: [PATCH] In 'gcc/omp-oacc-kernels-decompose.cc', use langhook instead of accessing language-specific decl information gcc/ * omp-oacc-kernels-decompose.cc (maybe_build_inner_data_region): Use langhook instead of accessing language-specific decl information. --- gcc/omp-oacc-kernels-decompose.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gcc/omp-oacc-kernels-decompose.cc b/gcc/omp-oacc-kernels-decompose.cc index c585e5d092b..baad1b9a348 100644 --- a/gcc/omp-oacc-kernels-decompose.cc +++ b/gcc/omp-oacc-kernels-decompose.cc @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "backend.h" #include "target.h" #include "tree.h" -#include "cp/cp-tree.h" +#include "langhooks.h" #include "gimple.h" #include "tree-pass.h" #include "cgraph.h" @@ -792,6 +792,12 @@ static gimple * maybe_build_inner_data_region (location_t loc, gimple *body, tree inner_bind_vars, gimple *inner_cleanup) { + /* Is this an instantiation of a template? (In this case, we don't care what + the generic decl is - just whether the function decl has one.) */ + bool generic_inst_p + = (lang_hooks.decls.get_generic_function_decl (current_function_decl) + != NULL); + /* Build data 'create (var)' clauses for these local variables. Below we will add these to a data region enclosing the entire body of the decomposed kernels region. */ @@ -802,8 +808,7 @@ maybe_build_inner_data_region (location_t loc, gimple *body, next = TREE_CHAIN (v); if (DECL_ARTIFICIAL (v) || TREE_CODE (v) == CONST_DECL - || (DECL_LANG_SPECIFIC (current_function_decl) - && DECL_TEMPLATE_INSTANTIATION (current_function_decl))) + || generic_inst_p) { /* If this is an artificial temporary, it need not be mapped. We move its declaration into the bind inside the data region. -- 2.17.1