From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id A1380385BF92 for ; Fri, 3 Apr 2020 15:26:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A1380385BF92 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=hubicka@kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 3CBEA280435; Fri, 3 Apr 2020 17:26:09 +0200 (CEST) Date: Fri, 3 Apr 2020 17:26:09 +0200 From: Jan Hubicka To: Martin =?iso-8859-2?Q?Li=B9ka?= Cc: Richard Biener , GCC Patches , Marc Glisse Subject: Re: [PATCH] Check DECL_CONTEXT of new/delete operators. Message-ID: <20200403152609.GA35629@kam.mff.cuni.cz> References: <20200331122907.GB62067@kam.mff.cuni.cz> <65230a52-c025-a6e3-0d31-409d37e9b2c9@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <65230a52-c025-a6e3-0d31-409d37e9b2c9@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-31.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Apr 2020 15:26:12 -0000 > On 3/31/20 2:29 PM, Jan Hubicka wrote: > > Well, I basically went through all pointers and tried to get rid of as > > many of them as possible. CONTEXT pointers do increase size of SCCs > > that increases chance they will not get merged and also processing time > > of merging algorithm. I guess if we need to stream more contexts we > > could do that (and check the effect on merging and average SCC size) > > Ok, do we want to stream contexts just for the new/delete operators? > Can you please prepare a streaming patch? Hi, I am still not convinced that context is useful here. It took me a while to understand what the code does and why it fails, but here is a testcase. It fails for me with your patch and -O2 --param early-inlining-insns=100 The invalid transform is to remove pair base:new and B:delete B:new gets inlined and we get count out of sync. Honza #include volatile int idx; struct base { __attribute__((malloc,noinline)) static void* operator new(unsigned long sz) { return ::operator new(sz); } __attribute__((malloc,noinline)) static void operator delete(void* ptr) { --count[idx]; ::operator delete(ptr); } volatile static int count[2]; }; volatile int base::count[2] = {0,0}; struct B:base { static void* operator new(unsigned long sz) { ++count[idx]; return base::operator new(sz); } }; volatile int c=1; int main(){ for (int i; i