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]

[C++ PATCH] Optimize C++ comdat ctors/dtors in classes without virtual bases (PR c++/3187, take 4)


Hi!

On Mon, Nov 30, 2009 at 05:36:53PM -0500, Jakub Jelinek wrote:
> 
> Here is the latest version of the cdtor optimization patch.
> The comdat group name is *[CD]5* and if the dtor is virtual, deleting dtor
> is emitted into that comdat group as well.
> libstdc++ symbol version script has been adjusted, so that it exports
> exactly what it used to export before this patch.
> On x86_64-linux this patch saves 21KB of libstdc++.so's .text.

Apparently the previous patch didn't actually put deleting dtors in the D5
comdat group, because expand_or_defer_fn changed again its DECL_COMDAT_GROUP
to the D0 one.  The first patch fixes that by setting DECL_COMDAT_GROUP of
the alias (which doesn't matter much) and of the deleting dtor after that
call.

Unfortunately, when bootstrapping with extra checking patch (second patch)
where I wanted to verify that for classes with comdat virtual dtors we
always emit either both D2 (and D1 alias to it) and D0 dtor, or none of
them, build in libstdc++ revealed that we emit e.g. in complex_io.cc
(reduced testcase attached last, cc1plus -O2 cplx.ii) only the
_ZN1DIi1BIiE1CIiEED2Ev (and _ZN1DIi1BIiE1CIiEED1Ev alias) dtor in
the _ZN1DIi1BIiE1CIiEED5Ev comdat group, but not _ZN1DIi1BIiE1CIiEED0Ev.
The class is extern template class, so either the g++ is buggy and emits
something it never should, because the template is extern, or
putting the *D0* dtors also in the *D5* comdat group is not a good idea.

	Jakub

Attachment: Y477
Description: Text document

Attachment: Y478
Description: Text document

Attachment: cplx.ii
Description: Text document


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