From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id D87CB3857809; Mon, 17 May 2021 13:14:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D87CB3857809 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ChungLin_Tang@mentor.com IronPort-SDR: RAh4mZ0ID62uXzwnrGbChubDkcLiR8QwHewefp5d9S3KmBALhvTuG1rD/qOh0BoubinPeVbiK7 JkB3+VKXwTFuIl7gMANuZB/GGoe4iuJM3HHO4IHpTCBBypkKKh7tKLUBxY8yMOXf9v3IX6I88q hCJYJn8+iuNjLqmx57fm3ienGA2JNy+VldbecS/9iq/vU/Xf9KTfjUSYVpYfStKiLMfaPBnw0z nHs2pCZLQmAG3bndgDxbvF3hnG7fT0R5SiiOeTX11c2Hhi1Q2xtgmJRH0uwoa3ndljc8qGT6EE dSk= X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="61286117" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 17 May 2021 05:14:34 -0800 IronPort-SDR: TqJ32W1UDD4T8FXGCgs5P3TNN3ZT8S6RUeUPBKOm/xGPymPXhvQAHRLBBXMTVPMsMx3jjUXo4V 4qHCBwQmcBHgMWbWEfLPzCFiaHZdVT27CEDXhYw+BxGYid2KRnDYgCAR287aHPthDFSUMBOz6T LVfWqW5NGyPVmeYdzZWo71bvM291kBUcDPd1hnBmgvHx4nGlHCiIrKZkV8nUYbeIzWtq5ESupE RZzYU/sEiM+nDe5BfZiDjTLwv0lizZcUcSVNFc7mfn0FfEkksYfA68uIaKW0FPd4HvKjp9Mx2w eyI= Subject: Re: [PATCH 7/7] [og10] WIP GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION changes To: Julian Brown , CC: Jakub Jelinek , Thomas Schwinge , , Tobias Burnus References: <04b90981e94acbabde004ee0992d404931e4fabf.1620721888.git.julian@codesourcery.com> From: Chung-Lin Tang Message-ID: Date: Mon, 17 May 2021 21:14:26 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <04b90981e94acbabde004ee0992d404931e4fabf.1620721888.git.julian@codesourcery.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) To svr-orw-mbx-02.mgc.mentorg.com (147.34.90.202) X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, 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: , X-List-Received-Date: Mon, 17 May 2021 13:14:40 -0000 On 2021/5/11 4:57 PM, Julian Brown wrote: > This work-in-progress patch tries to get > GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION to behave more like > GOMP_MAP_ATTACH_DETACH -- in that the mapping is made to form groups > to be processed by build_struct_group/build_struct_comp_map. I think > that's important to integrate with how groups of mappings for array > sections are handled in other cases. > > This patch isn't sufficient by itself to fix a couple of broken test cases > at present (libgomp.c++/target-lambda-1.C, libgomp.c++/target-this-4.C), > though. No, GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION is supposed to be just a slightly different behavior version of GOMP_MAP_ATTACH; it tolerates an unmapped pointer-target and assigns NULL on the device, instead of just gomp_fatal(). (see its handling in libgomp/target.c) In case OpenACC can have the same such zero-length array section behavior, we can just share one GOMP_MAP_ATTACH map. For now it is treated as separate cases. Chung-Lin > 2021-05-11 Julian Brown > > gcc/ > * gimplify.c (build_struct_comp_nodes): Add > GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION handling. > (build_struct_group): Process GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION > as part of pointer group. > (gimplify_scan_omp_clauses): Update prev_list_p such that > GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION will form part of pointer > group. > --- > gcc/gimplify.c | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > > diff --git a/gcc/gimplify.c b/gcc/gimplify.c > index 6d204908c82..c5cb486aa23 100644 > --- a/gcc/gimplify.c > +++ b/gcc/gimplify.c > @@ -8298,7 +8298,9 @@ build_struct_comp_nodes (enum tree_code code, tree grp_start, tree grp_end, > if (grp_mid > && OMP_CLAUSE_CODE (grp_mid) == OMP_CLAUSE_MAP > && (OMP_CLAUSE_MAP_KIND (grp_mid) == GOMP_MAP_ALWAYS_POINTER > - || OMP_CLAUSE_MAP_KIND (grp_mid) == GOMP_MAP_ATTACH_DETACH)) > + || OMP_CLAUSE_MAP_KIND (grp_mid) == GOMP_MAP_ATTACH_DETACH > + || (OMP_CLAUSE_MAP_KIND (grp_mid) > + == GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION))) > { > tree c3 > = build_omp_clause (OMP_CLAUSE_LOCATION (grp_end), OMP_CLAUSE_MAP); > @@ -8774,12 +8776,14 @@ build_struct_group (struct gimplify_omp_ctx *ctx, > ? splay_tree_lookup (ctx->variables, (splay_tree_key) decl) > : NULL); > bool ptr = (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ALWAYS_POINTER); > - bool attach_detach = (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH); > + bool attach_detach = (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH > + || (OMP_CLAUSE_MAP_KIND (c) > + == GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION)); > bool attach = (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH > || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_DETACH); > bool has_attachments = false; > /* For OpenACC, pointers in structs should trigger an attach action. */ > - if (attach_detach > + if (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH > && ((region_type & (ORT_ACC | ORT_TARGET | ORT_TARGET_DATA)) > || code == OMP_TARGET_ENTER_DATA > || code == OMP_TARGET_EXIT_DATA)) > @@ -9784,6 +9788,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, > if (!remove > && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ALWAYS_POINTER > && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH_DETACH > + && (OMP_CLAUSE_MAP_KIND (c) > + != GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION) > && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET > && OMP_CLAUSE_CHAIN (c) > && OMP_CLAUSE_CODE (OMP_CLAUSE_CHAIN (c)) == OMP_CLAUSE_MAP > @@ -9792,7 +9798,9 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, > || (OMP_CLAUSE_MAP_KIND (OMP_CLAUSE_CHAIN (c)) > == GOMP_MAP_ATTACH_DETACH) > || (OMP_CLAUSE_MAP_KIND (OMP_CLAUSE_CHAIN (c)) > - == GOMP_MAP_TO_PSET))) > + == GOMP_MAP_TO_PSET) > + || (OMP_CLAUSE_MAP_KIND (OMP_CLAUSE_CHAIN (c)) > + == GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION))) > prev_list_p = list_p; > > break; >