From patchwork Tue May 11 08:56:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 1476983 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=) 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 4FfWyj5ZmWz9sT6 for ; Tue, 11 May 2021 18:57:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7787F3886C58; Tue, 11 May 2021 08:57:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 1EC353886C58; Tue, 11 May 2021 08:57:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1EC353886C58 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Julian_Brown@mentor.com IronPort-SDR: CHBXtRdQwEUV3AkD6MAaOuCjXZaq2nq9ljW7Oz6aH4M/Qia92yqEk2fWzCTv93Cx2DsgW6+CGs I55oWlnK0vBPrrUHlyzbvYZt84kP8RGDrQVwhQsra4MRgv/AWSm8uVWFXnY12pYVA9Zt0n4cvy mdetQChSQRC2QoQj+8e1zngrULDL9uylE+DfdSkw7rYO3yzoxt+4xW/pWwXYv+oW6rIV2ottDE QWDYC2QzCUpAG/cUs9sro7QfyL6aNB3WLHsn9fUSPH59yDPp7aWhPTosiWK/pB/OYBxPtEcfxE yH8= X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="63457170" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 11 May 2021 00:57:09 -0800 IronPort-SDR: D9alfij0yAs5VLQ1CwYkuLUNnjrksVVb6cR62lDALfkbQ1gjrGNVCaNzZ3ZFv+YEIu2Rc9WiNC ZeBsuGK2qEbYa+bH2+drUfsI+/D0g8Nb4apaaLZaJS9hJPMUS+vV6D8sRChVgw1urAnAaNGU/p dmC3oVOEHJ8B/GUndvTPZFTdHCJ65j6HniyzrRhOBIIj5wScLjLcTaYHCHae2B8Gh63d3/k2FV IJZ7SBd7lC8Ft2qhQwuyKBPLyv+sZ3WgAs3k9WG/ADquikOgwb4fRdTjrlccNx+LYFEdAReBFG OgE= From: Julian Brown To: Subject: [PATCH 4/7] [og10] Revert gimplify.c parts of "Arrow operator handling for C front-end in OpenMP map clauses" Date: Tue, 11 May 2021 01:56:34 -0700 Message-ID: <8e978e55e80508930d32e88e563279f4ce491389.1620721888.git.julian@codesourcery.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-09.mgc.mentorg.com (139.181.222.9) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) X-Spam-Status: No, score=-12.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: , Cc: Jakub Jelinek , Tobias Burnus , fortran@gcc.gnu.org, Thomas Schwinge Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" With the "rework indirect struct handling" patch later in this series, some parts of this earlier patch (by Chung-Lin) become unnecessary. This patch reverts those bits. An XFAIL has been added for a test that fails for the time being with this reversion, until the later patch in the series fixes it again. 2021-05-11 Julian Brown gcc/ * gimplify.c (build_struct_group): Remove COMPONENT_REF_P parameter. Don't call gimplify_expr on decl in non-reference case. Remove code to add FIRSTPRIVATE_POINTER for *pointer-to-struct expressions. (gimplify_scan_omp_clauses): Remove COMPONENT_REF_P handling. gcc/testsuite/ * gcc.dg/gomp/target-3.c: XFAIL test. --- gcc/gimplify.c | 41 ++++------------------------ gcc/testsuite/gcc.dg/gomp/target-3.c | 2 +- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 0674d882861..c2072c7188f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -8686,8 +8686,7 @@ move_concat_nodes_after (tree first_new, tree *last_new_tail, tree *first_ptr, static tree build_struct_group (struct gimplify_omp_ctx *ctx, enum omp_region_type region_type, enum tree_code code, - tree decl, tree *pd, bool component_ref_p, - unsigned int *flags, tree c, + tree decl, tree *pd, unsigned int *flags, tree c, hash_map *&struct_map_to_clause, tree *&prev_list_p, tree *&list_p, gimple_seq *pre_p, bool *cont) @@ -8737,13 +8736,7 @@ build_struct_group (struct gimplify_omp_ctx *ctx, if (base_ref) OMP_CLAUSE_DECL (l) = unshare_expr (base_ref); else - { - OMP_CLAUSE_DECL (l) = unshare_expr (decl); - if (!DECL_P (OMP_CLAUSE_DECL (l)) - && (gimplify_expr (&OMP_CLAUSE_DECL (l), pre_p, NULL, - is_gimple_lvalue, fb_lvalue) == GS_ERROR)) - return error_mark_node; - } + OMP_CLAUSE_DECL (l) = decl; OMP_CLAUSE_SIZE (l) = (!attach ? size_int (1) : (DECL_P (OMP_CLAUSE_DECL (l)) @@ -8785,27 +8778,6 @@ build_struct_group (struct gimplify_omp_ctx *ctx, *flags |= GOVD_SEEN; if (has_attachments) *flags |= GOVD_MAP_HAS_ATTACHMENTS; - - /* If this is a *pointer-to-struct expression, make sure a - firstprivate map of the base-pointer exists. */ - if (component_ref_p - && ((TREE_CODE (decl) == MEM_REF - && integer_zerop (TREE_OPERAND (decl, 1))) - || INDIRECT_REF_P (decl)) - && DECL_P (TREE_OPERAND (decl, 0)) - && !splay_tree_lookup (ctx->variables, - ((splay_tree_key) TREE_OPERAND (decl, 0)))) - { - decl = TREE_OPERAND (decl, 0); - tree c2 = build_omp_clause (OMP_CLAUSE_LOCATION (c), OMP_CLAUSE_MAP); - enum gomp_map_kind mkind = GOMP_MAP_FIRSTPRIVATE_POINTER; - OMP_CLAUSE_SET_MAP_KIND (c2, mkind); - OMP_CLAUSE_DECL (c2) = decl; - OMP_CLAUSE_SIZE (c2) = size_zero_node; - OMP_CLAUSE_CHAIN (c2) = OMP_CLAUSE_CHAIN (c); - OMP_CLAUSE_CHAIN (c) = c2; - } - return decl; } else if (struct_map_to_clause) @@ -9660,9 +9632,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH) OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_ALWAYS_POINTER); if ((DECL_P (decl) - || (component_ref_p - && (INDIRECT_REF_P (decl) - || TREE_CODE (decl) == MEM_REF))) + || (component_ref_p && INDIRECT_REF_P (decl))) && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_TO_PSET && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_ATTACH && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_DETACH @@ -9710,9 +9680,8 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, bool cont = false; tree add_decl = build_struct_group (ctx, region_type, code, decl, pd, - component_ref_p, &flags, c, - struct_map_to_clause, prev_list_p, - list_p, pre_p, &cont); + &flags, c, struct_map_to_clause, + prev_list_p, list_p, pre_p, &cont); if (add_decl == error_mark_node) { remove = true; diff --git a/gcc/testsuite/gcc.dg/gomp/target-3.c b/gcc/testsuite/gcc.dg/gomp/target-3.c index 3e7921270c9..08e42eeb304 100644 --- a/gcc/testsuite/gcc.dg/gomp/target-3.c +++ b/gcc/testsuite/gcc.dg/gomp/target-3.c @@ -13,4 +13,4 @@ void foo (struct S *s) #pragma omp target enter data map (alloc: s->a, s->b) } -/* { dg-final { scan-tree-dump-times "map\\(struct:\\*s \\\[len: 2\\\]\\) map\\(alloc:s->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:s->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "map\\(struct:\\*s \\\[len: 2\\\]\\) map\\(alloc:s->a \\\[len: \[0-9\]+\\\]\\) map\\(alloc:s->b \\\[len: \[0-9\]+\\\]\\)" 2 "gimple" { xfail *-*-* } } } */