all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pip Cet <pipcet@gmail.com>
To: Bruno Haible <bruno@clisp.org>
Cc: 36370@debbugs.gnu.org, Paul Eggert <eggert@cs.ucla.edu>,
	bug-gnulib@gnu.org
Subject: bug#36370: 27.0.50; XFIXNAT called on negative numbers
Date: Sat, 29 Jun 2019 05:44:22 +0000	[thread overview]
Message-ID: <CAOqdjBcNA4mDiwsd_jbeePGMdUwPvkFCNdgtZvmiQnYmJNR3pA__18565.3344773286$1561787180$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <2067160.1HRgjLhtDS@omega>

On Fri, Jun 28, 2019 at 11:30 PM Bruno Haible <bruno@clisp.org> wrote:
> Pip Cet wrote:
> > have started believing the "an inline function is as fast as a macro"
> > mantra*, assuming you include inline functions with "function calls".
>
> Ah, that's where the entire topic with the function calls inside assume()
> comes from! I agree it's an important case (more important than the
> functions defined in other compilation units).

As I said earlier:

----
This makes it safe to use function expressions in eassume, whether the
function is inlined or not.

(That GCC doesn't actually do very much with this information is a
separate issue).
----

So we're talking about this separate issue now? I ask not for
rhetorical points, but because I genuinely think it's interesting if
the objection is based on GCC limitations rather than fundamentally
unfixable reasons.

> So, the main effect of the proposed new 'assume' is that it de-optimizes
> the case where the CONDITION is defined using inline functions!

(I don't think it's the "main" effect).

That certainly is something that appears to be happening in some
situations. It's a GCC limitation, and let's be clear: as long as this
limitation isn't lifted, an inline function is not as fast as a macro.

However, passing an inline function to assume() is problematic anyway,
unless it's marked as __attribute__((always_inline)), and marking it
as __attribute__((always_inline)) is problematic because it might
directly contradict what the programmer was trying to achieve by
passing -fno-inline.

> Based on these results, I formally object against the proposed patch.

I won't argue against that as long as I haven't found a way around the
GCC issue, but I would like to state that the current assume does
behave very badly when combined with -fno-inline-small-functions
-fno-inline.

> > > (2) that the generated code will never include these function calls,
> > >     because the generated code with the 'assume' invocation should be
> > >     optimized at least as well as the generated code without the
> > >     'assume' invocation.
> >
> > I think it should be the rarest of exceptions for an assume() to
> > result in slower code, yes. I believe that includes the case where
> > functions marked inline aren't inlined, because of compiler options,
> > for example.
>
> Then, I think we should change the documentation of 'assume' to say
> that when it invokes functions, these functions should be marked
> '__attribute__ ((__always_inline__))', otherwise performance will
> be worse than without the 'assume', not better.

I disagree. It's tedious, and people might just change their INLINE
macros (or whatever) to specify __attribute__((always_inline)), making
-fno-inline worthless...

> > I think there's a significant probability that the GCC people would
> > agree to add such a built-in, but insist on its having "may or may not
> > evaluate its argument" semantics.
>
> We can tell them that it would be important for us that is does not
> evaluate its argument. Like sizeof (EXPRESSION) does not evaluate EXPRESSION.

We can tell them that, but my suspicion is it'll be much, much harder
to implement that way.





  parent reply	other threads:[~2019-06-29  5:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25  5:36 bug#36370: 27.0.50; XFIXNAT called on negative numbers Pip Cet
2019-06-27  1:10 ` Paul Eggert
2019-06-27  6:16   ` Pip Cet
2019-06-27  8:28     ` Paul Eggert
2019-06-27 13:17       ` Pip Cet
2019-06-27 13:37         ` Eli Zaretskii
2019-06-27 19:38         ` Paul Eggert
2019-06-27 19:56           ` Pip Cet
2019-06-27 21:13             ` Paul Eggert
     [not found]             ` <5284eb58-3560-da42-d1d1-3bdb930eae49@cs.ucla.edu>
2019-06-27 21:37               ` Pip Cet
2019-06-27 23:45               ` Bruno Haible
     [not found]               ` <2715311.ceefYqj39C@omega>
2019-06-28  0:04                 ` Paul Eggert
2019-06-28 11:06                 ` Pip Cet
2019-06-28 12:14                   ` Bruno Haible
     [not found]                   ` <8979488.cRkkfcT1mV@omega>
2019-06-28 12:29                     ` Bruno Haible
2019-06-28 13:51                     ` Pip Cet
     [not found]                     ` <CAOqdjBfS99UpLZ-qLe4=FMXMsr+T3LUvJEsf_gfmF6wwLbqgOw@mail.gmail.com>
2019-06-28 17:46                       ` Paul Eggert
2019-06-28 19:11                       ` Bruno Haible
     [not found]                       ` <a293f2fe-99b3-3776-f27b-35e3a93d1d34@cs.ucla.edu>
2019-06-28 19:15                         ` Pip Cet
2019-06-28 19:56                           ` Bruno Haible
2019-06-28 21:08                             ` Pip Cet
2019-06-29  5:41                           ` Paul Eggert
     [not found]                           ` <87168b28-192b-6666-e9b6-9cdc2ed3917a@cs.ucla.edu>
2019-06-29  6:48                             ` Pip Cet
     [not found]                             ` <CAOqdjBfcNbXFw3Fb0wgRR10PNbkJQ+88ObE9KEghLSb-ptdrbA@mail.gmail.com>
2019-06-29 17:31                               ` Paul Eggert
     [not found]                               ` <791ae316-3a6f-605a-0da5-874fe3d224c5@cs.ucla.edu>
2019-06-30  9:21                                 ` Pip Cet
     [not found]                       ` <11002295.LrvMqknVDZ@omega>
2019-06-28 21:07                         ` Pip Cet
2019-06-28 23:30                           ` Bruno Haible
     [not found]                           ` <2067160.1HRgjLhtDS@omega>
2019-06-29  5:40                             ` Paul Eggert
2019-06-29  5:44                             ` Pip Cet [this message]
     [not found]                             ` <CAOqdjBcNA4mDiwsd_jbeePGMdUwPvkFCNdgtZvmiQnYmJNR3pA@mail.gmail.com>
2019-06-29 10:31                               ` Bruno Haible
     [not found]                               ` <2515002.Q0mBYvUW8C@omega>
2019-06-29 17:11                                 ` Paul Eggert
     [not found]                                 ` <99bacb9f-1192-1315-85d7-5ab4924dfef8@cs.ucla.edu>
2019-06-29 17:48                                   ` Bruno Haible
2019-06-30 15:30                                 ` Pip Cet
     [not found]                                 ` <CAOqdjBeiMno7nGKwk7SSZQob+CTyG39KRTM9EEebq7NQavLR-Q@mail.gmail.com>
2019-06-30 15:45                                   ` Bruno Haible
2019-07-02 23:39                                     ` Paul Eggert
2019-07-01  1:46                                   ` Richard Stallman

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='CAOqdjBcNA4mDiwsd_jbeePGMdUwPvkFCNdgtZvmiQnYmJNR3pA__18565.3344773286$1561787180$gmane$org@mail.gmail.com' \
    --to=pipcet@gmail.com \
    --cc=36370@debbugs.gnu.org \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.