public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Richard Guenther" <richard.guenther@gmail.com>
To: "Richard Kenner" <kenner@vlsi1.ultra.nyu.edu>
Cc: ebotcazou@adacore.com, gcc-patches@gcc.gnu.org, iant@google.com,
	 	matz@suse.de
Subject: Re: [PATCH] Fix optimization regression in constant folder
Date: Mon, 01 Oct 2007 14:15:00 -0000	[thread overview]
Message-ID: <84fc9c000710010715q6604f8c4k193ff9963366e32c@mail.gmail.com> (raw)
In-Reply-To: <10710011319.AA12088@vlsi1.ultra.nyu.edu>

On 10/1/07, Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:
> > It matches undefined overflow && wrapping overflow, as for infinite precision
> > overflow really cannot happen.
>
> But it can happen: in the case of illegal programs when the programmer tries
> to make an object that's too big.
>
> > You say you need special semantics because otherwise optimization won't work.
>
> Actually, I didn't say that.  I said that sizetypes *already have* and
> always have had different semantics than user-visible types and that trying
> to map those semantics onto a new set of semantics being defined for
> user-visible types is not correct.
>
> > This needs testcases.
>
> Eric and I have both given you an example of an optimization that should
> apply to sizetypes but which won't if you try to change their semantics to
> match those of a user-visible type.
>
> > Otherwise just mapping sizetype semantics to an _existing_ semantic makes
> > most sense as it reduces diversity of semantics and causes less
> > confusion.
>
> I'm not proposing changing the semantics of sizetypes!  Quite the contrary:
> I'm saying that we keep them as they are and *not* try to map them to these
> new flags which are meant for user-visible types.
>
> > Look at all the places we _don't_ specialize sizetypes!  You want to audit
> > all these?
>
> I don't follow.  All these optimizations used to be done for sizetypes and
> I'm saying they need to continue to work.  It's the proposal to use these
> new flags that's changing things.  And I also don't understand what "audit"
> means in this context.  The semantics of these various types (sizetypes and
> the different user-visible type semantics) only differ in overflow
> handling.  So we only need to "audit" those cases where overflow tests are
> involved.

I see exactly 6 places in the middle-end that check TYPE_IS_SIZETYPE.  All
of them in fold-const.c.  What I say is that if sizetypes are worth to
be special
for optimization, why don't optimization passes like VRP or tree-ssa-reassoc.c
not check for TYPE_IS_SIZETYPE?  I say, that TYPE_IS_SIZETYPE can't
be very important as its only used in _very_ few places.  Instead I
ask for testcases
where it _matters_ that we do the optimization in the few places in fold-const.c
that check for TYPE_IS_SIZETYPE because no other optimization pass does
the required transformation.  I argue we should fix optimization passes instead
of fold.  Or if you rely on sizetype in a so different way in Ada than other
frontends maybe using fold () to simplify sizetype operations is not the best
way to ensure proper optimization?

Two of the 6 places are to check if sizetypes are sign-extended, one is to not
mark results TREE_OVERFLOW in int_const_binop for sizetypes.  One is in
extract_multdiv_1 and it needs a comment - it's not exactly clear why sizetype
is special here.  One is with widening which is somehow special for sizetypes,
one is for optimizing div/mult sequences.  That's it.

You seem to have a testcase that shows that re-association is very important
for you for sizetypes.  Why can't you produce something out of it that you
can show us?

