All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH] experimental: code sinking
Date: Fri, 4 Dec 2020 21:23:28 +0100	[thread overview]
Message-ID: <20201204202328.tx2bgnqrq6szcxys@ltop.local> (raw)
In-Reply-To: <CAHk-=wh15fTgsd+D7_goVzZY3NFPVke8ENTPtUdu5HYi2Pkgbw@mail.gmail.com>

On Fri, Dec 04, 2020 at 10:15:30AM -0800, Linus Torvalds wrote:
> On Fri, Dec 4, 2020 at 9:45 AM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > > There might be cases where instruction sinking makes sense even
> > > outside the "can we empty this bb entirely" issue. Not that I can
> > > think of any, but I wonder if this could be used to actually shrink
> > > liveness regions (if both the inputs to the sunk instruction are live
> > > _anyway_ at the target, then sinking the instruction should actually
> > > improve liveness in general, for example).
> >
> > I don't think I understand this. In the case of an UNOP, sinking it
> > increase the liveness and decrease the liveness of the output, so
> > it should not matter much.
> 
> Right. The UNOP case should be a no-op from a liveness perspective, but:
> 
> > In the case of an BINOP or select, sinking
> > it will decrease the liveness of the unique output but increase the
> > liveness of the inputs. So, it seems to me that sinking would
> > globally increase the liveness (contrary to moving up instructions).
> > Am I missing something?
> 
> No, moving a binop could actually *shrink* liveness under the right
> circumstances - namely when the sources of the binop are live
> regardless.

Hmm yes, indeed. I thought about that but I also implicitly thought
there was a dual effect for the output, but there isn't. And so the
'cost' is not the same before the 'last occurrence of other uses' than
after it. In short: "moving down is good but only when not too low,
unless it's an unop".

Anyway, the idea would be to do such moves only if they would effectively
empty and even then it's clear what is the exact advantage (other than
for imbalance). Also, moving it to the point where it is needed was very
easy. Moving it just past the CBR (or somewhere in the middle) will be more
complicated. I'll see.

-- Luc

      reply	other threads:[~2020-12-04 20:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 16:33 [PATCH] experimental: code sinking Luc Van Oostenryck
2020-12-04 17:13 ` Linus Torvalds
2020-12-04 17:45   ` Luc Van Oostenryck
2020-12-04 18:15     ` Linus Torvalds
2020-12-04 20:23       ` Luc Van Oostenryck [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=20201204202328.tx2bgnqrq6szcxys@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.