[RFC][PATCH] Extend DCE to remove unnecessary new/delete-pairs

Marc Glisse marc.glisse@inria.fr
Wed Nov 22 21:45:00 GMT 2017


(please try to convince your mailer to use something other than 
Content-Type: application/octet-stream for a patch)

On Tue, 21 Nov 2017, Dominik Inführ wrote:

> this patch tries to extend tree-ssa-dce.c to remove unnecessary 
> new/delete-pairs (it already does that for malloc/free). Clang does it 
> too and it seems to be allowed by 
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3664.html. I’ve 
> bootstrapped/regtested on aarch64-linux and x86_64-linux.

In clang, they (i.e. more or less the authors of the paper you mention) 
went through the trouble of introducing __builtin_operator_new 
specifically so not all calls to operator new were affected, but 
essentially only the calls to the global operator new that come from new 
expressions or from std::allocator. This appears to be a deliberate change 
between N3537 and N3664, although I did not find the rationale.

So you might want to check with the committee if optimizing more calls is 
ok.

-- 
Marc Glisse



More information about the Gcc-patches mailing list