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 8F3E038388CD for ; Thu, 15 Dec 2022 17:52:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F3E038388CD Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=ucw.cz Authentication-Results: sourceware.org; spf=none smtp.mailfrom=kam.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id CFF30284AB4; Thu, 15 Dec 2022 18:52:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1; t=1671126767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=loPF5Cg7obmN0jutdl/yqrU7a23FcAQU8TGj8NrhFyQ=; b=QRPf5Aj22pT3r/2PKBUOvS7i/pvGI5japCQqtWjSgFBbMgSsdLfLBmjjjap157MXGwJwD1 gWl8n/vf2jLVli2GSX44xcM2FdjeQOTCkBJNoY85/+YWePLbt8PkJdCROF+VKGtclCtZ1g jSUmdsKU+609jseZVBHydQWGZx9cpEQ= Date: Thu, 15 Dec 2022 18:52:47 +0100 From: Jan Hubicka To: Richard Biener Cc: Martin Jambor , GCC Patches Subject: Re: [PATCH] ipa-sra: Consider the first parameter of methods safe to dereference Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > On Wed, Dec 14, 2022 at 4:20 PM Jan Hubicka via Gcc-patches > wrote: > > > > > Hi, > > > > > > Honza requested this after reviewing the patch that taught IPA-SRA > > > that REFERENCE_TYPEs are always non-NULL that the pass also handles > > > the first parameters of methods, this pointers, in the same way. So > > > this patch does that. > > > > > > The patch is undergoing bootstrap and testing on an x86_64-linux right > > > now. OK if it passes? > > > > > > Thanks, > > > > > > Martin > > > > > > > > > gcc/ChangeLog: > > > > > > 2022-12-14 Martin Jambor > > > > > > * ipa-sra.cc (create_parameter_descriptors): Consider the first > > > parameter of a method safe to dereference. > > > > > > gcc/testsuite/ChangeLog: > > > > > > 2022-12-14 Martin Jambor > > > > > > * g++.dg/ipa/ipa-sra-6.C: New test. > > > > OK, > > Are you sure that's safe? The docs for METHOD_TYPE doesn't say 'this' > is the first parameter nor does it say methods cannot be invoked for a > nullptr object. > > Do frontends other than C++ create METHOD_TYPE functions? Grep > shows uses in ada and objective C at least. I think for Objective-C++ calling method is also considerd a dereference. We make similar assumptions in devirtualization code for some time. We could also check that the type is METHOD_TYPE satisfies odr_type_p if we want to look specifically for C++ methods. Honza > > > thanks a lot! > > Honza