From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1314) id 8F11E3857717; Sat, 22 Apr 2023 22:02:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8F11E3857717 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682200960; bh=N9y0ur7AtzdxPrn6wkyj5wyZ8W4XAScNHnBtZ1sUiWQ=; h=From:To:Subject:Date:From; b=LTXZmD6MLRP6kx9nb3iGk3oMB+ao9rmgzswg4eNhXzmH71cH8IHQiPQKwA5FsyDn5 YPPaR95ZfEckd4ABbYBI5//gaH3xTV3uH/+JiQhpqLIamwDC9FVpSnFBY/L0X+SIT7 Kvt5miZPelUdgsun53lxYQ8ONz9PA9HY+sbh3N/0= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Pinski To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-169] PHIOPT: Improve minmax diamond detection for phiopt1 X-Act-Checkin: gcc X-Git-Author: Andrew Pinski X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 911db256258004b2eec9a0ca3fa47f9bcb5c5856 X-Git-Newrev: 84325f1c6aa3c52600ff558c4cfd028ec07b076a Message-Id: <20230422220240.8F11E3857717@sourceware.org> Date: Sat, 22 Apr 2023 22:02:40 +0000 (GMT) List-Id: https://gcc.gnu.org/g:84325f1c6aa3c52600ff558c4cfd028ec07b076a commit r14-169-g84325f1c6aa3c52600ff558c4cfd028ec07b076a Author: Andrew Pinski Date: Wed Apr 19 10:31:20 2023 -0700 PHIOPT: Improve minmax diamond detection for phiopt1 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. Diff: --- 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);