From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id A35673858D1E for ; Tue, 18 Apr 2023 19:22:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A35673858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33IEnKc4016673 for ; Tue, 18 Apr 2023 12:22:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Z7gZV8i7DucFazXQ7I9UOeEhaWclZRTHp0ZA1lW/QUA=; b=dHG/Etc6tLhEJAko4KT+XjyPQsXwWYRIWu1/GqXGEYOYhO5YKnDbKqYwgGPbVDoBjXZw WVr2CkM4GCpxjdOg6d9nT68e8ZKPMQbyoJEUOMDD5+pOsj+f52izqEJc9wt7Nw7OCA0D WxT+Oag54SPhHcOgKd5oTDWW8TIsB+pnHRan4mEi04xTQyOpxnkZdQ17jOytHmVAZ9Vw LLr5cxLI9Z8QYR1RaqNj6d+Q5YTqeYnPyP7zJi7yZrEvriQ2D0pm1KL0w81Eq2U/iOWo JLUmseQkUi51RMRKTB9WGADvOsME+7jx0nju6yS4zgrSRIkTdv5dsQwBEUf/OQ5W5f+k zA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q1hf3xnsq-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 18 Apr 2023 12:22:01 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 12:22:00 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 18 Apr 2023 12:22:00 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id F236E5B6921; Tue, 18 Apr 2023 12:21:59 -0700 (PDT) From: Andrew Pinski To: CC: Andrew Pinski Subject: [PATCH] PHIOPT: Move tree_ssa_cs_elim into pass_cselim::execute. Date: Tue, 18 Apr 2023 12:21:36 -0700 Message-ID: <20230418192136.286589-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: HygLcX17tr_9gkLhh_PaBw3jc7ZEFam7 X-Proofpoint-GUID: HygLcX17tr_9gkLhh_PaBw3jc7ZEFam7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-18_14,2023-04-18_01,2023-02-09_01 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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 List-Id: This moves around the code for tree_ssa_cs_elim slightly improving code readability and removing declarations that are no longer needed. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Remove declaration. (make_pass_phiopt): Make execute out of line. (tree_ssa_cs_elim): Move code into ... (pass_cselim::execute): here. --- gcc/tree-ssa-phiopt.cc | 118 ++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 61 deletions(-) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 616b5778602..945507be11e 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-propagate.h" #include "tree-ssa-dce.h" -static unsigned int tree_ssa_phiopt_worker (bool, bool, bool); static bool two_value_replacement (basic_block, basic_block, edge, gphi *, tree, tree); static bool match_simplify_replacement (basic_block, basic_block, @@ -78,62 +77,6 @@ static hash_set * get_non_trapping (); static void hoist_adjacent_loads (basic_block, basic_block, basic_block, basic_block); -/* This pass tries to transform conditional stores into unconditional - ones, enabling further simplifications with the simpler then and else - blocks. In particular it replaces this: - - bb0: - if (cond) goto bb2; else goto bb1; - bb1: - *p = RHS; - bb2: - - with - - bb0: - if (cond) goto bb1; else goto bb2; - bb1: - condtmp' = *p; - bb2: - condtmp = PHI - *p = condtmp; - - This transformation can only be done under several constraints, - documented below. It also replaces: - - bb0: - if (cond) goto bb2; else goto bb1; - bb1: - *p = RHS1; - goto bb3; - bb2: - *p = RHS2; - bb3: - - with - - bb0: - if (cond) goto bb3; else goto bb1; - bb1: - bb3: - condtmp = PHI - *p = condtmp; */ - -static unsigned int -tree_ssa_cs_elim (void) -{ - unsigned todo; - /* ??? We are not interested in loop related info, but the following - will create it, ICEing as we didn't init loops with pre-headers. - An interfacing issue of find_data_references_in_bb. */ - loop_optimizer_init (LOOPS_NORMAL); - scev_initialize (); - todo = tree_ssa_phiopt_worker (true, false, false); - scev_finalize (); - loop_optimizer_finalize (); - return todo; -} - /* Return the singleton PHI in the SEQ of PHIs for edges E0 and E1. */ static gphi * @@ -4278,6 +4221,47 @@ make_pass_phiopt (gcc::context *ctxt) return new pass_phiopt (ctxt); } +/* This pass tries to transform conditional stores into unconditional + ones, enabling further simplifications with the simpler then and else + blocks. In particular it replaces this: + + bb0: + if (cond) goto bb2; else goto bb1; + bb1: + *p = RHS; + bb2: + + with + + bb0: + if (cond) goto bb1; else goto bb2; + bb1: + condtmp' = *p; + bb2: + condtmp = PHI + *p = condtmp; + + This transformation can only be done under several constraints, + documented below. It also replaces: + + bb0: + if (cond) goto bb2; else goto bb1; + bb1: + *p = RHS1; + goto bb3; + bb2: + *p = RHS2; + bb3: + + with + + bb0: + if (cond) goto bb3; else goto bb1; + bb1: + bb3: + condtmp = PHI + *p = condtmp; */ + namespace { const pass_data pass_data_cselim = @@ -4302,10 +4286,7 @@ public: /* opt_pass methods: */ bool gate (function *) final override { return flag_tree_cselim; } - unsigned int execute (function *) final override - { - return tree_ssa_cs_elim (); - } + unsigned int execute (function *) final override; }; // class pass_cselim @@ -4316,3 +4297,18 @@ make_pass_cselim (gcc::context *ctxt) { return new pass_cselim (ctxt); } + +unsigned int +pass_cselim::execute (function *) +{ + unsigned todo; + /* ??? We are not interested in loop related info, but the following + will create it, ICEing as we didn't init loops with pre-headers. + An interfacing issue of find_data_references_in_bb. */ + loop_optimizer_init (LOOPS_NORMAL); + scev_initialize (); + todo = tree_ssa_phiopt_worker (true, false, false); + scev_finalize (); + loop_optimizer_finalize (); + return todo; +} -- 2.39.1