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

2018-05-13 Thread Marc Glisse
On Wed, 29 Nov 2017, David Malcolm wrote: I was experimenting with optimizing away matching malloc/free pairs, moving the allocation to either the stack, or to a thread-local obstack, under certain conditions, or to hoist allocations out of loops. I didn't get any significant wins, but much of

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

2017-12-04 Thread Trevor Saunders
On Wed, Nov 29, 2017 at 08:56:44AM -0700, Martin Sebor wrote: > On 11/29/2017 01:30 AM, Jakub Jelinek wrote: > > On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: > > > On 11/27/2017 02:22 AM, Dominik Inführ wrote: > > > > Thanks for all the reviews! I’ve revised the patch, the > > > >

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

2017-11-30 Thread Jeff Law
On 11/29/2017 01:30 AM, Jakub Jelinek wrote: > On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: >> On 11/27/2017 02:22 AM, Dominik Inführ wrote: >>> Thanks for all the reviews! I’ve revised the patch, the >>> operator_delete_flag is now stored in tree_decl_with_vis (there already >>>

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

2017-11-30 Thread Jeff Law
On 11/28/2017 09:11 PM, Martin Sebor wrote: > On 11/27/2017 02:22 AM, Dominik Inführ wrote: >> Thanks for all the reviews! I’ve revised the patch, the >> operator_delete_flag is now stored in tree_decl_with_vis (there >> already seem to be some FUNCTION_DECL-flags in there). I’ve also added >> the

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

2017-11-29 Thread Richard Biener
On November 29, 2017 4:56:44 PM GMT+01:00, Martin Sebor wrote: >On 11/29/2017 01:30 AM, Jakub Jelinek wrote: >> On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: >>> On 11/27/2017 02:22 AM, Dominik Inführ wrote: Thanks for all the reviews! I’ve revised the patch, the >operator_de

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

2017-11-29 Thread Andrew Pinski
On Wed, Nov 29, 2017 at 8:15 AM, David Malcolm wrote: > On Wed, 2017-11-29 at 08:56 -0700, Martin Sebor wrote: >> On 11/29/2017 01:30 AM, Jakub Jelinek wrote: >> > On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: >> > > On 11/27/2017 02:22 AM, Dominik Inführ wrote: >> > > > Thanks for

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

2017-11-29 Thread David Malcolm
On Wed, 2017-11-29 at 08:56 -0700, Martin Sebor wrote: > On 11/29/2017 01:30 AM, Jakub Jelinek wrote: > > On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: > > > On 11/27/2017 02:22 AM, Dominik Inführ wrote: > > > > Thanks for all the reviews! I’ve revised the patch, the > > > > operato

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

2017-11-29 Thread Martin Sebor
On 11/29/2017 01:30 AM, Jakub Jelinek wrote: On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: On 11/27/2017 02:22 AM, Dominik Inführ wrote: Thanks for all the reviews! I’ve revised the patch, the operator_delete_flag is now stored in tree_decl_with_vis (there already seem to be so

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

2017-11-29 Thread Jakub Jelinek
On Tue, Nov 28, 2017 at 09:11:00PM -0700, Martin Sebor wrote: > On 11/27/2017 02:22 AM, Dominik Inführ wrote: > > Thanks for all the reviews! I’ve revised the patch, the > > operator_delete_flag is now stored in tree_decl_with_vis (there already > > seem to be some FUNCTION_DECL-flags in there).

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

2017-11-28 Thread Martin Sebor
On 11/27/2017 02:22 AM, Dominik Inführ wrote: Thanks for all the reviews! I’ve revised the patch, the operator_delete_flag is now stored in tree_decl_with_vis (there already seem to be some FUNCTION_DECL-flags in there). I’ve also added the option -fallocation-dce to disable this optimization.

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

2017-11-28 Thread Jakub Jelinek
On Tue, Nov 28, 2017 at 12:52:12PM +0100, Richard Biener wrote: > On Mon, Nov 27, 2017 at 5:58 PM, Jeff Law wrote: > > On 11/27/2017 02:22 AM, Dominik Inführ wrote: > >> Thanks for all the reviews! I’ve revised the patch, the > >> operator_delete_flag is now stored in tree_decl_with_vis (there al

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

2017-11-28 Thread Richard Biener
On Mon, Nov 27, 2017 at 5:58 PM, Jeff Law wrote: > On 11/27/2017 02:22 AM, Dominik Inführ wrote: >> Thanks for all the reviews! I’ve revised the patch, the operator_delete_flag >> is now stored in tree_decl_with_vis (there already seem to be some >> FUNCTION_DECL-flags in there). I’ve also added

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

2017-11-27 Thread Jeff Law
On 11/27/2017 02:22 AM, Dominik Inführ wrote: > Thanks for all the reviews! I’ve revised the patch, the operator_delete_flag > is now stored in tree_decl_with_vis (there already seem to be some > FUNCTION_DECL-flags in there). I’ve also added the option -fallocation-dce to > disable this optimiz

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

2017-11-27 Thread Jakub Jelinek
On Mon, Nov 27, 2017 at 10:22:52AM +0100, Dominik Inführ wrote: > @@ -4195,8 +4198,10 @@ cxx_init_decl_processing (void) > deltype = cp_build_type_attribute_variant (void_ftype_ptr_size, > extvisattr); > deltype = build_exception_variant

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

2017-11-27 Thread Dominik Inführ
Thanks for all the reviews! I’ve revised the patch, the operator_delete_flag is now stored in tree_decl_with_vis (there already seem to be some FUNCTION_DECL-flags in there). I’ve also added the option -fallocation-dce to disable this optimization. It bootstraps and no regressions on aarch64 and

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

2017-11-22 Thread Marc Glisse
(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

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

2017-11-22 Thread Jeff Law
On 11/22/2017 03:31 AM, Martin Jambor wrote: > On Tue, Nov 21 2017, Jeff Law wrote: >> On 11/21/2017 04:14 AM, Dominik Inführ wrote: >>> Hi, >>> >>> 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 >>> a

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

2017-11-22 Thread Nathan Sidwell
On 11/22/2017 08:59 AM, Richard Biener wrote: Anything else can be done as followup and need not be done as part of this patch. An enum for this would work I guess. I've added this to https://gcc.gnu.org/wiki/ImprovementProjects: Compress DECL flags tree-core defines a number of bit fla

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

2017-11-22 Thread Richard Biener
On Wed, Nov 22, 2017 at 1:47 PM, Nathan Sidwell wrote: > On 11/21/2017 06:14 AM, Dominik Inführ wrote: >> >> Hi, >> >> 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 >> h

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

2017-11-22 Thread Nathan Sidwell
On 11/21/2017 06:14 AM, Dominik Inführ wrote: Hi, 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

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

2017-11-22 Thread Jakub Jelinek
On Wed, Nov 22, 2017 at 10:30:29AM +0100, Richard Biener wrote: > --- a/gcc/tree-core.h > +++ b/gcc/tree-core.h > @@ -1787,7 +1787,9 @@ struct GTY(()) tree_function_decl { >unsigned has_debug_args_flag : 1; >unsigned tm_clone_flag : 1; >unsigned versioned_function : 1; > - /* No bits l

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

2017-11-22 Thread Martin Jambor
On Tue, Nov 21 2017, Jeff Law wrote: > On 11/21/2017 04:14 AM, Dominik Inführ wrote: >> Hi, >> >> 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

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

2017-11-22 Thread Richard Biener
On Tue, Nov 21, 2017 at 12:14 PM, Dominik Inführ wrote: > Hi, > > 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/201

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

2017-11-21 Thread Jeff Law
On 11/21/2017 10:30 AM, Dominik Inführ wrote: > Thanks for the reply, I know that it’s too late for GCC 8. I wanted to get > some feedback on this patch, so I could address all issues until GCC 9 > development starts. But I suppose it is better to just post it again later. The problem is most fol

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

2017-11-21 Thread Dominik Inführ
Thanks for the reply, I know that it’s too late for GCC 8. I wanted to get some feedback on this patch, so I could address all issues until GCC 9 development starts. But I suppose it is better to just post it again later. Dominik > On 21 Nov 2017, at 18:09, Jeff Law wrote: > > On 11/21/2017 0

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

2017-11-21 Thread Jeff Law
On 11/21/2017 04:14 AM, Dominik Inführ wrote: > Hi, > > 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.ht

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

2017-11-21 Thread Dominik Inführ
Hi, 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_