From patchwork Sat May 13 23:23:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 93623 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6015760vqo; Sat, 13 May 2023 16:27:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WCnYKDXbejiMXs0UU8nHXMSyxvzAbGV+qWzDeoazRZT89DJq5UK9whYUuxFXZs/jHLBxy X-Received: by 2002:a17:907:84d:b0:94a:7a0f:7851 with SMTP id ww13-20020a170907084d00b0094a7a0f7851mr22884720ejb.41.1684020432437; Sat, 13 May 2023 16:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684020432; cv=none; d=google.com; s=arc-20160816; b=ZmnmflMHe7AxVgTm4yFb0t+ejMqFrXLamLcAyLTrtKE+d9ovvlbDhnHN/tzBCfJHhw 955tmjQOmDvp4jfZwLdeOtT1+XA+KHViKoBy57/0PadIx752+ybxw4CvJoQ3V4WL3Ayo orRBGDOV4iPLcB0jVk0QVJ2b3rKFB6/YV7wtyqJ1aCZRqyNMKx+hLdlEkqu8nQgRnvDd 59oPxZexH24TQEchTGIjXLUim/OI8dZHF7a3PgB73SOng1Z2aOUdWrdBZshG9lhvmtpq BgKZqPxAN90TITjxq550d8Xi3NB+B6POPkQMHfpYSb2JVh+zp76Ar4DDlZqgTal+I3OZ 6lqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from: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:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=f14T0/nVhMTgqVhsbp1z+xmpjY0LXEs331MLA0nIxG8=; b=xOfrFpkZWNHxvlDtwnONeP3iGSOaNXW9xtLmtQOCd25fTSS/ABu8b4oAigHey8CDqA mAFSG7FCvVBJqgZKWUDpPOyKmHv7CzaG4GIvz9UBJLbeeIPcmQ5RQ07WBeJqQTIwrTsN 0DStNNJ5xujp4AHlLJOI67HwCrl7l2rgnssnPfonS7zLECaLhYcMS9Efg9qK+b/iJV7q U37JDCiBNHW5JTZI9GBJecD/7UwaTrJTHTTjTXQWSnw70KO5h12I7FpLxdGVeLUeXT/l CArrMS3lz1OWk385kVbb/aoRMZVNGujxtDa5ymEIuWb1baMn/147LQdEZxvLvFdc+XSb UNjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gSFGLYi0; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m11-20020a1709060d8b00b0096593ab31bfsi10385316eji.639.2023.05.13.16.27.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:27:12 -0700 (PDT) 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; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gSFGLYi0; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BAB5538768BC for ; Sat, 13 May 2023 23:25:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BAB5538768BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684020331; bh=f14T0/nVhMTgqVhsbp1z+xmpjY0LXEs331MLA0nIxG8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=gSFGLYi08ojgwA08c7LLY26Yv3tpp4FopeWYsyHNgS63iev6i8i++zL0HUzHcPBbR vqN6spaYcp6t2BHhOBM1pkSeAPd37F+fbl/7/nmYaIzlYV1+4ptTU7TGn3daBbxXnq Ty4NLiDkdBvI95zhxPfIO3Wb/yD6PFgOgIgnbzRA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by sourceware.org (Postfix) with ESMTPS id 190CD3856DFC; Sat, 13 May 2023 23:23:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 190CD3856DFC Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-9659e9bbff5so2094459766b.1; Sat, 13 May 2023 16:23:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684020236; x=1686612236; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f14T0/nVhMTgqVhsbp1z+xmpjY0LXEs331MLA0nIxG8=; b=hueOFX4uhZVBYm1auVsot85jG9cBEMqlBTdpJk+86GnuUe8QXPkqecrVayTz0+6Ut1 OUlA5bjaOGfoZjJBxvuRpmxMENncJUVhdQ7dBuqUrVP+5Hw4qOYxU9P9KOJ0CuYnv5LM NkOBrgQ+t4IrSp+li82GQTMZMtnDU/O5fHtMfzSK58CDYE/uULWjew9NfOfS8yMEZZ40 srsrBCQmqVAcOSQgYJLQQMjpX6kQoavktrF/SEFhTr5jf9R04qJC3w+yNeTy9IMEeU/N ++qvCwzIM3EvhZN3gYpy1nWzbHIu1Yghz1DSfSSyjRg5d9gUe7uoykLlufPa3BisThQj +sjQ== X-Gm-Message-State: AC+VfDxcXIu9TF0lTL3TN/+ZCBBw96Ng8f/hPiQ0LZmlL+IWdo3cOTUY ORu865B1+1Xtn76MMLDwuWE09uf55cM= X-Received: by 2002:a17:907:360c:b0:966:23e5:c8f7 with SMTP id bk12-20020a170907360c00b0096623e5c8f7mr23770130ejc.62.1684020236294; Sat, 13 May 2023 16:23:56 -0700 (PDT) Received: from nbbrfq ([2001:871:227:ce8b:afc3:c345:e1dd:564e]) by smtp.gmail.com with ESMTPSA id s15-20020a056402164f00b0050d56dffc93sm5527893edx.12.2023.05.13.16.23.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 May 2023 16:23:50 -0700 (PDT) Received: from b by nbbrfq with local (Exim 4.96) (envelope-from ) id 1pxyaa-001An3-0h; Sun, 14 May 2023 01:23:48 +0200 To: gcc-patches@gcc.gnu.org Cc: Bernhard Reutner-Fischer Subject: [PATCH 13/14] omp: use _P() defines from tree.h Date: Sun, 14 May 2023 01:23:20 +0200 Message-Id: <20230513232321.279733-14-rep.dot.nop@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com> References: <20230513232321.279733-1-rep.dot.nop@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, 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: , X-Patchwork-Original-From: Bernhard Reutner-Fischer via Gcc-patches From: Bernhard Reutner-Fischer Reply-To: Bernhard Reutner-Fischer 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?1765823409333884842?= X-GMAIL-MSGID: =?utf-8?q?1765823409333884842?= From: Bernhard Reutner-Fischer gcc/ChangeLog: * omp-low.cc (scan_sharing_clauses): Use _P() defines from tree.h. (lower_reduction_clauses): Ditto. (lower_send_clauses): Ditto. (lower_omp_task_reductions): Ditto. * omp-oacc-neuter-broadcast.cc (install_var_field): Ditto. (worker_single_copy): Ditto. * omp-offload.cc (oacc_rewrite_var_decl): Ditto. * omp-simd-clone.cc (plausible_type_for_simd_clone): Ditto. --- gcc/omp-low.cc | 36 ++++++++++++++++---------------- gcc/omp-oacc-neuter-broadcast.cc | 10 ++++----- gcc/omp-offload.cc | 2 +- gcc/omp-simd-clone.cc | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index dddf5b59d8f..9db33d2a48b 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -1267,7 +1267,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) tree t = TREE_OPERAND (decl, 0); if (TREE_CODE (t) == POINTER_PLUS_EXPR) t = TREE_OPERAND (t, 0); - if (TREE_CODE (t) == INDIRECT_REF + if (INDIRECT_REF_P (t) || TREE_CODE (t) == ADDR_EXPR) t = TREE_OPERAND (t, 0); if (is_omp_target (ctx->stmt)) @@ -1276,7 +1276,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) { gcc_assert (DECL_HAS_VALUE_EXPR_P (t)); t = DECL_VALUE_EXPR (t); - gcc_assert (TREE_CODE (t) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (t)); t = TREE_OPERAND (t, 0); gcc_assert (DECL_P (t)); } @@ -1383,7 +1383,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) } else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) { - if (TREE_CODE (decl) == INDIRECT_REF) + if (INDIRECT_REF_P (decl)) decl = TREE_OPERAND (decl, 0); install_var_field (decl, true, 3, ctx); } @@ -1457,7 +1457,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); install_var_local (decl2, ctx); @@ -1467,7 +1467,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) case OMP_CLAUSE_HAS_DEVICE_ADDR: decl = OMP_CLAUSE_DECL (c); - while (TREE_CODE (decl) == INDIRECT_REF + while (INDIRECT_REF_P (decl) || TREE_CODE (decl) == ARRAY_REF) decl = TREE_OPERAND (decl, 0); goto do_private; @@ -1635,7 +1635,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) == GOMP_MAP_FIRSTPRIVATE_REFERENCE))) { if (TREE_CODE (decl) == COMPONENT_REF - || (TREE_CODE (decl) == INDIRECT_REF + || (INDIRECT_REF_P (decl) && TREE_CODE (TREE_OPERAND (decl, 0)) == COMPONENT_REF && (((TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0))) == REFERENCE_TYPE) @@ -1646,7 +1646,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); install_var_local (decl2, ctx); @@ -1660,7 +1660,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); install_var_field (decl2, true, 3, ctx); @@ -1802,7 +1802,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) decl = OMP_CLAUSE_DECL (c); if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR) { - while (TREE_CODE (decl) == INDIRECT_REF + while (INDIRECT_REF_P (decl) || TREE_CODE (decl) == ARRAY_REF) decl = TREE_OPERAND (decl, 0); } @@ -1815,7 +1815,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && is_gimple_omp_offloaded (ctx->stmt)) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); install_var_local (decl2, ctx); @@ -1902,7 +1902,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { tree decl2 = DECL_VALUE_EXPR (decl); - gcc_assert (TREE_CODE (decl2) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (decl2)); decl2 = TREE_OPERAND (decl2, 0); gcc_assert (DECL_P (decl2)); fixup_remapped_decl (decl2, ctx, false); @@ -7772,7 +7772,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, context e.g. on orphaned loop construct. Pretend this is private variable's outer reference. */ ccode = OMP_CLAUSE_PRIVATE; - if (TREE_CODE (var) == INDIRECT_REF) + if (INDIRECT_REF_P (var)) var = TREE_OPERAND (var, 0); } orig_var = var; @@ -7780,7 +7780,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, { gcc_assert (DECL_HAS_VALUE_EXPR_P (var)); var = DECL_VALUE_EXPR (var); - gcc_assert (TREE_CODE (var) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (var)); var = TREE_OPERAND (var, 0); gcc_assert (DECL_P (var)); } @@ -7853,7 +7853,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp, } /* For ref build_outer_var_ref already performs this, so only new_var needs a dereference. */ - if (TREE_CODE (d) == INDIRECT_REF) + if (INDIRECT_REF_P (d)) { new_var = build_simple_mem_ref_loc (clause_loc, new_var); gcc_assert (omp_privatize_by_reference (var) @@ -8118,7 +8118,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist, val = TREE_OPERAND (val, 0); if (TREE_CODE (val) == POINTER_PLUS_EXPR) val = TREE_OPERAND (val, 0); - if (TREE_CODE (val) == INDIRECT_REF + if (INDIRECT_REF_P (val) || TREE_CODE (val) == ADDR_EXPR) val = TREE_OPERAND (val, 0); if (is_variable_sized (val)) @@ -9351,14 +9351,14 @@ lower_omp_task_reductions (omp_context *ctx, enum tree_code code, tree clauses, tree v = var; if (TREE_CODE (var) == ADDR_EXPR) var = TREE_OPERAND (var, 0); - else if (TREE_CODE (var) == INDIRECT_REF) + else if (INDIRECT_REF_P (var)) var = TREE_OPERAND (var, 0); tree orig_var = var; if (is_variable_sized (var)) { gcc_assert (DECL_HAS_VALUE_EXPR_P (var)); var = DECL_VALUE_EXPR (var); - gcc_assert (TREE_CODE (var) == INDIRECT_REF); + gcc_assert (INDIRECT_REF_P (var)); var = TREE_OPERAND (var, 0); gcc_assert (DECL_P (var)); } @@ -9367,7 +9367,7 @@ lower_omp_task_reductions (omp_context *ctx, enum tree_code code, tree clauses, gcc_assert (TREE_CODE (v) == ADDR_EXPR); else if (TREE_CODE (v) == ADDR_EXPR) t = build_fold_addr_expr (t); - else if (TREE_CODE (v) == INDIRECT_REF) + else if (INDIRECT_REF_P (v)) t = build_fold_indirect_ref (t); if (TREE_CODE (TREE_OPERAND (decl, 0)) == POINTER_PLUS_EXPR) { diff --git a/gcc/omp-oacc-neuter-broadcast.cc b/gcc/omp-oacc-neuter-broadcast.cc index 6328253018e..779dc6b1afb 100644 --- a/gcc/omp-oacc-neuter-broadcast.cc +++ b/gcc/omp-oacc-neuter-broadcast.cc @@ -555,7 +555,7 @@ install_var_field (tree var, tree record_type, field_map_t *fields) name = get_identifier (tmp); } } - else if (TREE_CODE (var) == VAR_DECL) + else if (VAR_P (var)) { name = DECL_NAME (var); if (!name) @@ -577,7 +577,7 @@ install_var_field (tree var, tree record_type, field_map_t *fields) tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL, name, type); - if (TREE_CODE (var) == VAR_DECL && type == TREE_TYPE (var)) + if (VAR_P (var) && type == TREE_TYPE (var)) { SET_DECL_ALIGN (field, DECL_ALIGN (var)); DECL_USER_ALIGN (field) = DECL_USER_ALIGN (var); @@ -1143,7 +1143,7 @@ worker_single_copy (basic_block from, basic_block to, update_stmt (barrier_phi); } else - gcc_assert (TREE_CODE (var) == VAR_DECL); + gcc_assert (VAR_P (var)); /* If we had no record type, we will have no fields map. */ field_map_t *fields = record_field_map->get (record_type); @@ -1162,7 +1162,7 @@ worker_single_copy (basic_block from, basic_block to, gsi_insert_after (©out_gsi, recv, GSI_CONTINUE_LINKING); update_stmt (recv); - if (TREE_CODE (var) == VAR_DECL) + if (VAR_P (var)) { /* If it's a VAR_DECL, we only copied to an SSA temporary. Copy to the final location now. */ @@ -1194,7 +1194,7 @@ worker_single_copy (basic_block from, basic_block to, gimple_seq_add_stmt (&sender_seq, send); update_stmt (send); } - else if (TREE_CODE (var) == VAR_DECL) + else if (VAR_P (var)) { tree tmp = make_ssa_name (TREE_TYPE (var)); gassign *send = gimple_build_assign (tmp, var); diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc index 3bd144e9ccf..0d3c8794d54 100644 --- a/gcc/omp-offload.cc +++ b/gcc/omp-offload.cc @@ -1888,7 +1888,7 @@ oacc_rewrite_var_decl (tree *tp, int *walk_subtrees, void *data) *base = *new_decl; info->modified = true; } - else if (TREE_CODE (*tp) == VAR_DECL) + else if (VAR_P (*tp)) { tree *new_decl = info->adjusted_vars->get (*tp); if (new_decl) diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc index 03ff86e7d18..c1cb7cc8a5c 100644 --- a/gcc/omp-simd-clone.cc +++ b/gcc/omp-simd-clone.cc @@ -150,7 +150,7 @@ auto_simd_check_stmt (gimple *stmt, tree outer) static bool plausible_type_for_simd_clone (tree t) { - if (TREE_CODE (t) == VOID_TYPE) + if (VOID_TYPE_P (t)) return true; else if (RECORD_OR_UNION_TYPE_P (t) || !is_a (TYPE_MODE (t))) /* Small record/union types may fit into a scalar mode, but are