This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] deprecate -finline-limit and make it an optimization option (PR 84603)


On 03/02/2018 01:05 AM, Richard Biener wrote:
On Thu, 1 Mar 2018, Martin Sebor wrote:

While testing my recent changes to the handling of attributes
on C++ templates I noticed that the -finline-limit=N option
is not recognized in attribute or pragma optimize.  In response
to the bug I raised, Richard you said the option is deprecated,
so I went ahead and documented the deprecation in the manual
and also added a deprecation warning.  I also added it to
Optimization options.  The attached patch reflects these
changes.

I also tried to put together a test to verify that the option
works as expected, both in attributes and in pragmas.  I wasn't
able to get it to work reliably or sensibly.

In C, #pragma optimize ("inline-limit=1") has a global effect
on all functions in the file, even those lexically before the
pragma.  In C++, the pragma has no effect.  Both of these
effects are contrary to my reading of the manual.

Attribute optimize ("inline-limit") behaves similarly, which
seems even more unexpected and even more contrary to the manual
which by referring to Function Specific Option Pragmas suggests
that both the pragma and especially the attribute apply
optimizations to just the functions they're specified for.

It can't really work so please do _not_ add the option to
the set of Optimize options.  Inlining is an IPA task so
"per function" parameters do not make sense at all.

It does work as I expect for other inlining options (e.g., for
-finline-functions or -finline-functions-called-once) so either
there's something special/different about -finline-limit or that
it works for the others is an accident.  Can you please clarify
which it is?

Either way, wherever they come into play, the limitations you
refer to should be mentioned in the GCC warning when an option
that can't or may not work is used in attribute or #pragma
optimize, and it should also be explained in the manual.  How
else are users supposed to know?

As it is, since -finline-limit is listed among optimization
options, and since attribute and #pragma optimize say they
accept optimization options, it's a bug that GCC rejects it
as if it were invalid.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]