public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PHIOPT: Improve minmax diamond detection for phiopt1
@ 2023-04-19 21:36 Andrew Pinski
  2023-04-22 21:58 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2023-04-19 21:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

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 <varx_4, 0.0>;  */  
 
-/* 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 <vary_4, 1.0e+0>;  */
 
 /* 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 <varb_5, varz_2>;  */
 
 /* 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);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PHIOPT: Improve minmax diamond detection for phiopt1
  2023-04-19 21:36 [PATCH] PHIOPT: Improve minmax diamond detection for phiopt1 Andrew Pinski
@ 2023-04-22 21:58 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2023-04-22 21:58 UTC (permalink / raw)
  To: Andrew Pinski, gcc-patches



On 4/19/23 15:36, Andrew Pinski via Gcc-patches wrote:
> 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.
OK
jeff

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-22 21:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 21:36 [PATCH] PHIOPT: Improve minmax diamond detection for phiopt1 Andrew Pinski
2023-04-22 21:58 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).