From: Martin Sebor <msebor@gmail.com>
To: "Dominik Inführ" <dominik.infuehr@theobroma-systems.com>,
"Jakub Jelinek" <jakub@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC][PATCH] Extend DCE to remove unnecessary new/delete-pairs
Date: Wed, 29 Nov 2017 08:13:00 -0000 [thread overview]
Message-ID: <ec89be92-a232-5e34-e482-493b9babb65b@gmail.com> (raw)
In-Reply-To: <BC60F078-9257-4E4F-8D94-7C41F7C7B802@theobroma-systems.com>
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. It bootstraps and no regressions on aarch64 and x86_64.
>
It's great to be able to eliminate pairs of these calls. For
unpaired calls, though, I think it would be even more useful to
also issue a warning. Otherwise the elimination will mask bugs
that might only show up without optimization, or with other
compilers (such as older versions of GCC). I realize GCC doesn't
warn for these bugs involving malloc, but I think it should for
the same reason.
> The problem with this patch is what Marc noticed: it omits too many allocations. The C++ standard seems to only allow to omit "replaceable global allocation functions (18.6.1.1, 18.6.1.2)”. So e.g. no class-specific or user-defined allocations. I am not sure what’s the best way to implement this. Just checking the function declarations might not be enough and seems more like a hack. The better way seems to introduce a __builtin_operator_new like Marc mentioned. In which way would you implement this? Could you please give me some pointers here to look at?
I'm not sure there is a way to do it other than by comparing
the name. To see where to insert the built-in and when, you
might want to look at cp/init.c.
Martin
>
> Thanks,
> Dominik
>
>
>
>
>> On 22 Nov 2017, at 11:37, Jakub Jelinek <jakub@redhat.com> wrote:
>>
>> 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 left. */
>>> +
>>> + unsigned operator_delete_flag : 1;
>>> + /* 31 bits left. */
>>>
>>> while it looks bad reality is that on 64bit pointer hosts we had 32 bits left.
>>
>> But we can just add it to say tree_decl_common which has 14 spare bits or
>> tree_decl_with_vis which has another 14 spare bits. By just noting the flag
>> applies only to FUNCTION_DECLs and enforcing it in the tree.h macros,
>> it will be easy to reuse that bit for something different for trees other
>> than FUNCTION_DECL.
>>
>> Jakub
>
next prev parent reply other threads:[~2017-11-29 4:11 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-21 11:35 Dominik Inführ
2017-11-21 17:13 ` Jeff Law
2017-11-21 17:36 ` Dominik Inführ
2017-11-21 17:45 ` Jeff Law
2017-11-22 10:40 ` Martin Jambor
2017-11-22 18:03 ` Jeff Law
2017-11-22 9:33 ` Richard Biener
2017-11-22 10:41 ` Jakub Jelinek
2017-11-27 9:57 ` Dominik Inführ
2017-11-27 10:48 ` Jakub Jelinek
2017-11-27 17:04 ` Jeff Law
2017-11-28 11:55 ` Richard Biener
2017-11-28 14:48 ` Jakub Jelinek
2017-11-29 8:13 ` Martin Sebor [this message]
2017-11-29 9:33 ` Jakub Jelinek
2017-11-29 16:29 ` Martin Sebor
2017-11-29 16:53 ` David Malcolm
2017-11-29 17:01 ` Andrew Pinski
2018-05-13 17:19 ` Marc Glisse
2019-07-02 11:49 ` [PATCH 1/2] Come up with function_decl_type and use it in tree_function_decl Martin Liška
2019-07-02 11:50 ` [PATCH 2/2] Extend DCE to remove unnecessary new/delete-pairs (PR c++/23383) Martin Liška
2019-08-02 21:34 ` H.J. Lu
2019-08-05 6:44 ` [PATCH] Handle new operators with no arguments in DCE Martin Liška
2019-08-05 7:08 ` Marc Glisse
2019-08-05 9:53 ` Martin Liška
2019-08-05 11:57 ` Marc Glisse
2019-08-05 12:52 ` Martin Liška
2019-08-05 13:46 ` Marc Glisse
2019-08-06 14:07 ` Martin Liška
2019-08-06 15:35 ` [PATCH] Detect not-cloned new/delete operators " Martin Liška
2019-08-06 15:59 ` Marc Glisse
2019-08-07 9:31 ` Martin Liška
2019-08-07 10:15 ` Richard Biener
2019-08-06 17:30 ` Martin Jambor
2019-08-07 8:56 ` Martin Liška
2019-08-07 9:54 ` [PATCH] Handle new operators with no arguments " Richard Biener
2019-08-07 11:36 ` Martin Liška
2019-08-07 11:51 ` Jakub Jelinek
2019-08-07 12:06 ` Martin Liška
2019-08-07 14:35 ` Richard Biener
2019-08-08 9:01 ` Martin Liška
2019-08-15 11:06 ` Martin Liška
2019-08-15 11:35 ` Richard Biener
2019-08-05 12:13 ` Richard Biener
2019-07-02 16:02 ` [PATCH 1/2] Come up with function_decl_type and use it in tree_function_decl Martin Sebor
2019-07-02 17:15 ` Marc Glisse
2019-07-03 15:03 ` Martin Liška
2019-07-03 16:44 ` Richard Biener
2019-07-04 22:21 ` Marc Glisse
2019-07-08 13:02 ` Martin Liška
2019-07-08 22:00 ` Jason Merrill
2019-07-09 2:28 ` Marc Glisse
2019-07-09 7:52 ` Marc Glisse
2019-07-09 8:49 ` Martin Liška
2019-07-09 10:22 ` Marc Glisse
2019-07-09 21:02 ` Jason Merrill
2019-07-11 6:48 ` Martin Liška
2019-07-22 14:00 ` Martin Liška
2019-07-24 19:05 ` Jeff Law
2019-07-25 10:24 ` Richard Biener
2019-07-25 2:17 ` Marc Glisse
2019-07-25 8:34 ` Martin Liška
2019-07-25 12:21 ` Marc Glisse
2019-07-25 13:50 ` Martin Liška
2019-07-25 15:41 ` Martin Liška
2019-07-28 21:50 ` [PATCH] Remove also 2nd argument for unused delete operator (PR tree-optimization/91270) Martin Liška
2019-07-29 10:03 ` Richard Biener
2019-07-29 10:54 ` Martin Liška
2019-07-29 14:40 ` Richard Biener
2019-07-30 7:48 ` Martin Liška
2019-07-30 8:09 ` Martin Liška
2019-07-30 8:42 ` Richard Biener
2019-07-30 10:20 ` Martin Liška
2019-07-30 10:28 ` Richard Biener
2019-07-30 12:08 ` Marc Glisse
2019-07-30 12:12 ` Martin Liška
2019-07-30 13:14 ` Marc Glisse
2019-07-30 13:41 ` Martin Liška
2019-07-30 14:37 ` Marc Glisse
2019-07-31 8:42 ` [PATCH] Mark necessary 2nd and later args for delete op Martin Liška
2019-07-31 10:24 ` Richard Biener
2019-07-31 10:00 ` [PATCH] Remove also 2nd argument for unused delete operator (PR tree-optimization/91270) Richard Biener
2019-07-29 9:59 ` [PATCH 1/2] Come up with function_decl_type and use it in tree_function_decl Richard Biener
2017-11-29 18:05 ` [RFC][PATCH] Extend DCE to remove unnecessary new/delete-pairs Richard Biener
2017-12-04 12:20 ` Trevor Saunders
2017-12-01 1:24 ` Jeff Law
2017-12-01 1:23 ` Jeff Law
2017-11-22 13:03 ` Nathan Sidwell
2017-11-22 14:18 ` Richard Biener
2017-11-22 14:45 ` Nathan Sidwell
2017-11-22 21:45 ` Marc Glisse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ec89be92-a232-5e34-e482-493b9babb65b@gmail.com \
--to=msebor@gmail.com \
--cc=dominik.infuehr@theobroma-systems.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).