Richard.

  reply	other threads:[~2007-10-01 14:15 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17 14:35 Eric Botcazou
2007-09-17 14:45 ` Richard Guenther
2007-09-17 14:56   ` Eric Botcazou
2007-09-17 15:13     ` Richard Guenther
2007-09-18 11:12       ` Eric Botcazou
2007-09-18 11:22         ` Richard Guenther
2007-09-18 13:17           ` Richard Kenner
2007-09-19 11:33           ` Eric Botcazou
2007-09-19 14:40             ` Richard Guenther
2007-09-19 14:50               ` Richard Kenner
2007-09-19 15:50               ` Eric Botcazou
2007-09-29 10:27               ` Eric Botcazou
2007-09-29 14:59                 ` Richard Guenther
2007-09-29 15:12                   ` Eric Botcazou
2007-09-29 15:38                     ` Richard Guenther
2007-09-29 17:46                       ` Richard Guenther
2007-09-29 18:43                         ` Eric Botcazou
2007-09-29 20:52                           ` Richard Guenther
2007-09-30 14:38                             ` Eric Botcazou
2007-09-30 16:01                               ` Eric Botcazou
2007-09-30 16:03                               ` Richard Guenther
2007-09-30 16:36                                 ` Eric Botcazou
2007-09-30 17:37                                   ` Richard Guenther
2007-09-30 18:53                                     ` Eric Botcazou
2007-09-30 17:59                                   ` Richard Kenner
2007-09-30 18:38                                     ` Richard Guenther
2007-09-30 21:16                                       ` Richard Kenner
2007-09-30 22:10                                       ` Eric Botcazou
     [not found]                                   ` <m3r6kf3gyx.fsf@localhost.localdomain>
     [not found]                                     ` <200710010127.59677.ebotcazou@adacore.com>
2007-10-01  0:10                                       ` Ian Lance Taylor
2007-10-01  0:51                                         ` Richard Kenner
2007-10-01  1:54                                           ` Michael Matz
2007-10-01  2:53                                             ` Richard Kenner
2007-10-01  3:25                                               ` Michael Matz
2007-10-01  3:40                                                 ` Richard Kenner
2007-10-01  9:12                                                   ` Richard Guenther
2007-10-01 12:29                                                     ` Richard Kenner
2007-10-01 12:40                                                       ` Richard Guenther
2007-10-01 13:07                                                         ` Eric Botcazou
2007-10-01 13:15                                                         ` Richard Kenner
2007-10-01 14:15                                                           ` Richard Guenther [this message]
2007-10-01 14:23                                                             ` Richard Kenner
2007-10-01 14:29                                                               ` Richard Guenther
2007-10-01 14:35                                                                 ` Richard Kenner
2007-10-01 17:51                                                           ` Ian Lance Taylor
2007-10-01 19:32                                                             ` Richard Kenner
2007-10-01 19:51                                                               ` Ian Lance Taylor
2007-10-01 20:28                                                                 ` Richard Kenner
2007-10-02 13:58                                                                   ` Michael Matz
2007-10-03  6:41                                                             ` Eric Botcazou
2007-10-03  7:00                                                               ` Ian Lance Taylor
2007-10-03  7:10                                                                 ` Eric Botcazou
2007-10-03 14:18                                                                   ` Ian Lance Taylor
2007-10-03 15:53                                                                     ` Eric Botcazou
2007-10-04  5:20                                                                       ` Michael Matz
2007-10-10 17:31                                                   ` Mark Mitchell
2007-10-10 22:43                                                     ` Richard Kenner
2007-10-11  0:40                                                       ` Mark Mitchell
2007-10-11  1:02                                                         ` Richard Kenner
2007-10-11 15:06                                                     ` Michael Matz
2007-10-11 15:10                                                       ` Richard Guenther
2007-10-11 15:55                                                         ` Michael Matz
2007-10-11 15:57                                                           ` Richard Guenther
2007-10-11 16:02                                                             ` Richard Kenner
2007-10-11 15:59                                                           ` Richard Kenner
2007-10-11 16:02                                                             ` Richard Guenther
2007-10-11 16:08                                                               ` Richard Kenner
2007-10-11 16:14                                                                 ` Richard Guenther
2007-10-11 16:37                                                                   ` Richard Kenner
2007-10-11 16:44                                                                     ` Richard Guenther
2007-10-11 16:50                                                                       ` Richard Kenner
2007-10-11 15:32                                                       ` Richard Kenner
2007-10-11 16:03                                                         ` Michael Matz
2007-10-11 16:06                                                           ` Richard Guenther
2007-10-11 16:19                                                             ` Richard Kenner
2007-10-11 16:25                                                             ` Michael Matz
2007-10-11 16:12                                                           ` Richard Kenner
2007-10-11 16:38                                                             ` Michael Matz
2007-10-11 16:47                                                               ` Richard Kenner
2007-10-11 17:04                                                                 ` Michael Matz
2007-10-11 17:17                                                                   ` Ian Lance Taylor
2007-10-11 18:41                                                                     ` Michael Matz
     [not found]                                                                       ` <10710111850.AA27 912@vlsi1.ultra.nyu.edu>
     [not found]                                                                       ` <10710111850.AA27        912@vlsi1.ultra.nyu.edu>
     [not found]                                                                       ` <10710111850.AA27           912@vlsi1.ultra.nyu.edu>
     [not found]                                                                       ` <10710111850.AA27    912@vlsi1.ultra.nyu.edu>
     [not found]                                                                       ` <10710111850.AA27      912@vlsi1.ultra.nyu.edu>
     [not found]                                                                       ` <10710111850.AA27       912@vlsi1.ultra.nyu.edu>
2007-10-11 18:45                                                                       ` Richard Kenner
2007-10-11 19:10                                                                         ` Michael Matz
2007-10-11 19:17                                                                           ` Richard Kenner
2007-10-11 19:30                                                                             ` Michael Matz
2007-10-11 20:06                                                                               ` Richard Kenner
2007-10-11 21:24                                                                             ` Ian Lance Taylor
2007-10-12  2:36                                                                               ` Richard Kenner
2007-10-12  4:40                                                                                 ` Ian Lance Taylor
2007-10-12  4:56                                                                                   ` Mark Mitchell
2007-10-12 12:30                                                                                     ` Richard Kenner
2007-10-12 17:48                                                                                       ` Mark Mitchell
2007-10-12 18:08                                                                                         ` Richard Kenner
2007-10-12 18:37                                                                                           ` Mark Mitchell
2007-10-12 18:51                                                                                             ` Richard Kenner
2007-10-12 20:13                                                                                             ` Richard Guenther
2007-10-14 11:09                                                                                         ` Eric Botcazou
2007-10-12 11:42                                                                                   ` Richard Kenner
2007-10-14 10:31                                                                                   ` Eric Botcazou
2007-10-14 11:24                                                                                     ` Richard Guenther
2007-10-14 11:58                                                                                       ` Eric Botcazou
2007-10-14 12:16                                                                                       ` Richard Kenner
2007-10-14 13:29                                                                                         ` Richard Guenther
2007-10-15  2:12                                                                                           ` Richard Kenner
2007-10-15  7:33                                                                                             ` Michael Matz
2007-10-15 11:36                                                                                               ` Richard Kenner
2007-10-15 13:27                                                                                                 ` Richard Guenther
2007-10-15 13:28                                                                                                   ` Richard Kenner
2007-10-14 16:07                                                                                       ` Ian Lance Taylor
2007-10-14 16:27                                                                                         ` Richard Guenther
2007-10-15  3:26                                                                                           ` Richard Kenner
2007-10-15  9:12                                                                                             ` Richard Guenther
2007-10-15 11:41                                                                                               ` Richard Kenner
2007-10-15 13:15                                                                                                 ` Richard Guenther
2007-10-15 13:17                                                                                                   ` Richard Kenner
2007-10-15  3:29                                                                                           ` Richard Kenner
2007-10-15  2:17                                                                                         ` Richard Kenner
2007-10-15  5:21                                                                                           ` Ian Lance Taylor
2007-10-15 11:01                                                                                             ` Richard Kenner
2007-10-11 17:21                                                                   ` Richard Kenner
2007-10-11 16:16                                                           ` Richard Kenner
2007-10-11 16:51                                                             ` Michael Matz
2007-10-11 16:57                                                               ` Richard Kenner
2007-10-11 17:06                                                                 ` Richard Guenther
2007-10-11 17:24                                                                   ` Richard Kenner
2007-10-11 17:31                                                                 ` Michael Matz
2007-10-11 17:54                                                                   ` Richard Kenner
2007-10-12  8:20                                                                     ` Richard Guenther
2007-10-12 11:47                                                                       ` Paolo Bonzini
2007-10-12 12:44                                                                       ` Richard Kenner
2007-10-12 12:49                                                                         ` Richard Guenther
2007-10-11 15:57                                                       ` Mark Mitchell
2007-10-11 16:01                                                         ` Richard Kenner
2007-10-11 16:03                                                           ` Richard Guenther
2007-10-11 16:16                                                             ` Richard Kenner
2007-10-11 16:11                                                           ` Mark Mitchell
2007-10-11 16:29                                                             ` Richard Kenner
2007-10-01  6:07                                                 ` Eric Botcazou
2007-10-01  6:07                                         ` Eric Botcazou
2007-10-01  8:58                                     ` Richard Guenther

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=84fc9c000710010715q6604f8c4k193ff9963366e32c@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=kenner@vlsi1.ultra.nyu.edu \
    --cc=matz@suse.de \
    /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).