public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>,
	 Jan Hubicka via Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: Unloop no longer looping loops in loop-ch
Date: Wed, 26 Apr 2023 12:17:05 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2304261216481.4466@jbgna.fhfr.qr> (raw)
In-Reply-To: <ZEj9RhxSm5mVZY3w@kam.mff.cuni.cz>

On Wed, 26 Apr 2023, Jan Hubicka wrote:

> > > -      if (precise)
> > > +      if (precise
> > > +	  && get_max_loop_iterations_int (loop) == 1)
> > > +	{
> > > +	  if (dump_file && (dump_flags & TDF_DETAILS))
> > > +	    fprintf (dump_file, "Loop %d no longer loops.\n", loop->num);
> > 
> > but max loop iterations is 1 ...?
> 
> I first check for loops with 0 iterations, push them to unlooping list
> and avoid any header copying (it is useless).
> At this patch we already did header duplication and verified that the
> maximal number of iterations will drop by 1 since there is no way loop
> can terminate except for the header tests we peeled out.
> 
> So 1 would turn to 0 in the loop info update and it seems useless to do
> it.
> > 
> > > +	  loops_to_unloop.safe_push (loop);
> > > +	  loops_to_unloop_nunroll.safe_push (0);
> > > +	}
> > > +      else if (precise)
> > >  	{
> > >  	  if (dump_file && (dump_flags & TDF_DETAILS))
> > >  	    fprintf (dump_file,
> > > @@ -688,6 +699,12 @@ ch_base::copy_headers (function *fun)
> > >  	  BITMAP_FREE (exit_bbs);
> > >  	}
> > >      }
> > > +  if (loops_to_unloop.length())
> > 
> >   !loops_to_unloop.is_empty ()
> I updated that in my copy of the patch.
> > 
> > > +    {
> > > +      bool irred_invalidated;
> > > +      unloop_loops (loops_to_unloop, loops_to_unloop_nunroll, NULL, &irred_invalidated);
> > > +      changed = true;
> > > +    }
> > >    free (bbs);
> > >    free (copied_bbs);
> > 
> > 
> > Since we run VN on the header copies I wonder if, since you remove
> > edges, we need to run CFG cleanup before this and updating SSA form?
> > For safety we usually let CFG cleanup do the actual CFG manipulation
> > and just change cond jumps to if (0) or if (1)?
> 
> I do unlooping only after the VN so I think I am safe here.

Ah OK.

The patch is OK then.

Thanks,
Richard.

      reply	other threads:[~2023-04-26 12:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 15:12 Jan Hubicka
2023-04-25 16:04 ` Bernhard Reutner-Fischer
2023-04-25 16:10   ` Jan Hubicka
2023-04-26  7:34     ` Richard Biener
2023-04-26 10:30       ` Jan Hubicka
2023-04-26 12:17         ` 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.2304261216481.4466@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=rep.dot.nop@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).