public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <apinski@marvell.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Andrew Pinski <apinski@marvell.com>
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	[thread overview]
Message-ID: <20230422220921.452264-2-apinski@marvell.com> (raw)
In-Reply-To: <20230422220921.452264-1-apinski@marvell.com>

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)
-- 
2.39.1


  reply	other threads:[~2023-04-22 22:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-22 22:09 [PATCH 0/6] Improve PHIOPT match and simplify for diamond shaped bbs Andrew Pinski
2023-04-22 22:09 ` Andrew Pinski [this message]
2023-04-24 12:01   ` [PATCH 1/6] PHIOPT: Move check on diamond bb to tree_ssa_phiopt_worker from minmax_replacement Richard Biener
2023-04-22 22:09 ` [PATCH 2/6] PHIOPT: Cleanup tree_ssa_phiopt_worker code Andrew Pinski
2023-04-24 12:06   ` Richard Biener
2023-04-22 22:09 ` [PATCH 3/6] PHIOPT: Allow other diamond uses when do_hoist_loads is true Andrew Pinski
2023-04-24 12:06   ` Richard Biener
2023-04-22 22:09 ` [PATCH 4/6] PHIOPT: Factor out some code from match_simplify_replacement Andrew Pinski
2023-04-24 12:02   ` Richard Biener
2023-04-22 22:09 ` [PATCH 5/6] PHIOPT: Ignore predicates for match-and-simplify phi-opt Andrew Pinski
2023-04-24 12:05   ` Richard Biener
2023-04-22 22:09 ` [PATCH 6/6] PHIOPT: Add support for diamond shaped bb to match_simplify_replacement Andrew Pinski
2023-04-24 12:07   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230422220921.452264-2-apinski@marvell.com \
    --to=apinski@marvell.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).