public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Segher Boessenkool <segher@kernel.crashing.org>,"Kewen.Lin"
	<linkw@linux.ibm.com>
Cc: GCC Patches
	<gcc-patches@gcc.gnu.org>,bin.cheng@linux.alibaba.com,Bill
	Schmidt <wschmidt@linux.ibm.com>,jakub@redhat.com
Subject: Re: [PATCH, RFC, rs6000] PR80791 Consider doloop in ivopts
Date: Fri, 26 Apr 2019 18:23:00 -0000	[thread overview]
Message-ID: <FC597CC9-0B42-4137-A7E4-B74D09841FAE@suse.de> (raw)
In-Reply-To: <20190426165943.GC8599@gate.crashing.org>

On April 26, 2019 6:59:43 PM GMT+02:00, Segher Boessenkool <segher@kernel.crashing.org> wrote:
>On Fri, Apr 26, 2019 at 10:26:52PM +0800, Kewen.Lin wrote:
>> on 2019/4/26 下午3:16, Richard Biener wrote:
>> > We should think about possible ways of encoding doloop at IVOPTs
>> > time rather than trying to re-analyze at RTL.  I suppose we can
>> > easily set a flag in struct loop but I'm not familiar enough with
>> > the doloop pass to tell whether that is good enough.  Also we
>> > can maybe move doloop to GIMPLE completely?  I remember some
>> > targets have loop size constraints here as well, so I guess
>> > that isn't easily possible.
>
>> It's a very good point, but I'm afraid that it's impossible to move
>the 
>> whole doloop analysis pass to GIMPLE.  When I implemented this hook 
>> rs6000_predict_doloop_p, I went through all the checks in
>doloop_optimize.
>> I found it looks impossible to imitate all of them at GIMPLE,
>especially 
>> for gen_doloop_end check, jump insn check and register liveness
>clobber
>> check.  Even if we can make hook to check expanded RTL insn sequence
>in 
>> GIMPLE, but it happens too early, some information may not be exact
>enough,
>> many following passes could update what the analysis is based on.
>
>But you could set a flag in gimple, and have the RTL pass only do the
>final mechanics of making things a counted loop -- including generating
>the code for when it cannot do the doloop, which indeed will happen for
>many different reasons, many target-specific, but it is probably pretty
>easy to predict when we *can* use one, and we can do that
>optimistically,
>it's not so very much worse code to have to do it with a few
>instructions
>instead of e.g. a bdnz; there are many optimisation passes after this
>that can still improve the code (cprop, cse, combine).
>
>So, make it a doloop in gimple, and still have the rtl pass, but that
>only reverts it to a non-doloop if it turns out it has to.  Does that
>sound like a good plan?

Yes, that's more or less what I had in mind. Note that you'd have a doloop early in RTL, sth we might not expect? 

Maybe we already have a GIMPLE way of saying decrement and test zero (one of the overflow builtins?), if not we'd need to add such to have 

  Flag_1 = IFN_decandtest (i_2);
If (Flag_1! = 0)
 ... 

As 'doloop-end' on GIMPLE. Just adjusting RTL expansion to catch a regular Dec and test would be possible
As well of course. 

Richard. 

>
>Segher

  reply	other threads:[~2019-04-26 17:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24  8:49 Kewen.Lin
2019-04-24  9:08 ` Jakub Jelinek
2019-04-24  9:25   ` Kewen.Lin
2019-04-25 12:45 ` Segher Boessenkool
2019-04-26  6:58   ` Kewen.Lin
2019-04-26  7:59     ` Richard Biener
2019-04-26 14:32       ` Kewen.Lin
2019-04-26 17:06         ` Segher Boessenkool
2019-04-26 18:23           ` Richard Biener [this message]
2019-04-26 18:58             ` Segher Boessenkool
2019-05-05  3:42           ` Kewen.Lin
2019-04-26 16:44     ` Segher Boessenkool
2019-04-27  4:13     ` Bin.Cheng
2019-05-05  5:26       ` Kewen.Lin
2019-05-06 10:21         ` Richard Biener
2019-04-27  3:45 ` Bin.Cheng
2019-05-05  3:23   ` Kewen.Lin
2019-05-05  4:04     ` Bin.Cheng
2019-05-05  6:02       ` Kewen.Lin
2019-05-06  1:50         ` Bin.Cheng
2019-05-06  7:31           ` Kewen.Lin
2019-05-05 16:33       ` Segher Boessenkool

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=FC597CC9-0B42-4137-A7E4-B74D09841FAE@suse.de \
    --to=rguenther@suse.de \
    --cc=bin.cheng@linux.alibaba.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=linkw@linux.ibm.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).