From patchwork Mon May 16 12:20:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 54033 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C098A3856DDC for ; Mon, 16 May 2022 12:22:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C098A3856DDC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652703728; bh=OwopL39UG6bVwg6q9CAp8WfM0DIm1pf11WVkFIxQMBw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=W7pyx3KcqAzD1FBEs+qjc7mayGJYG3tgT4dqa+86cBAwcFozbYUpxrw7sQmEWcz5c Q1zoJW/ViXWv98JkelzMCAOMxUmDiG4zx1tT9lveprR09cmfBEVsrqTS8O65rXRK1D WjezovSICdwfCQ83pP//Q6uO8jBZhPborhsLO0SM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id E28EB3856DD1 for ; Mon, 16 May 2022 12:20:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E28EB3856DD1 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E39FF21F11 for ; Mon, 16 May 2022 12:20:51 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D23FC13AAB for ; Mon, 16 May 2022 12:20:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eWplMqNBgmJUXAAAMHmgww (envelope-from ) for ; Mon, 16 May 2022 12:20:51 +0000 Date: Mon, 16 May 2022 14:20:51 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH 2/2] Remove is_gimple_condexpr MIME-Version: 1.0 Message-Id: <20220516122051.D23FC13AAB@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This removes is_gimple_condexpr, note the vectorizer via patterns still creates COND_EXPRs with embedded GENERIC conditions and has a reference to the function in comments. Otherwise is_gimple_condexpr is now equal to is_gimple_val. Bootstrap and regtest running on x86_64-unknown-linux-gnu. Richard. 2022-05-16 Richard Biener * gimple-expr.cc (is_gimple_condexpr): Remove. * gimple-expr.h (is_gimple_condexpr): Likewise. * gimplify.cc (gimplify_expr): Remove is_gimple_condexpr usage. * tree-if-conv.cc (set_bb_predicate): Likewie. (add_to_predicate_list): Likewise. (gen_phi_arg_condition): Likewise. (predicate_scalar_phi): Likewise. (predicate_statements): Likewise. --- gcc/gimple-expr.cc | 11 ----------- gcc/gimple-expr.h | 1 - gcc/gimplify.cc | 1 - gcc/tree-if-conv.cc | 33 ++++++++++++++------------------- 4 files changed, 14 insertions(+), 32 deletions(-) diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc index 09eac80ae1c..c9c7285efbc 100644 --- a/gcc/gimple-expr.cc +++ b/gcc/gimple-expr.cc @@ -614,17 +614,6 @@ is_gimple_condexpr_1 (tree t, bool allow_traps, bool allow_cplx) && is_gimple_val (TREE_OPERAND (t, 1)))); } -/* Return true if T is a condition operand in a GIMPLE assignment - with a COND_EXPR RHS. */ - -bool -is_gimple_condexpr (tree t) -{ - /* Always split out _Complex type compares since complex lowering - doesn't handle this case. */ - return is_gimple_val (t); -} - /* Like is_gimple_condexpr, but does not allow T to trap. */ bool diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h index ba53b808437..0c3ac096ed7 100644 --- a/gcc/gimple-expr.h +++ b/gcc/gimple-expr.h @@ -40,7 +40,6 @@ extern void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *, extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *, tree *); extern bool is_gimple_lvalue (tree); -extern bool is_gimple_condexpr (tree); extern bool is_gimple_condexpr_for_cond (tree); extern bool is_gimple_address (const_tree); extern bool is_gimple_invariant_address (const_tree); diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index 38e9d62535a..d4a0366a549 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -14951,7 +14951,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, gcc_assert (fallback & (fb_rvalue | fb_lvalue)); else if (gimple_test_f == is_gimple_val || gimple_test_f == is_gimple_call_addr - || gimple_test_f == is_gimple_condexpr || gimple_test_f == is_gimple_condexpr_for_cond || gimple_test_f == is_gimple_mem_rhs || gimple_test_f == is_gimple_mem_rhs_or_call diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc index 5b884aae3d6..2245b6bfd7c 100644 --- a/gcc/tree-if-conv.cc +++ b/gcc/tree-if-conv.cc @@ -244,8 +244,8 @@ static inline void set_bb_predicate (basic_block bb, tree cond) { gcc_assert ((TREE_CODE (cond) == TRUTH_NOT_EXPR - && is_gimple_condexpr (TREE_OPERAND (cond, 0))) - || is_gimple_condexpr (cond)); + && is_gimple_val (TREE_OPERAND (cond, 0))) + || is_gimple_val (cond)); ((struct bb_predicate *) bb->aux)->predicate = cond; } @@ -544,10 +544,10 @@ add_to_predicate_list (class loop *loop, basic_block bb, tree nc) tp = &TREE_OPERAND (bc, 0); else tp = &bc; - if (!is_gimple_condexpr (*tp)) + if (!is_gimple_val (*tp)) { gimple_seq stmts; - *tp = force_gimple_operand_1 (*tp, &stmts, is_gimple_condexpr, NULL_TREE); + *tp = force_gimple_operand (*tp, &stmts, true, NULL_TREE); add_bb_predicate_gimplified_stmts (bb, stmts); } set_bb_predicate (bb, bc); @@ -1884,16 +1884,14 @@ gen_phi_arg_condition (gphi *phi, vec *occur, cond = c; break; } - c = force_gimple_operand_gsi_1 (gsi, unshare_expr (c), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + c = force_gimple_operand_gsi (gsi, unshare_expr (c), + true, NULL_TREE, true, GSI_SAME_STMT); if (cond != NULL_TREE) { /* Must build OR expression. */ cond = fold_or_predicates (EXPR_LOCATION (c), c, cond); - cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); } else cond = c; @@ -1973,9 +1971,8 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) else cond = bb_predicate (first_edge->src); /* Gimplify the condition to a valid cond-expr conditonal operand. */ - cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); true_bb = first_edge->src; if (EDGE_PRED (bb, 1)->src == true_bb) { @@ -2074,9 +2071,8 @@ predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi) cond = TREE_OPERAND (cond, 0); } /* Gimplify the condition to a valid cond-expr conditonal operand. */ - cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); if (!(is_cond_scalar_reduction (phi, &reduc, arg0 , arg1, &op0, &op1, true, &has_nop, &nop_reduc))) rhs = fold_build_cond_expr (TREE_TYPE (res), unshare_expr (cond), @@ -2612,9 +2608,8 @@ predicate_statements (loop_p loop) rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi); if (swap) std::swap (lhs, rhs); - cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond), - is_gimple_condexpr, NULL_TREE, - true, GSI_SAME_STMT); + cond = force_gimple_operand_gsi (&gsi, unshare_expr (cond), true, + NULL_TREE, true, GSI_SAME_STMT); rhs = fold_build_cond_expr (type, unshare_expr (cond), rhs, lhs); gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi)); update_stmt (stmt);