From: Segher Boessenkool <segher@kernel.crashing.org>
To: Richard Biener <richard.guenther@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Nicholas Krause <xerofoify@gmail.com>,
Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: Add a new combine pass
Date: Wed, 27 Nov 2019 19:36:00 -0000 [thread overview]
Message-ID: <20191127193143.GM9491@gate.crashing.org> (raw)
In-Reply-To: <CAFiYyc3WcYpwxMsUGm6Y4vYSQtMMDZRZFk-AjSb0xzW-q8fmag@mail.gmail.com>
On Wed, Nov 27, 2019 at 09:29:27AM +0100, Richard Biener wrote:
> On Tue, Nov 26, 2019 at 2:42 AM Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> > combine actually *calculates* DU chains almost completely, it just throws
> > away most of that information (it wants to have LOG_LINKS, as it did ages
> > ago). The only thing stopping us from doing that right now is that not
> > all uses are counted (some are skipped).
> >
> > Since combine works only within BBs, DU chains are linear to compute, and
> > UD chains are trivial (and just linear to compute).
>
> quadraticness appears for RTL DU/UD chains because of partial definitions,
> that doesn't change for BBs so even there computing is them is quadratic
> (because recording them is). The situation is simply having N partial
> defs all reaching M uses which gives you a chain of size N * M.
And both N and M are constants here (bounded by a constant). The only
dimensions we care about are those the user can grow unlimited: number
of registers, number of instructions, number of functions, that kind of
thing.
The control flow graph in a basic block is a DAG, making most of this
linear to compute. Only updating it after every separate change is not
easily linear in total.
> Updating is linear as well if you can disregard partial defs. Updating cannot
> be quadratic if compute is linear ;)
Sure it can. Updating has to be O(1) (amortized) per change for the whole
pass to be O(n). If it is O(n) per change you are likely O(n^2) in total.
I don't see how to make combine itself O(1) per change, but yeah I can
see how that can work (or almost work) for something simpler (and less
weighed down by history :-) ).
Segher
next prev parent reply other threads:[~2019-11-27 19:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-18 0:21 Richard Sandiford
2019-11-18 2:04 ` Andrew Pinski
2019-11-18 17:58 ` Richard Sandiford
2019-11-23 23:01 ` Segher Boessenkool
2019-11-23 23:09 ` Nicholas Krause
2019-11-23 23:43 ` Segher Boessenkool
2019-11-24 0:11 ` Nicholas Krause
2019-11-25 22:09 ` Richard Sandiford
2019-11-25 22:52 ` Segher Boessenkool
2019-12-03 13:33 ` Oleg Endo
2019-12-03 18:05 ` Segher Boessenkool
2019-12-04 10:43 ` Oleg Endo
2019-12-06 22:51 ` Segher Boessenkool
2019-12-06 23:47 ` Oleg Endo
2019-11-19 0:11 ` Segher Boessenkool
2019-11-19 11:36 ` Richard Sandiford
2019-11-19 21:13 ` Segher Boessenkool
2019-11-20 18:29 ` Richard Sandiford
2019-11-20 20:49 ` Segher Boessenkool
2019-11-21 21:12 ` Richard Sandiford
2019-11-22 16:39 ` Segher Boessenkool
2019-11-25 21:25 ` Richard Sandiford
2019-11-25 22:17 ` Segher Boessenkool
2019-11-25 23:26 ` Richard Sandiford
2019-11-26 1:44 ` Segher Boessenkool
2019-11-27 8:32 ` Richard Biener
2019-11-27 10:18 ` Richard Sandiford
2019-11-27 19:36 ` Segher Boessenkool [this message]
2019-11-21 19:02 ` Nicholas Krause
2019-11-21 19:47 ` Richard Sandiford
2019-11-22 16:27 ` Segher Boessenkool
2019-12-05 10:17 ` Richard Sandiford
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=20191127193143.GM9491@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=xerofoify@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).