RFA (cgraph): C++ 'structor decloning patch, Mark III

Jason Merrill jason@redhat.com
Thu Nov 21 19:31:00 GMT 2013


This all started with Stuart Hastings' original decloning patch way back 
in 2002:
   http://gcc.gnu.org/ml/gcc-patches/2002-08/msg00354.html
Bill Maddox tried to revive it in 2007:
   http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01147.html

I'm embarrassed that it has taken so long to get this in.  The main 
source of concern in the past was ABI issues.  But now that we have 
COMDAT groups and precedent for putting multiple [cd]tors into the same 
group for aliasing, I see a solution: make the unified 'tor internal to 
the comdat, so the ABI of the comdat is no different from the cloned case.

I had to change various things in cgraph/ipa in order to support the 
notion of a comdat-local symbol which can only be referenced from within 
that comdat, which is what I'm looking for feedback/approval for.  The 
change to can_refer_decl_in_current_unit_p is not actually necessary, 
but seemed worth adding for possible future use of this functionality.

When decloning is turned on it is done regardless of the size of the 
'tor; we don't need to consider the size because the inliner will clean 
everything up for us.  If the unified function is small enough to inline 
into the thunks, it will do so and then the thunks can themselves be 
inlined into their callers; otherwise, inlining of the thunks is prevented.

The patch enables decloning with -Os, or in the rare case when cloning 
breaks semantics (i.e. in the presence of the GNU label address 
extension, as in the testcase).

OK for trunk?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: declone.patch
Type: text/x-patch
Size: 30156 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131121/a51488c9/attachment.bin>


More information about the Gcc-patches mailing list