Unimpressed with pg_attribute_always_inline

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Unimpressed with pg_attribute_always_inline
Date: 2018-01-02 03:17:48
Message-ID: 32278.1514863068@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I find myself entirely unimpressed with the results of commit dbb3d6f01.

In the first place, even among the compilers that claim to understand
that directive at all, there is a noticeable tendency to issue warnings.
I find the following in recent buildfarm "make" logs:

baiji | .\src\backend\executor\nodeHashjoin.c(165): warning C4141: 'inline' : used more than once
bowerbird | src/backend/executor/nodeHashjoin.c(165): warning C4141: 'inline' : used more than once [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj]
currawong | .\src\backend\executor\nodeHashjoin.c(165): warning C4141: 'inline' : used more than once
gaur | nodeHashjoin.c:167: warning: `always_inline' attribute directive ignored
mastodon | .\src\backend\executor\nodeHashjoin.c(165): warning C4141: 'inline' : used more than once
thrips | src/backend/executor/nodeHashjoin.c(165): warning C4141: 'inline' : used more than once [C:\buildfarm\buildenv\HEAD\pgsql.build\postgres.vcxproj]
woodlouse | src/backend/executor/nodeHashjoin.c(165): warning C4141: 'inline' : used more than once [C:\buildfarm\buildenv\HEAD\pgsql.build\postgres.vcxproj]

In the second place, what I read in gcc's manual about the meaning of
the always_inline directive is

`always_inline'
Generally, functions are not inlined unless optimization is
specified. For functions declared inline, this attribute inlines
the function even if no optimization level was specified.

I entirely reject the notion that we should be worried about optimizing
performance in -O0 builds. In fact, if someone is building with -O0,
it's likely the case that they are hoping for exact correspondence
of source lines to object code, and thus forcing inline is defeating
their purpose. I've certainly found plenty of times that inlining
makes it harder to follow things in a debugger.

Therefore, I think that pg_attribute_always_inline is not merely
useless but actively bad, and should be removed.

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-01-02 03:23:45 Re: pgsql: Add parallel-aware hash joins.
Previous Message Nikita Glukhov 2018-01-02 02:04:29 Re: [HACKERS] SQL/JSON in PostgreSQL