public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
To: rakdver@atrey.karlin.mff.cuni.cz
Cc: gcc@gcc.gnu.org
Subject: Re: An issue for the SC: horrible documentation quality of GCC
Date: Sat, 10 May 2003 16:49:00 -0000	[thread overview]
Message-ID: <10305101653.AA23590@vlsi1.ultra.nyu.edu> (raw)

    just from practice -- looking where did this "pragmatic approach" bring
    gcc. Yes, we have might and cool "CSE" pass; but after 2 years working
    on gcc, I would not dare to change a single line there because I don't
    know what will happen.

That's just lack of familiarity.  I fully understand cse.c but am afraid to
change any line of gcse.c!

    no -- there are optimizations that are obviously machine-dependent
    (like scheduling, register allocation, peephole, combiner and whole
    lot of others). Then there are optimizations that are based on some
    general machine non-specific idea (like that computing one expression
    several times is wrong, or that replacing variable with its constant
    value is good -- CSE, GCSE, copy/const propagation, part of the loop
    optimizations and some other fall into this cathegory). 

I don't understand this distinction at all.  The combiner, for example, acts
by always decreasing the number of insns.  That's a very machine-independent
criteria and optimization.  All of the folding done by it and CSE are
machine-independent.

Replacing a variable with it's constant value may or may not be an
"optimization", but whether it is or not is a machine-dependent choice, so I
don't see why you consider that in the machine-dependent parts.

CSE can be viewed as very machine-dependent because the choice of which
expression is best for a given insn is dependent on lots of machine-specific
parameters.

And even "computing one expression several times is wrong" may not be correct
for simple enough expressions when register pressure is an issue.

So I really don't see *any* optimization that, done properly, is
machine-independent.  The key to GCC has been to use machine-specific
information to guide all optimizations.

    The sane way how to write a compiler is to run these generic passes
    first, then run machine-dependent passes that may eventually fix the
    mistakes the previous optimizations have done (due to their generic
    ideas being not right in some corner cases). This way we would get
    approximately the same results, but in much more transparent way.

No, I disagree.  Some machine-dependent optimization might expose more
common expressions or loop invariants.

The issue of what order to run optimizations is very tricky and I don't
think can be answered in that sort of general way.

             reply	other threads:[~2003-05-10 16:49 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10 16:49 Richard Kenner [this message]
2003-05-11 19:42 ` Kai Henningsen
  -- strict thread matches above, loose matches on Subject: below --
2003-05-12 16:25 Richard Kenner
2003-05-12 11:37 Robert Dewar
2003-05-12 11:36 Robert Dewar
2003-05-12 11:16 Richard Kenner
2003-05-11 19:58 Richard Kenner
2003-05-13  5:59 ` Michael S. Zick
2003-05-10 18:08 Richard Kenner
2003-05-10 17:04 Richard Kenner
2003-05-10 17:18 ` Zdenek Dvorak
2003-05-10 15:29 Richard Kenner
2003-05-10 15:52 ` Zdenek Dvorak
2003-05-10 16:09   ` David Edelsohn
2003-05-10 16:17     ` Zdenek Dvorak
2003-05-10 16:57     ` Michael S. Zick
2003-05-12  9:07   ` Richard Earnshaw
2003-05-10  2:21 Richard Kenner
2003-05-10 15:12 ` Zdenek Dvorak
2003-05-12 16:05   ` law
2003-05-12 16:20     ` Michael Matz
2003-05-12 17:39 ` law
2003-05-12 20:15   ` Richard Henderson
2003-05-09 23:13 Richard Kenner
2003-05-09 23:23 ` Jan Hubicka
2003-05-09 22:51 Richard Kenner
2003-05-09 22:59 ` Jan Hubicka
2003-05-09 22:30 Richard Kenner
2003-05-09 22:51 ` Jan Hubicka
2003-05-09 22:26 Richard Kenner
2003-05-09 22:44 ` Jan Hubicka
2003-05-09 22:48 ` Joe Buck
2003-05-10 12:07 ` Richard Earnshaw
2003-05-09 22:17 Richard Kenner
2003-05-09 22:24 ` Jan Hubicka
2003-05-09 21:36 Richard Kenner
2003-05-09 22:19 ` Jan Hubicka
2003-05-09 16:39 Benjamin Kosnik
2003-05-09 18:22 ` Phil Edwards
2003-05-09 16:18 Richard Kenner
2003-05-09 22:06 ` Jan Hubicka
2003-05-09 16:08 Richard Kenner
2003-05-09 21:04 ` Richard Henderson
2003-05-09 15:36 Richard Kenner
2003-05-09 15:56 ` Daniel Jacobowitz
2003-05-09 15:57 ` Michael Matz
2003-05-09 16:34   ` David Edelsohn
2003-05-09 22:01   ` Jan Hubicka
2003-05-09 14:10 Richard Kenner
2003-05-09 14:37 ` Michael Matz
2003-05-09 14:01 Richard Kenner
2003-05-09 12:12 Richard Kenner
2003-05-09 12:41 ` Michael Matz
2003-05-09 13:25 ` Paul Koning
2003-05-09 17:23 ` Joseph S. Myers
2003-05-09 20:30 ` Scott Robert Ladd

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=10305101653.AA23590@vlsi1.ultra.nyu.edu \
    --to=kenner@vlsi1.ultra.nyu.edu \
    --cc=gcc@gcc.gnu.org \
    --cc=rakdver@atrey.karlin.mff.cuni.cz \
    /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).