From patchwork Mon Jun 19 21:17:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 110162 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3255422vqr; Mon, 19 Jun 2023 14:20:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mcW7uoZ1B6YWPrC4upAw17j6ZhOEjxccrxuYM9fmKafElaNAQ53o2wWnPb/L65HMHPOJE X-Received: by 2002:a17:907:1613:b0:983:c441:67e8 with SMTP id hb19-20020a170907161300b00983c44167e8mr9991929ejc.41.1687209603586; Mon, 19 Jun 2023 14:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687209603; cv=none; d=google.com; s=arc-20160816; b=y4UlULHPtNC78dVQLWX1zTjlFeV9N0MgR9FKJwJxez0Wci4FGM13imR33Q4zhbOj7j eXpQ9wbk/IIm3xKKrKwYxi2qwy3tlTZPdwFyCDnvEiSFeGOkbIsQXvk3yStww7/0wZ8a 2sAapcJfcFWDXLpJqFQFz2OKj9VqIEqJCR+Mk0C2S9V1aIpL8gTh6j8hRHEVf53bLXdf rVmvRsvfq5A6BvW8NTBeHWRX/kUS38FpM1Mrfd6jHWHt3KSc4osRSLAMlh/S5Ku+THlv EfIhSptf8a9OeEvuCBrvcNfpt4EMyAu8kBq1Fu7yj+D6hje7C+06g6jhg9yxMtI37CAI KLAw== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:ironport-sdr:dmarc-filter:delivered-to; bh=ENyJmGViK6wValamJiLH+YqLL+U4wUPsLlWMdM7XIt4=; b=cfKIUAZ5WXoLPZAe4I9jll1WIGBTE7YKiKt1AOvKEgD3zA40PTWBUEJf9xHH3BMOL7 JZMJ6KXR9LnIEMtB80BSVCnJ0Imo3EB2sqYraXw+zG18Gs1IYUfBUVOgbNt+eWyqz5GT At/xN3SmGrZ/+yBieqQhFZUwQH+IRqAXwBd1NR0YO63hV2tHdMUmFHqh5CKUR1tKOJAI uHZIU3XQeBfMWUFF/sAI+TTHUQU8O/nW9NBG+omnpkLcoRveN5LxRMHo61ABCM8NNDVm FWkpGXG+RwIRq1LCCaSufTjTdrSxnkbYgdpnPHWJCkfYgHHdUn44G9E9PjzrjX6130mb /HVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id c26-20020a170906171a00b00988f21df36esi198077eje.594.2023.06.19.14.20.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 14:20:03 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 2AFE43836E91 for ; Mon, 19 Jun 2023 21:18:45 +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 4DE223858D39; Mon, 19 Jun 2023 21:18:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4DE223858D39 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="6.00,255,1681200000"; d="scan'208";a="9264338" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 19 Jun 2023 13:17:58 -0800 IronPort-SDR: XVlzw2kUH2wDYqfubv7eny+yHTDONA/4UGrKYip+8qpx/NNPz6Mv/gpyFXd8Opm2vF0gfq7PrA ERP/lOxkLVkQjv3Mbpn7HmGrg0QRsbFEY/RNXc+OyGRS+z8C8l29HkVeLCMQvl1ht5xxiF74fM 0ZmiDDu3tCCxL/pHpqCz1Ych2CSzstIXU3NGRfAOA35CpuqnJf6PUCIH6DHYp3rrp89uaMckGn clYbZhGZaKitr+cELp3O2WJxUt63cXDGTYiVM+AIcTR8FWpSGBacOKivd/Ax8KiJikhsudKN8O AbQ= From: Julian Brown To: CC: , , Subject: [PATCH 02/14] Revert "Fix references declared in lexically-enclosing OpenACC data region" Date: Mon, 19 Jun 2023 21:17:26 +0000 Message-ID: <82b9a9c54f5ccea9b47afa4d4725241675a13228.1687201315.git.julian@codesourcery.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-11.mgc.mentorg.com (139.181.222.11) X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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?1769167497091147119?= X-GMAIL-MSGID: =?utf-8?q?1769167497091147119?= This reverts commit c9cd2bac6a5127a01c6f47e5636a926ac39b5e21. 2023-06-16 Julian Brown gcc/fortran/ Revert: * trans-openmp.cc (gfc_omp_finish_clause): Guard addition of clauses for pointers with DECL_P. gcc/ Revert: * gimplify.cc (oacc_array_mapping_info): Add REF field. (gimplify_scan_omp_clauses): Initialise above field for data blocks passed by reference. (gomp_oacc_needs_data_present): Handle references. (gimplify_adjust_omp_clauses_1): Handle references and optional arguments for variables declared in lexically-enclosing OpenACC data region. --- gcc/fortran/trans-openmp.cc | 2 +- gcc/gimplify.cc | 55 +++++-------------------------------- 2 files changed, 8 insertions(+), 49 deletions(-) diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index e55c8292d05..96e91a3bc50 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -1611,7 +1611,7 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p, bool openacc) tree c2 = NULL_TREE, c3 = NULL_TREE, c4 = NULL_TREE; tree present = gfc_omp_check_optional_argument (decl, true); tree orig_decl = NULL_TREE; - if (DECL_P (decl) && POINTER_TYPE_P (TREE_TYPE (decl))) + if (POINTER_TYPE_P (TREE_TYPE (decl))) { if (!gfc_omp_privatize_by_reference (decl) && !GFC_DECL_GET_SCALAR_POINTER (decl) diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 3729b986801..80f1f3a657f 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -227,7 +227,6 @@ struct oacc_array_mapping_info tree mapping; tree pset; tree pointer; - tree ref; }; struct gimplify_omp_ctx @@ -11248,9 +11247,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, } if (base_ptr && OMP_CLAUSE_CODE (base_ptr) == OMP_CLAUSE_MAP - && !(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP - && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALLOC - || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER)) && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET && ((OMP_CLAUSE_MAP_KIND (base_ptr) == GOMP_MAP_FIRSTPRIVATE_POINTER) @@ -11269,19 +11265,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, ai.mapping = unshare_expr (c); ai.pset = pset ? unshare_expr (pset) : NULL; ai.pointer = unshare_expr (base_ptr); - ai.ref = NULL_TREE; - if (TREE_CODE (base_addr) == INDIRECT_REF - && (TREE_CODE (TREE_TYPE (TREE_OPERAND (base_addr, 0))) - == REFERENCE_TYPE)) - { - base_addr = TREE_OPERAND (base_addr, 0); - tree ref_clause = OMP_CLAUSE_CHAIN (base_ptr); - gcc_assert ((OMP_CLAUSE_CODE (ref_clause) - == OMP_CLAUSE_MAP) - && (OMP_CLAUSE_MAP_KIND (ref_clause) - == GOMP_MAP_POINTER)); - ai.ref = unshare_expr (ref_clause); - } ctx->decl_data_clause->put (base_addr, ai); } if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE) @@ -12464,15 +12447,11 @@ gomp_oacc_needs_data_present (tree decl) && gimplify_omp_ctxp->region_type != ORT_ACC_KERNELS) return NULL; - tree type = TREE_TYPE (decl); - if (TREE_CODE (type) == REFERENCE_TYPE) - type = TREE_TYPE (type); - - if (TREE_CODE (type) != ARRAY_TYPE - && TREE_CODE (type) != POINTER_TYPE - && TREE_CODE (type) != RECORD_TYPE - && (TREE_CODE (type) != POINTER_TYPE - || TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE)) + if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE + && TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE + && TREE_CODE (TREE_TYPE (decl)) != RECORD_TYPE + && (TREE_CODE (TREE_TYPE (decl)) != POINTER_TYPE + || TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) != ARRAY_TYPE)) return NULL; decl = get_base_address (decl); @@ -12626,12 +12605,6 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) { tree mapping = array_info->mapping; tree pointer = array_info->pointer; - gomp_map_kind presence_kind = GOMP_MAP_FORCE_PRESENT; - bool no_alloc = (OMP_CLAUSE_CODE (mapping) == OMP_CLAUSE_MAP - && OMP_CLAUSE_MAP_KIND (mapping) == GOMP_MAP_IF_PRESENT); - - if (no_alloc || omp_check_optional_argument (decl, false)) - presence_kind = GOMP_MAP_IF_PRESENT; if (code == OMP_CLAUSE_FIRSTPRIVATE) /* Oops, we have the wrong type of clause. Rebuild it. */ @@ -12639,15 +12612,14 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) OMP_CLAUSE_MAP); OMP_CLAUSE_DECL (clause) = unshare_expr (OMP_CLAUSE_DECL (mapping)); - OMP_CLAUSE_SET_MAP_KIND (clause, presence_kind); + OMP_CLAUSE_SET_MAP_KIND (clause, GOMP_MAP_FORCE_PRESENT); OMP_CLAUSE_SIZE (clause) = unshare_expr (OMP_CLAUSE_SIZE (mapping)); /* Create a new data clause for the firstprivate pointer. */ tree nc = build_omp_clause (OMP_CLAUSE_LOCATION (clause), OMP_CLAUSE_MAP); OMP_CLAUSE_DECL (nc) = unshare_expr (OMP_CLAUSE_DECL (pointer)); - OMP_CLAUSE_SET_MAP_KIND (nc, no_alloc ? GOMP_MAP_FIRSTPRIVATE_POINTER - : GOMP_MAP_POINTER); + OMP_CLAUSE_SET_MAP_KIND (nc, GOMP_MAP_POINTER); /* For GOMP_MAP_FIRSTPRIVATE_POINTER, this is a bias, not a size. */ OMP_CLAUSE_SIZE (nc) = unshare_expr (OMP_CLAUSE_SIZE (pointer)); @@ -12677,19 +12649,6 @@ gimplify_adjust_omp_clauses_1 (splay_tree_node n, void *data) OMP_CLAUSE_CHAIN (nc) = OMP_CLAUSE_CHAIN (clause); OMP_CLAUSE_CHAIN (clause) = psetc ? psetc : nc; - - if (array_info->ref) - { - tree refc = build_omp_clause (OMP_CLAUSE_LOCATION (clause), - OMP_CLAUSE_MAP); - OMP_CLAUSE_DECL (refc) - = unshare_expr (OMP_CLAUSE_DECL (array_info->ref)); - OMP_CLAUSE_SIZE (refc) - = unshare_expr (OMP_CLAUSE_SIZE (array_info->ref)); - OMP_CLAUSE_SET_MAP_KIND (refc, GOMP_MAP_POINTER); - OMP_CLAUSE_CHAIN (refc) = OMP_CLAUSE_CHAIN (nc); - OMP_CLAUSE_CHAIN (nc) = refc; - } } else if (code == OMP_CLAUSE_FIRSTPRIVATE && (flags & GOVD_EXPLICIT) == 0) OMP_CLAUSE_FIRSTPRIVATE_IMPLICIT (clause) = 1;