public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [C++ patch] Enable constructor decloning by default
@ 2014-05-18 19:32 Jan Hubicka
  2014-05-19  9:17 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2014-05-18 19:32 UTC (permalink / raw)
  To: gcc-patches, jason

Hi,
this patch enables -fdeclone-ctor-dtor by default: I believe it is up to the
optimizers to decide when the actual worker body should be inlined into the
thunks.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	* c-family/c.opt: Enable declonning by default.
	* c-family/c-opts.c: Do not enable decloning for -Os.
	* doc/invoke.texi (-fdeclone-ctor-dtor): Update documentation.
Index: c-family/c.opt
===================================================================
--- c-family/c.opt	(revision 210521)
+++ c-family/c.opt	(working copy)
@@ -904,7 +904,7 @@ C++ ObjC++ Var(flag_deduce_init_list) In
 -fdeduce-init-list	enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list
 
 fdeclone-ctor-dtor
-C++ ObjC++ Var(flag_declone_ctor_dtor) Init(-1)
+C++ ObjC++ Var(flag_declone_ctor_dtor) Init(1)
 Factor complex constructors and destructors to favor space over speed
 
 fdefault-inline
Index: c-family/c-opts.c
===================================================================
--- c-family/c-opts.c	(revision 210521)
+++ c-family/c-opts.c	(working copy)
@@ -906,10 +906,6 @@ c_common_post_options (const char **pfil
   if (warn_implicit_function_declaration == -1)
     warn_implicit_function_declaration = flag_isoc99;
 
-  /* Declone C++ 'structors if -Os.  */
-  if (flag_declone_ctor_dtor == -1)
-    flag_declone_ctor_dtor = optimize_size;
-
   if (cxx_dialect >= cxx11)
     {
       /* If we're allowing C++0x constructs, don't warn about C++98
Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 210521)
+++ doc/invoke.texi	(working copy)
@@ -7413,7 +7414,7 @@ clones, which means two copies of the fu
 base and complete variants are changed to be thunks that call a common
 implementation.
 
-Enabled by @option{-Os}.
+Enabled by default.
 
 @item -fdelete-null-pointer-checks
 @opindex fdelete-null-pointer-checks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ patch] Enable constructor decloning by default
  2014-05-18 19:32 [C++ patch] Enable constructor decloning by default Jan Hubicka
@ 2014-05-19  9:17 ` Richard Biener
  2014-05-19 14:45   ` Jan Hubicka
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2014-05-19  9:17 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: GCC Patches, Jason Merrill

On Sun, May 18, 2014 at 9:32 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch enables -fdeclone-ctor-dtor by default: I believe it is up to the
> optimizers to decide when the actual worker body should be inlined into the
> thunks.
>
> Bootstrapped/regtested x86_64-linux, OK?

Please make sure to not enable it for -O0 and -Og at least.

Richard.

> Honza
>
>         * c-family/c.opt: Enable declonning by default.
>         * c-family/c-opts.c: Do not enable decloning for -Os.
>         * doc/invoke.texi (-fdeclone-ctor-dtor): Update documentation.
> Index: c-family/c.opt
> ===================================================================
> --- c-family/c.opt      (revision 210521)
> +++ c-family/c.opt      (working copy)
> @@ -904,7 +904,7 @@ C++ ObjC++ Var(flag_deduce_init_list) In
>  -fdeduce-init-list     enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list
>
>  fdeclone-ctor-dtor
> -C++ ObjC++ Var(flag_declone_ctor_dtor) Init(-1)
> +C++ ObjC++ Var(flag_declone_ctor_dtor) Init(1)
>  Factor complex constructors and destructors to favor space over speed
>
>  fdefault-inline
> Index: c-family/c-opts.c
> ===================================================================
> --- c-family/c-opts.c   (revision 210521)
> +++ c-family/c-opts.c   (working copy)
> @@ -906,10 +906,6 @@ c_common_post_options (const char **pfil
>    if (warn_implicit_function_declaration == -1)
>      warn_implicit_function_declaration = flag_isoc99;
>
> -  /* Declone C++ 'structors if -Os.  */
> -  if (flag_declone_ctor_dtor == -1)
> -    flag_declone_ctor_dtor = optimize_size;
> -
>    if (cxx_dialect >= cxx11)
>      {
>        /* If we're allowing C++0x constructs, don't warn about C++98
> Index: doc/invoke.texi
> ===================================================================
> --- doc/invoke.texi     (revision 210521)
> +++ doc/invoke.texi     (working copy)
> @@ -7413,7 +7414,7 @@ clones, which means two copies of the fu
>  base and complete variants are changed to be thunks that call a common
>  implementation.
>
> -Enabled by @option{-Os}.
> +Enabled by default.
>
>  @item -fdelete-null-pointer-checks
>  @opindex fdelete-null-pointer-checks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ patch] Enable constructor decloning by default
  2014-05-19  9:17 ` Richard Biener
@ 2014-05-19 14:45   ` Jan Hubicka
  2014-05-19 14:48     ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Hubicka @ 2014-05-19 14:45 UTC (permalink / raw)
  To: Richard Biener; +Cc: Jan Hubicka, GCC Patches, Jason Merrill

> On Sun, May 18, 2014 at 9:32 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > Hi,
> > this patch enables -fdeclone-ctor-dtor by default: I believe it is up to the
> > optimizers to decide when the actual worker body should be inlined into the
> > thunks.
> >
> > Bootstrapped/regtested x86_64-linux, OK?
> 
> Please make sure to not enable it for -O0 and -Og at least.

Hmm, I tought this thunk can be implemented without clobbering debug info - 
all we need is to arrange it to be abstract and not show in unwind info...

Honza
> 
> Richard.
> 
> > Honza
> >
> >         * c-family/c.opt: Enable declonning by default.
> >         * c-family/c-opts.c: Do not enable decloning for -Os.
> >         * doc/invoke.texi (-fdeclone-ctor-dtor): Update documentation.
> > Index: c-family/c.opt
> > ===================================================================
> > --- c-family/c.opt      (revision 210521)
> > +++ c-family/c.opt      (working copy)
> > @@ -904,7 +904,7 @@ C++ ObjC++ Var(flag_deduce_init_list) In
> >  -fdeduce-init-list     enable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list
> >
> >  fdeclone-ctor-dtor
> > -C++ ObjC++ Var(flag_declone_ctor_dtor) Init(-1)
> > +C++ ObjC++ Var(flag_declone_ctor_dtor) Init(1)
> >  Factor complex constructors and destructors to favor space over speed
> >
> >  fdefault-inline
> > Index: c-family/c-opts.c
> > ===================================================================
> > --- c-family/c-opts.c   (revision 210521)
> > +++ c-family/c-opts.c   (working copy)
> > @@ -906,10 +906,6 @@ c_common_post_options (const char **pfil
> >    if (warn_implicit_function_declaration == -1)
> >      warn_implicit_function_declaration = flag_isoc99;
> >
> > -  /* Declone C++ 'structors if -Os.  */
> > -  if (flag_declone_ctor_dtor == -1)
> > -    flag_declone_ctor_dtor = optimize_size;
> > -
> >    if (cxx_dialect >= cxx11)
> >      {
> >        /* If we're allowing C++0x constructs, don't warn about C++98
> > Index: doc/invoke.texi
> > ===================================================================
> > --- doc/invoke.texi     (revision 210521)
> > +++ doc/invoke.texi     (working copy)
> > @@ -7413,7 +7414,7 @@ clones, which means two copies of the fu
> >  base and complete variants are changed to be thunks that call a common
> >  implementation.
> >
> > -Enabled by @option{-Os}.
> > +Enabled by default.
> >
> >  @item -fdelete-null-pointer-checks
> >  @opindex fdelete-null-pointer-checks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [C++ patch] Enable constructor decloning by default
  2014-05-19 14:45   ` Jan Hubicka
@ 2014-05-19 14:48     ` Jakub Jelinek
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2014-05-19 14:48 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Richard Biener, GCC Patches, Jason Merrill

On Mon, May 19, 2014 at 04:45:02PM +0200, Jan Hubicka wrote:
> > On Sun, May 18, 2014 at 9:32 PM, Jan Hubicka <hubicka@ucw.cz> wrote:
> > > Hi,
> > > this patch enables -fdeclone-ctor-dtor by default: I believe it is up to the
> > > optimizers to decide when the actual worker body should be inlined into the
> > > thunks.
> > >
> > > Bootstrapped/regtested x86_64-linux, OK?
> > 
> > Please make sure to not enable it for -O0 and -Og at least.
> 
> Hmm, I tought this thunk can be implemented without clobbering debug info - 
> all we need is to arrange it to be abstract and not show in unwind info...

I agree with Richard, you don't want to do this for -O0/-Og.
I don't think debuggers can filter functions from unwind info (they can do
that for inlines, but when it is not inlined...), and it will be a terrible
debugging experience if you see extra frame in there.

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-19 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-18 19:32 [C++ patch] Enable constructor decloning by default Jan Hubicka
2014-05-19  9:17 ` Richard Biener
2014-05-19 14:45   ` Jan Hubicka
2014-05-19 14:48     ` Jakub Jelinek

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).