diff mbox series

[1/2] MATCH: change single_non_singleton_phi_for_edges for singleton phis

Message ID 20240428063055.3807580-1-quic_apinski@quicinc.com
State New
Headers show
Series [1/2] MATCH: change single_non_singleton_phi_for_edges for singleton phis | expand

Commit Message

Andrew Pinski April 28, 2024, 6:30 a.m. UTC
I noticed that single_non_singleton_phi_for_edges could
return a phi whos entry are all the same for the edge.
This happens only if there was a single phis in the first place.
Also gimple_seq_singleton_p walks the sequence to see if it the one
element in the sequence so there is removing that check actually
reduces the number of pointer walks needed.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

gcc/ChangeLog:

	* tree-ssa-phiopt.cc (single_non_singleton_phi_for_edges):
	Remove the special case of gimple_seq_singleton_p.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
 gcc/tree-ssa-phiopt.cc | 8 --------
 1 file changed, 8 deletions(-)

Comments

Richard Biener April 30, 2024, 8:10 a.m. UTC | #1
On Sun, Apr 28, 2024 at 8:31 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> I noticed that single_non_singleton_phi_for_edges could
> return a phi whos entry are all the same for the edge.
> This happens only if there was a single phis in the first place.
> Also gimple_seq_singleton_p walks the sequence to see if it the one
> element in the sequence so there is removing that check actually
> reduces the number of pointer walks needed.
>
> Bootstrapped and tested on x86_64-linux-gnu with no regressions.

OK.

Richard.

> gcc/ChangeLog:
>
>         * tree-ssa-phiopt.cc (single_non_singleton_phi_for_edges):
>         Remove the special case of gimple_seq_singleton_p.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
>  gcc/tree-ssa-phiopt.cc | 8 --------
>  1 file changed, 8 deletions(-)
>
> diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
> index d1746c4b468..f1e07502b02 100644
> --- a/gcc/tree-ssa-phiopt.cc
> +++ b/gcc/tree-ssa-phiopt.cc
> @@ -62,14 +62,6 @@ single_non_singleton_phi_for_edges (gimple_seq seq, edge e0, edge e1)
>  {
>    gimple_stmt_iterator i;
>    gphi *phi = NULL;
> -  if (gimple_seq_singleton_p (seq))
> -    {
> -      phi = as_a <gphi *> (gsi_stmt (gsi_start (seq)));
> -      /* Never return virtual phis.  */
> -      if (virtual_operand_p (gimple_phi_result (phi)))
> -       return NULL;
> -      return phi;
> -    }
>    for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
>      {
>        gphi *p = as_a <gphi *> (gsi_stmt (i));
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index d1746c4b468..f1e07502b02 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -62,14 +62,6 @@  single_non_singleton_phi_for_edges (gimple_seq seq, edge e0, edge e1)
 {
   gimple_stmt_iterator i;
   gphi *phi = NULL;
-  if (gimple_seq_singleton_p (seq))
-    {
-      phi = as_a <gphi *> (gsi_stmt (gsi_start (seq)));
-      /* Never return virtual phis.  */
-      if (virtual_operand_p (gimple_phi_result (phi)))
-	return NULL;
-      return phi;
-    }
   for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
     {
       gphi *p = as_a <gphi *> (gsi_stmt (i));