public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Andrew Pinski <pinskia@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 3/12] phiopt: Fix phiopt ICE on vops [PR102989]
Date: Thu, 10 Aug 2023 06:52:07 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2308100652030.12935@jbgna.fhfr.qr> (raw)
In-Reply-To: <ZNP0pQWqgO2eUZNL@tucnak>

On Wed, 9 Aug 2023, Jakub Jelinek wrote:

> On Wed, Aug 09, 2023 at 01:06:22PM -0700, Andrew Pinski wrote:
> > That was my next thought, returning NULL from
> > single_non_singleton_phi_for_edges if it would return a virtual OP
> > might be better even.
> > Either version of these patches are ok with me (though I am not the
> > maintainer here).
> 
> In patch form that would be (but so far untested):

LGTM

> 2023-08-09  <jakub@redhat.com>
> 
> 	PR c/102989
> 	* tree-ssa-phiopt.cc (single_non_singleton_phi_for_edges): Never
> 	return virtual phis and return NULL if there is a virtual phi
> 	where the arguments from E0 and E1 edges aren't equal.
> 
> --- gcc/tree-ssa-phiopt.cc.jj	2023-08-09 22:08:07.974563266 +0200
> +++ gcc/tree-ssa-phiopt.cc	2023-08-09 22:11:37.291517911 +0200
> @@ -63,7 +63,13 @@ single_non_singleton_phi_for_edges (gimp
>    gimple_stmt_iterator i;
>    gphi *phi = NULL;
>    if (gimple_seq_singleton_p (seq))
> -    return as_a <gphi *> (gsi_stmt (gsi_start (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));
> @@ -72,6 +78,10 @@ single_non_singleton_phi_for_edges (gimp
>  				       gimple_phi_arg_def (p, e1->dest_idx)))
>  	continue;
>  
> +      /* Punt on virtual phis with different arguments from the edges.  */
> +      if (virtual_operand_p (gimple_phi_result (p)))
> +	return NULL;
> +
>        /* If we already have a PHI that has the two edge arguments are
>  	 different, then return it is not a singleton for these PHIs. */
>        if (phi)
> 
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

      reply	other threads:[~2023-08-10  6:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 18:17 Jakub Jelinek
2023-08-09 18:27 ` Andrew Pinski
2023-08-09 20:00   ` Jakub Jelinek
2023-08-09 20:06     ` Andrew Pinski
2023-08-09 20:18       ` Jakub Jelinek
2023-08-10  6:52         ` Richard Biener [this message]

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=nycvar.YFH.7.77.849.2308100652030.12935@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=pinskia@gmail.com \
    /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).