From patchwork Wed Apr 19 21:36:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 85570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp679418vqo; Wed, 19 Apr 2023 14:38:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bXdeptnxz7nZrk2ekod+XCpLf+bG1WFzqlGp8PtWFFpBKff0xpL5gBq1M9IBjXtm22wIZo X-Received: by 2002:a17:906:fc04:b0:94a:96c4:2361 with SMTP id ov4-20020a170906fc0400b0094a96c42361mr18645869ejb.73.1681940293097; Wed, 19 Apr 2023 14:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681940293; cv=none; d=google.com; s=arc-20160816; b=LnEgDEjf4ZnacldTcCRwRmFkWSAjHgcr00g4Gh22AbYMqSEgpwKM+qz3yGWdt7NBSC bS+PvIT/RGt2Zyf2/FwPt2uhm6/rI+bptANAB2XmDz9uSU7xqYwLg4/q316nydJOCF7X ZVS/Jp6WXnepTy7BmSIg96gw1tt8EP/+a1NBopYBHeP+kB4MgyS7UN/03ZeKry7UAH15 AygquEQCNPe8vkGRhIHQNkr9954AwBYZltNZTUVKsRYgiupiajetpuYE+p9wrYDD6pPj YXf13bBoKk7Pyre4cxaEhqlBN8C8WlAv90DBTNjOwLulBKJYQS8RWk8dkX/zpun6F9vt VKsw== 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:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=q0vsRAuD6UDd8g+yJL+lyQh1kQJfRP248gVssaX13iY=; b=CYqeGrXk0imzmb/JSvVxG1/BQIxPn2ePw8mSaNqeBjcXuZ3a2nlQsLE8GOc+0erUf2 C9VaJkde+m/A1a8WZry8ee6ZLo1pL6HbXgfbJ5JcYTBJ2HZKQ9n89vNXoumktxa8/b28 LEK64F6l+wFVgr6ozfgJR08rzhc70V1lX5GfGf++BkqhGsyF/v+wh5LDV4XpA7UFfXUd gCZk+Fv/IR/A/43wXbnnK57g/yXpjr2wd9JDXhnDbndjWQj6v2JNYHsTCwih0Ygmtg4i 4ayTxcfuTPPTPdhl3/6gPV6C72lzVrCZMT6cWXllcwVfYX3EpTKYSW+vmL2MG87GvycG suEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=H3A4EvVG; 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 bp6-20020a170907918600b0094ec92514b1si14380097ejb.103.2023.04.19.14.38.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 14:38:13 -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=H3A4EvVG; 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 0C8223858416 for ; Wed, 19 Apr 2023 21:38:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C8223858416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681940292; bh=q0vsRAuD6UDd8g+yJL+lyQh1kQJfRP248gVssaX13iY=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=H3A4EvVG5TJIxM9yKlMvQvk173W717vsYu8h67f/63j2Qeq+vvxyiX/nQHtE5x2lV 54MKhc9zUUPAAnUZjM2EYijI2aPqDjFReu57ETlSRdXlytZqDEQe4rh7wtbz3l7SNA DRy46mh3gEUN1De/aIDrqrXb54W9Fs2bQX/MTeOg= 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 9859A3858D33 for ; Wed, 19 Apr 2023 21:37:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9859A3858D33 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 33JKc3aP004344 for ; Wed, 19 Apr 2023 14:37:27 -0700 Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q2mwyh8w5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 19 Apr 2023 14:37:27 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 19 Apr 2023 14:37:25 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 19 Apr 2023 14:37:25 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 064633F7091; Wed, 19 Apr 2023 14:37:21 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH] PHIOPT: Improve minmax diamond detection for phiopt1 Date: Wed, 19 Apr 2023 14:36:35 -0700 Message-ID: <20230419213635.329198-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 8CP4UwLl7zs95FALE_CCcv4nFpJPqx1y X-Proofpoint-GUID: 8CP4UwLl7zs95FALE_CCcv4nFpJPqx1y 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-19_14,2023-04-18_01,2023-02-09_01 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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?1763642224445497935?= X-GMAIL-MSGID: =?utf-8?q?1763642224445497935?= For diamond bb phi node detection, there is a check to make sure bb1 is not empty. But in the case where bb1 is empty except for a predicate, empty_block_p will still return true but the minmax code handles that case already so there is no reason to check if the basic block is empty. This patch removes that check and removes some xfails. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Remove check on empty_block_p. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-5.c: Remvoe some xfail. --- gcc/testsuite/gcc.dg/tree-ssa/phi-opt-5.c | 10 +++++----- gcc/tree-ssa-phiopt.cc | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-5.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-5.c index 5a00f3ddf8c..5f78a1ba6dc 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-5.c @@ -16,9 +16,9 @@ float repl1 (float varx) varx_4 = MIN_EXPR <1.0e+0, varx_2>; varx_5 = MAX_EXPR ; */ -/* phiopt1 confused by predictors. */ -/* { dg-final { scan-tree-dump "varx.*MIN_EXPR.*1\\.0" "phiopt1" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump "varx.*MAX_EXPR.*0\\.0" "phiopt1" { xfail *-*-* } } } */ +/* phiopt1 was confused by predictors. */ +/* { dg-final { scan-tree-dump "varx.*MIN_EXPR.*1\\.0" "phiopt1" } } */ +/* { dg-final { scan-tree-dump "varx.*MAX_EXPR.*0\\.0" "phiopt1" } } */ /* { dg-final { scan-tree-dump "varx.*MIN_EXPR.*1\\.0" "phiopt2"} } */ /* { dg-final { scan-tree-dump "varx.*MAX_EXPR.*0\\.0" "phiopt2"} } */ @@ -38,7 +38,7 @@ float repl2 (float vary) vary_5 = MIN_EXPR ; */ /* phiopt1 confused by predictors. */ -/* { dg-final { scan-tree-dump "vary.*MAX_EXPR.*0\\.0" "phiopt1" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "vary.*MAX_EXPR.*0\\.0" "phiopt1" } } */ /* { dg-final { scan-tree-dump "vary.*MIN_EXPR.*1\\.0" "phiopt1" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump "vary.*MAX_EXPR.*0\\.0" "phiopt2"} } */ /* { dg-final { scan-tree-dump "vary.*MIN_EXPR.*1\\.0" "phiopt2"} } */ @@ -61,6 +61,6 @@ float repl3 (float varz, float vara, float varb) vara_6 = MAX_EXPR ; */ /* phiopt1 confused by predictors. */ -/* { dg-final { scan-tree-dump "vara.*MAX_EXPR" "phiopt1" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump "vara.*MAX_EXPR" "phiopt1" } } */ /* { dg-final { scan-tree-dump "if .*varz" "phiopt2"} } */ /* { dg-final { scan-tree-dump "vara.*MAX_EXPR" "phiopt2"} } */ diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc index 945507be11e..8c5c8d8c250 100644 --- a/gcc/tree-ssa-phiopt.cc +++ b/gcc/tree-ssa-phiopt.cc @@ -209,8 +209,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p) hoist_adjacent_loads (bb, bb1, bb2, bb3); continue; } - else if (EDGE_SUCC (bb1, 0)->dest == EDGE_SUCC (bb2, 0)->dest - && !empty_block_p (bb1)) + else if (EDGE_SUCC (bb1, 0)->dest == EDGE_SUCC (bb2, 0)->dest) { diamond_p = true; e2 = EDGE_SUCC (bb2, 0);