Use ODR for canonical types construction in LTO

Nathan Sidwell nathan@acm.org
Wed Jun 19 14:24:00 GMT 2019


On 6/19/19 9:28 AM, Jan Hubicka wrote:
>> Jason,
>> I also wonder if something like this would make sense:
>>
>> 	* decl.c (build_clobber_this): Use original basetype if they
>> 	match.
>>
>> Index: decl.c
>> ===================================================================
>> --- decl.c	(revision 272381)
>> +++ decl.c	(working copy)
>> @@ -15210,7 +15210,11 @@ build_clobber_this ()
>>   
>>     tree ctype = current_class_type;
>>     if (!vbases)
>> -    ctype = CLASSTYPE_AS_BASE (ctype);
>> +    {
>> +      if (!tree_int_cst_equal (TYPE_SIZE (ctype),
>> +			       TYPE_SIZE (CLASSTYPE_AS_BASE (ctype))))
>> +        ctype = CLASSTYPE_AS_BASE (ctype);
>> +    }
>>   
>>     tree clobber = build_clobber (ctype);

I have noticed we build a distinct as-base type in rather more cases 
than strictly necessary.  For instance when there's a member of 
reference type or we have a non-trivial dtor. 
(CLASSTYPE_NON_LAYOUT_POD_P gets set by a bunch of things that don't 
affect ABI layout)

nathan

-- 
Nathan Sidwell



More information about the Gcc-patches mailing list