[PATCH] Allow new/delete operator deletion only for replaceable.

Jason Merrill jason@redhat.com
Wed Apr 8 13:20:07 GMT 2020


On 4/8/20 4:47 AM, Richard Biener wrote:
> On Tue, Apr 7, 2020 at 5:01 PM Martin Liška <mliska@suse.cz> wrote:
>>
>> Hi.
>>
>> The patch allows DCE to remove only replaceable operators new and delete.
>> That's achieved by proper mark up of all these operators in C++ FE.
>> The patch also brings all tests we've collected so far for the PR.
>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
> 
> Grepping for uses of DECL_IS_OPERATOR_* reveals you miss comparing
> the new flag in ipa-icf.c and cgraph node dumping in cgraph.c might want
> to dump it as well.
> 
> Otherwise it looks reasonable.
> 
> So the mid-end parts are OK in case FE people are happy with this solution
> for GCC 10.

This seems fine for GCC 10, though I wonder about using an attribute for 
DECL_REPLACEABLE_OPERATOR rather than taking a bit in all FUNCTION_DECLs 
that will only ever be set on a small handful.

For GCC 11 we probably want to make the distinction Jonathan mentions 
between new-expressions and direct calls to operator new.

Jason



More information about the Gcc-patches mailing list