From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 8E1113857C45 for ; Wed, 23 Sep 2020 18:42:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8E1113857C45 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C4268AC6E; Wed, 23 Sep 2020 18:43:34 +0000 (UTC) Date: Wed, 23 Sep 2020 20:42:55 +0200 User-Agent: K-9 Mail for Android In-Reply-To: <5878a705-6101-d7ac-fe11-13664a53b220@redhat.com> References: <5878a705-6101-d7ac-fe11-13664a53b220@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH] tree-optimization/97151 - improve PTA for C++ operator delete To: Jason Merrill ,gcc-patches@gcc.gnu.org From: Richard Biener Message-ID: <0A92F1D5-5521-4F1A-B297-6637479FB278@suse.de> X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Wed, 23 Sep 2020 18:42:59 -0000 On September 23, 2020 7:53:18 PM GMT+02:00, Jason Merrill wrote: >On 9/23/20 4:14 AM, Richard Biener wrote: >> C++ operator delete, when DECL_IS_REPLACEABLE_OPERATOR_DELETE_P, >> does not cause the deleted object to be escaped=2E It also has no >> other interesting side-effects for PTA so skip it like we do >> for BUILT_IN_FREE=2E > >Hmm, this is true of the default implementation, but since the function > >is replaceable, we don't know what a user definition might do with the=20 >pointer=2E But can the object still be 'used' after delete? Can delete fail / throw? What guarantee does the predicate give us?=20 >> Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed=2E >>=20 >> Richard=2E >>=20 >> 2020-09-23 Richard Biener >>=20 >> PR tree-optimization/97151 >> * tree-ssa-structalias=2Ec (find_func_aliases_for_call): >> DECL_IS_REPLACEABLE_OPERATOR_DELETE_P has no effect on >> arguments=2E >>=20 >> * g++=2Edg/cpp1y/new1=2EC: Adjust for two more handled transforms=2E >> --- >> gcc/testsuite/g++=2Edg/cpp1y/new1=2EC | 4 ++-- >> gcc/tree-ssa-structalias=2Ec | 2 ++ >> 2 files changed, 4 insertions(+), 2 deletions(-) >>=20 >> diff --git a/gcc/testsuite/g++=2Edg/cpp1y/new1=2EC >b/gcc/testsuite/g++=2Edg/cpp1y/new1=2EC >> index aa5f647d535=2E=2Efec0088cb40 100644 >> --- a/gcc/testsuite/g++=2Edg/cpp1y/new1=2EC >> +++ b/gcc/testsuite/g++=2Edg/cpp1y/new1=2EC >> @@ -69,5 +69,5 @@ test_unused() { >> delete p; >> } >> =20 >> -/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 5 >"cddce1"} } */ >> -/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ =3D operator >new" 7 "cddce1"} } */ >> +/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 6 >"cddce1"} } */ >> +/* { dg-final { scan-tree-dump-times "Deleting : _\\d+ =3D operator >new" 8 "cddce1"} } */ >> diff --git a/gcc/tree-ssa-structalias=2Ec b/gcc/tree-ssa-structalias=2E= c >> index 44fe52e0f65=2E=2Ef676bf91e95 100644 >> --- a/gcc/tree-ssa-structalias=2Ec >> +++ b/gcc/tree-ssa-structalias=2Ec >> @@ -4857,6 +4857,8 @@ find_func_aliases_for_call (struct function >*fn, gcall *t) >> point for reachable memory of their arguments=2E */ >> else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE)) >> handle_pure_call (t, &rhsc); >> + else if (fndecl && DECL_IS_REPLACEABLE_OPERATOR_DELETE_P >(fndecl)) >> + ; >> else >> handle_rhs_call (t, &rhsc); >> if (gimple_call_lhs (t)) >>=20