From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 79845 invoked by alias); 20 Feb 2020 12:57:39 -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 79837 invoked by uid 89); 20 Feb 2020 12:57:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=H*c:alternative X-HELO: EUR04-VI1-obe.outbound.protection.outlook.com Received: from mail-eopbgr80043.outbound.protection.outlook.com (HELO EUR04-VI1-obe.outbound.protection.outlook.com) (40.107.8.43) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Feb 2020 12:57:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zBF/TRm1nRqQWSbW9TeGb8ert8wnBNnMJ1wVRis5gdE=; b=Wmaejr+3ohX8KhPERsHy2QdXpe5kFrguH9vJ3ci6+o6KMuUk4T3Lr6ihsLT+AAAaHXDo4owWXOOCefbm9YKJqcZN4JF4+YacTVqtxvGCqvEIuS+R/8EOBHnZiCoVCPZrmczbUKB1XgcYiqdu3LfZarXKwvHa9Pxh2+sjqmJnfMM= Received: from VI1PR08CA0145.eurprd08.prod.outlook.com (2603:10a6:800:d5::23) by AM0PR08MB4484.eurprd08.prod.outlook.com (2603:10a6:208:139::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.27; Thu, 20 Feb 2020 12:57:31 +0000 Received: from DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::207) by VI1PR08CA0145.outlook.office365.com (2603:10a6:800:d5::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2750.18 via Frontend Transport; Thu, 20 Feb 2020 12:57:31 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; gcc.gnu.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;gcc.gnu.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT006.mail.protection.outlook.com (10.152.20.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2750.17 via Frontend Transport; Thu, 20 Feb 2020 12:57:31 +0000 Received: ("Tessian outbound 62d9cfe08e54:v42"); Thu, 20 Feb 2020 12:57:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a68ea6790dd1ede9 X-CR-MTA-TID: 64aa7808 Received: from ed52aa26b169.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id DD842404-FD4A-4DAB-8E3A-CA763D5FEBD4.1; Thu, 20 Feb 2020 12:57:25 +0000 Received: from FRA01-MR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ed52aa26b169.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 20 Feb 2020 12:57:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WnOXo9TPOnjXMpMv09DElL9yFlk47iP8j0SmNqYmLMLrCZ8Rr4l/qHoOhnTMMFZvDVUqByWXhurfkb2fiJVG4sTiaj2sKyqU39/V5+CU/eOCD0fcwKgAO63j0EfEPXth07PT6D/U+rb5bXJWLXcKRVBIouKT0c1oot1kycI4OW2LfYEqyI9bCThg/fg88LntbyswAolBfPPkhDD+Ph5xZ4MUAXBsvqYXkUWartBuV6xIq/6STtQ7PYjM1HsI4GXLwsodUBPtRdbRvDL5DIPn6wdLyw6JgNpyFHIbJ03+sd2MWJJtmoUR7ccGEgamkwlDRZQzHT0h/YgH7EnAvfGNVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zBF/TRm1nRqQWSbW9TeGb8ert8wnBNnMJ1wVRis5gdE=; b=hwQxkadLLneXHQKbvlLv0rfvCoIdLFUFlJklX3OJfjTzOtrTuIEqWFvTdgCxc3M1TYjuIgec2uqnyJUkIm+11iXpaPCCx4EYvje2tAHs019vMd2+4cQCrVLUNmp25HgnpuaYlA+joUTjtJxG6zLnr0uJEYkRxYyQiUb0bSsLz+cOoqa2LZqDNg2jbQpAPYVeaZysOlLROJ/McCPremtitPvVIB6GGqJ6474URzksdLbXhDZXEKGUA3nmeLv/aM/Er3C6nFRxNwKjK3pHt5wyv68gfvwFypEulQvqkjOpbw1VC+V/qwb+eHKd42t0C+Ypt98/xJV3Rx0aC0cCbsoE2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zBF/TRm1nRqQWSbW9TeGb8ert8wnBNnMJ1wVRis5gdE=; b=Wmaejr+3ohX8KhPERsHy2QdXpe5kFrguH9vJ3ci6+o6KMuUk4T3Lr6ihsLT+AAAaHXDo4owWXOOCefbm9YKJqcZN4JF4+YacTVqtxvGCqvEIuS+R/8EOBHnZiCoVCPZrmczbUKB1XgcYiqdu3LfZarXKwvHa9Pxh2+sjqmJnfMM= Received: from PR2PR08MB4747.eurprd08.prod.outlook.com (52.133.111.74) by PR2PR08MB4908.eurprd08.prod.outlook.com (52.133.110.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2729.27; Thu, 20 Feb 2020 12:57:23 +0000 Received: from PR2PR08MB4747.eurprd08.prod.outlook.com ([fe80::ecad:c4ac:c56b:25fb]) by PR2PR08MB4747.eurprd08.prod.outlook.com ([fe80::ecad:c4ac:c56b:25fb%4]) with mapi id 15.20.2729.033; Thu, 20 Feb 2020 12:57:23 +0000 From: Tamar Christina To: Martin Jambor , Feng Xue OS , Jan Hubicka , "gcc-patches@gcc.gnu.org" CC: nd Subject: RE: [PATCH] Fix bug in recursiveness check for function to be cloned (ipa/pr93707) Date: Thu, 20 Feb 2020 12:57:00 -0000 Message-ID: References: In-Reply-To: x-ts-tracking-id: 3cb85186-1ca1-4984-af3f-ff295ae61e8f.0 Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Tamar.Christina@arm.com; x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(366004)(39860400002)(376002)(396003)(346002)(136003)(189003)(199004)(71200400001)(7696005)(6506007)(186003)(478600001)(86362001)(33656002)(4326008)(66476007)(64756008)(316002)(66446008)(66556008)(76116006)(81166006)(8676002)(2906002)(81156014)(55016002)(9686003)(66946007)(8936002)(91956017)(5660300002)(110136005)(52536014);DIR:OUT;SFP:1101;SCL:1;SRVR:PR2PR08MB4908;H:PR2PR08MB4747.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: HurAKMBq50f/lkIKzOnRH/+1zNyD5+Uk66guBo2UwuYk0xX4rxydnmc1EKlorKI150t+LBekR2fkPQhK5V2I0c5IA1KTVBEXk6O76Cct5dkT9MGN+dWG6zVDy503E7UAM0EyEp+fwdCCBesVVun45Arl3sPii3nyBCZn9KyhhOJfEZxUKhWhH1VyDeyqNxtCnaA8i0eyvlVXt/edviKBsS9wF1dcMETKi9s5WQctuzH54VadpArbsaN6ZXGtHsu3G9jRT/AlLmeyLsr7q10ELH6OmPUawf8iw3olLj+S044eTtaOQ8GwLlXhi/4q0cv01Nx4O0Cm7fwkXC7EX/NLmkgh5cAqJpESNaxCA7ex7N/nYlWMB0hBjYiqRM3x11QpswSQiCAnMhr93xLs/mKrx5VtwgZ/xwBuOfiyBZBZxtwJmQ9raVOkufxMKp79lMO3 x-ms-exchange-antispam-messagedata: UhD+SMwKcHAH/bc/rEAOC15XcUh3qU5hDEX1hDXLEpE5IuUa182UBijUOfVKlkR7lP0qkAW01V6Mm5M0u+eZek4VW2Kvn7641+25Uby0GGsXwDxFVEbbtvho52onZuQiPq5UV78pwQIDvijhvpRzPJiVHCM2bWKNvf16LcC4czUdcaiZpM+ucQVIAUggOvTqqcp4HNVh+JYI9hTbliUFpw== x-ms-exchange-transport-forked: True MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tamar.Christina@arm.com; Return-Path: Tamar.Christina@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT006.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 87c8a510-5a1f-4e14-4d0b-08d7b6046df7 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg01159.txt.bz2 Hi Martin, > Honza, is it OK for trunk? Tamar, can you please double check it fixes > your problem with perlbench? > Thanks for working on this! Yes it does seem to fix the regression as well. Cheers, Tamar > Thanks, > > Martin > > > ipa-cp: Avoid wrongly gathering self-recursive edges (PR 93707) > > 2020-02-18 Martin Jambor > Feng Xue > > PR ipa/93707 > * ipa-cp.c (same_node_or_its_all_contexts_clone_p): Replaced with > new function calls_same_node_or_its_all_contexts_clone_p. > (cgraph_edge_brings_value_p): Use it. Fix comment. > (cgraph_edge_brings_value_p): Likewise. > > testsuite/ > * gcc.dg/ipa/pr93707.c: New test. > --- > gcc/ChangeLog | 9 +++++++++ > gcc/ipa-cp.c | 29 ++++++++++++++--------------- > gcc/testsuite/ChangeLog | 6 ++++++ > gcc/testsuite/gcc.dg/ipa/pr93707.c | 29 > +++++++++++++++++++++++++++++ > 4 files changed, 58 insertions(+), 15 deletions(-) > create mode 100644 gcc/testsuite/gcc.dg/ipa/pr93707.c > > diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c > index 4f5b72e6994..4609375bf8d 100644 > --- a/gcc/ipa-cp.c > +++ b/gcc/ipa-cp.c > @@ -4033,15 +4033,23 @@ edge_clone_summary_t::duplicate > (cgraph_edge *src_edge, cgraph_edge *dst_edge, > src_data->next_clone =3D dst_edge; > } > > -/* Return true is NODE is DEST or its clone for all contexts. */ > +/* Return true is CS calls DEST or its clone for all contexts, except for > + self-recursive nodes in which it has to be DEST itself. */ > > static bool > -same_node_or_its_all_contexts_clone_p (cgraph_node *node, > cgraph_node *dest) > +calls_same_node_or_its_all_contexts_clone_p (cgraph_edge *cs, > cgraph_node *dest) > { > - if (node =3D=3D dest) > + enum availability availability; > + cgraph_node *callee =3D cs->callee->function_symbol (&availability); > + > + if (availability <=3D AVAIL_INTERPOSABLE) > + return false; > + if (callee =3D=3D dest) > return true; > + if (cs->caller =3D=3D callee) > + return false; > > - class ipa_node_params *info =3D IPA_NODE_REF (node); > + class ipa_node_params *info =3D IPA_NODE_REF (callee); > return info->is_all_contexts_clone && info->ipcp_orig_node =3D=3D dest; > } > > @@ -4053,11 +4061,8 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, > ipcp_value_source *src, > cgraph_node *dest, ipcp_value *dest_val) > { > class ipa_node_params *caller_info =3D IPA_NODE_REF (cs->caller); > - enum availability availability; > - cgraph_node *real_dest =3D cs->callee->function_symbol (&availability); > > - if (availability <=3D AVAIL_INTERPOSABLE > - || !same_node_or_its_all_contexts_clone_p (real_dest, dest) > + if (!calls_same_node_or_its_all_contexts_clone_p (cs, dest) > || caller_info->node_dead) > return false; > > @@ -4076,9 +4081,6 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, > ipcp_value_source *src, > } > else > { > - /* At the moment we do not propagate over arithmetic jump function= s in > - SCCs, so it is safe to detect self-feeding recursive calls in this > - way. */ > if (src->val =3D=3D dest_val) > return true; > > @@ -4113,11 +4115,8 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, > ipcp_value *) > { > class ipa_node_params *caller_info =3D IPA_NODE_REF (cs->caller); > - enum availability avail; > - cgraph_node *real_dest =3D cs->callee->function_symbol (&avail); > > - if (avail <=3D AVAIL_INTERPOSABLE > - || !same_node_or_its_all_contexts_clone_p (real_dest, dest) > + if (!calls_same_node_or_its_all_contexts_clone_p (cs, dest) > || caller_info->node_dead) > return false; > if (!src->val) > diff --git a/gcc/testsuite/gcc.dg/ipa/pr93707.c > b/gcc/testsuite/gcc.dg/ipa/pr93707.c > new file mode 100644 > index 00000000000..e200a3a432b > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/ipa/pr93707.c > @@ -0,0 +1,29 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O3 --param ipa-cp-eval-threshold=3D1" } */ > + > +int foo(); > +int data[100]; > + > +__attribute__((noinline)) static int recur_fn (int i, int j, int depth) > +{ > + if (depth > 10) > + return 1; > + > + data[i + j]++; > + > + if (depth & 3) > + recur_fn (i, 1, depth + 1); > + else > + recur_fn (i, j & 1, depth + 1); > + > + foo(); > + > + return i + j; > +} > + > +int caller (int v, int depth) > +{ > + recur_fn (1, v, depth); > + > + return 0; > +} > -- > 2.25.0