From patchwork Sat Apr 22 22:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 86639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1911394vqo; Sat, 22 Apr 2023 15:11:18 -0700 (PDT) X-Google-Smtp-Source: AKy350a21WH2/pVk09H4Wut/DabcAa4Km3pm5IIDQYt8qQwFsMlt0PkQ+aEwapqRKNernINNFfUv X-Received: by 2002:a17:906:49da:b0:94e:8556:f01c with SMTP id w26-20020a17090649da00b0094e8556f01cmr5166505ejv.57.1682201478378; Sat, 22 Apr 2023 15:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682201478; cv=none; d=google.com; s=arc-20160816; b=q1BF/uIizJSUpYslW1MVA1NPzJuxHIh0ftoQGcojPlZ9VvpRoe3NvdtHm6UgWO6SJ2 kLbKbX3N4+xzpIC94LTfrGYXLYh8LJy3KVEO+lbNAxvan8CCImrOkyiK2LqonHAEIZoB Acp78MKmh3LDteAuqsiu/pG0+J2RHKyVYsd/PsT0wDHNr/GeJ6XmV5gpZ5EtwAvZdIkA XitjlqbnZ7TUslLtN7tfQ5h5jT/LNBMQaqCX1IPsWiIY7/Rn+d+vSRbW+JT3BO6ZqLQx w1fCfr6ZCv2SegtqQKj09LOIIjtEz8IlFikpLa8Y2ZL7aRoNGtK/zet9FMbOtbzfwM/2 71eA== 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=t1tkkM7l+3H6sUhTxjiOg+MvroIu15OaF55mekNOJKw=; b=W/ZE1oyxfIXPrLA9CjnQmyHwKGu4mAkCFXbZIf5ZzDk+TWD2q/QCqYeHVLvSFqs46f XXYZuGWyfVbYTPte3FcjEQ1jyZWONSnTdmTJRR3Tm6rFEH9UH/bc1/9yRzG26WJ3/bhw yJz6J0ck7e4N+YAhfYZa2ic8K3eL3Mn7v+0w/vEtJEkVlI3BkIE9d86nXIvgO6NghOQ9 p42Ijf0fZUc1+JEmVw77P2Y/0IDmmKb2vYsfkkkHTreZX1iTrGT6qWlCw2TU9iwGJceT Bl2DwlCGo7s+XRJrTFZ9erJpYEZgebwaG7/Fu9EIe4ZAX3ncvRb1DthkydhRex334aSA lIkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="aysG/kyI"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d4-20020aa7c1c4000000b00506a69d4956si5668362edp.149.2023.04.22.15.11.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Apr 2023 15:11:18 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="aysG/kyI"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 DE0903853824 for ; Sat, 22 Apr 2023 22:10:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE0903853824 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682201429; bh=t1tkkM7l+3H6sUhTxjiOg+MvroIu15OaF55mekNOJKw=; 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=aysG/kyIHU22eBmo5fFIakpyOOPximGKn/DQjWBolIkloZjhK7BKozXAV4T3uu/Dp KVLji4jyqW4weFl2Savaj2xclIE3xgMjwRyDVfoXWQwIFPFQ/I0n5rx+eBXlbTvR38 HmOQQ+mPRKZKT3EGRSLOBSuzPsh4grMAaSnT4Ioo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id AE2FB3858C78 for ; Sat, 22 Apr 2023 22:09:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AE2FB3858C78 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 33MLGWq9006595 for ; Sat, 22 Apr 2023 15:09:43 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q4egjhp9y-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 22 Apr 2023 15:09:43 -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; Sat, 22 Apr 2023 15:09:30 -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; Sat, 22 Apr 2023 15:09:30 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 30D973F7090; Sat, 22 Apr 2023 15:09:30 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH 1/6] PHIOPT: Move check on diamond bb to tree_ssa_phiopt_worker from minmax_replacement Date: Sat, 22 Apr 2023 15:09:16 -0700 Message-ID: <20230422220921.452264-2-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230422220921.452264-1-apinski@marvell.com> References: <20230422220921.452264-1-apinski@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: eSDCWGaBSgPPCoGW8yrAfTXPgyxZrqgy X-Proofpoint-GUID: eSDCWGaBSgPPCoGW8yrAfTXPgyxZrqgy 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-22_15,2023-04-21_01,2023-02-09_01 X-Spam-Status: No, score=-14.5 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 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: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski 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?1763916097495565442?= X-GMAIL-MSGID: =?utf-8?q?1763916097495565442?= This moves the check to make sure on the diamond shaped form bbs that the the two middle bbs are only for that diamond shaped form earlier in the shared code. Also remove the redundant check for single_succ_p since that was already done before hand. The next patch will simplify the code even further and remove redundant checks. gcc/ChangeLog: * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Move the diamond form check from ... (minmax_replacement): Here. --- gcc/tree-ssa-phiopt.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index d886c88215b..296ba646e62 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -220,6 +220,14 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p) continue; } + if (diamond_p) + { + if (!single_pred_p (bb1) + || !single_pred_p (bb2) + || !single_succ_p (bb2)) + continue; + } + if (do_store_elim && !diamond_p) { /* Also make sure that bb1 only have one predecessor and that it @@ -2032,12 +2040,6 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb, basic_block alt_ tree alt_lhs, alt_op0, alt_op1; bool invert = false; - if (!single_pred_p (middle_bb) - || !single_pred_p (alt_middle_bb) - || !single_succ_p (middle_bb) - || !single_succ_p (alt_middle_bb)) - return false; - /* When THREEWAY_P then e1 will point to the edge of the final transition from middle-bb to end. */ if (true_edge == e0)