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: Jeff Law <jeffreyalaw@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] tree-vect-generic: Fix up ICE with SSA_NAME_OCCURS_IN_ABNORMAL_PHI [PR109392]
Date: Tue, 11 Apr 2023 10:38:22 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2304111031070.4466@jbgna.fhfr.qr> (raw)
In-Reply-To: <ZDUUiaxI3xYP+0PT@tucnak>

On Tue, 11 Apr 2023, Jakub Jelinek wrote:

> On Wed, Apr 05, 2023 at 02:11:08PM +0200, Richard Biener wrote:
> > Ok, but maybe there?s a gimple_build overload that meanwhile implements
> > the desired semantics?  It would probably need to specify the valueization
> > hook to follow SSA edges beyond the sequence we?re currently building.
> 
> Jeff has apparently committed the patch in the meantime.
> For gimple_build, did you mean to use it just for this fallback case,
> or instead of the initial resimplification as well?

I was originally thinking of the initial resimplification.

But yes, using gimple_build would have simplified it to

  if (!res)
    res = gimple_build (&stmts, BIT_FIELD_REF, type, t, bitsize, bitpos);

With the gsi overloads the whole function should now be able to
be turned into

return gimple_build (gsi, true, GSI_SAME_STMT, UNKNOWN_LOCATION,
                     BIT_FIELD_REF, type, t, bitsize, bitpos);

I think.  Note that's not 100% equivalent to what we do now, so it's
probably better to defer to stage1.  What it doesn't do is

  /* We're using the resimplify API and maybe_push_res_to_seq to
     simplify the BIT_FIELD_REF but restrict the simplification to 
     a single stmt while at the same time following SSA edges for
     simplification with already emitted CTORs.  */

which is achieved by passing NULL as the gimple_seq * argument to
.resimplify.  The above replacement would instead do what a later
forwprop pass would do when folding.  ISTR I wanted to do minimal
changes when rewriting this.

Richard.

> > > 2023-04-05  Jakub Jelinek  <jakub@redhat.com>
> > > 
> > >    PR tree-optimization/109392
> > >    * tree-vect-generic.cc (tree_vec_extract): If maybe_push_res_to_seq
> > >    fails, build BIT_FIELD_REF insn without trying to simplify it.
> > > 
> > >    * gcc.dg/pr109392.c: New test.
> > > 
> > > --- gcc/tree-vect-generic.cc.jj    2023-03-23 10:02:18.997935620 +0100
> > > +++ gcc/tree-vect-generic.cc    2023-04-04 14:28:32.977729134 +0200
> > > @@ -174,7 +174,16 @@ tree_vec_extract (gimple_stmt_iterator *
> > >   opr.resimplify (NULL, follow_all_ssa_edges);
> > >   gimple_seq stmts = NULL;
> > >   tree res = maybe_push_res_to_seq (&opr, &stmts);
> > > -  gcc_assert (res);
> > > +  if (!res)
> > > +    {
> > > +      /* This can happen if SSA_NAME_OCCURS_IN_ABNORMAL_PHI are
> > > +     used.  Build BIT_FIELD_REF manually otherwise.  */
> > > +      t = build3 (BIT_FIELD_REF, type, t, bitsize, bitpos);
> > > +      res = make_ssa_name (type);
> > > +      gimple *g = gimple_build_assign (res, t);
> > > +      gsi_insert_before (gsi, g, GSI_SAME_STMT);
> > > +      return res;
> > > +    }
> > >   gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT);
> > >   return res;
> > > }
> 
> 	Jakub
> 
> 

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

      reply	other threads:[~2023-04-11 10:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05  8:58 Jakub Jelinek
2023-04-05 12:11 ` Richard Biener
2023-04-11  8:04   ` Jakub Jelinek
2023-04-11 10:38     ` 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.2304111031070.4466@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jeffreyalaw@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).