From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101341 invoked by alias); 28 Nov 2017 12:26:06 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 101329 invoked by uid 89); 28 Nov 2017 12:26:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=BAYES_00,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=Hx-languages-length:1972 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Nov 2017 12:26:04 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B063480F95; Tue, 28 Nov 2017 12:26:03 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 32A4A5D9C6; Tue, 28 Nov 2017 12:26:03 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vASCQ0WI004855; Tue, 28 Nov 2017 13:26:00 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vASCPwuc004854; Tue, 28 Nov 2017 13:25:58 +0100 Date: Tue, 28 Nov 2017 14:48:00 -0000 From: Jakub Jelinek To: Richard Biener Cc: Jeff Law , Dominik =?iso-8859-1?Q?Inf=FChr?= , GCC Patches Subject: Re: [RFC][PATCH] Extend DCE to remove unnecessary new/delete-pairs Message-ID: <20171128122558.GR2353@tucnak> Reply-To: Jakub Jelinek References: <8305B5F4-2A96-4698-8C2E-3255658B5C12@theobroma-systems.com> <20171122103742.GN14653@tucnak> <91311448-f8e5-6ea1-430b-e2597ff61317@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02402.txt.bz2 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 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. > >> > >> 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? > > Just a nit. Make sure to mention BZ 23383 in your ChangeLog entry. > > Like this: > > > > c++/23383 > > * tree-core.h (blah blah): What changed. > > > > > > Jakub and Richi probably have a better understanding of the builtin > > mechanisms than I do. I'll leave it for them to comment on how best to > > proceed there. > > I don't see why a builtin is necessary, can the FE not see which one > is the global allocation function? It should, and finding it by namespace and name is IMHO not a hack, that is how the C++ standard specifies those. > Anyways, there are no FE specific builtins, traditionally FEs have > used special keywords - you might > want to search for RID_BUILTIN_LAUNDER for example. Those are there just for parsing them, there is nothing special needed to parse the standard new/delete operators. Jakub