From patchwork Tue May 2 23:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 89515 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp953003vqo; Tue, 2 May 2023 16:15:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6sV9v6Rkdu2ZoCvsLpTlY3f8cU/rnabl/W1O7w1cDaEvT4YQk89wqeX93fN7rED68Qodcj X-Received: by 2002:a17:907:9694:b0:94a:6a7a:52d8 with SMTP id hd20-20020a170907969400b0094a6a7a52d8mr1678072ejc.71.1683069314724; Tue, 02 May 2023 16:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683069314; cv=none; d=google.com; s=arc-20160816; b=OzjD/5ge8dnu/cBHNzWP4s5Es/ij2Xv6uMw0cFO/YHVViLBIx8JRRlJulpria3dyHO lXHFEio8ft37WzxhBNuSTOAvFEp2ZZDvV50n6YPcrY5uFa8O8NZ7zBZnOuKG4v0K+iDS J4iYfkwHC/bPKfjhzoxz4Ui9RFDdaLEAItZ02v4qYj4x/TuuxxlJp8JxQpzjVu31w1mw uw0M+/njC8H/EMVIzM5cClffkhp91C7Fw/pmqsZvfp1ZHFPHXL8u1FOJ+4AhuEnK185D nZYNkFke8Lcru98fGK1xMHA6LwHERDoXJx/AL0SvI6QN1NmCfh75FO5pGMT9uuvwhXEV NDeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=1TOXmfiwQXa41NDMl5+QoDrG8TxbjWvkv7fULuYztlc=; b=ql4aAfiDbTqXkN1ETXg27uboOgGGOWQksmHq496wcYdmdoCmwf9l0WPlsvA88IhExD 2gc6wfGV/SkZ1rJIPnREBe6vIvJDMj5wEJWdKg1U6NPztxKsRLomYBfw1dMBqIyzbg46 nRpLT5apSnGr/023CmoR9Nk4Zg3ymptVQjd92Q9haabYOBrQ/m9misKoFUhNrqyENAMG cAWP6FjWPggqFMf+NwxUScNrjMu0PiGjXKgvmHHV1C2Yyc6BKngIoFB483ruCVNintUW +NM/M5ZBh6P+TUDSyLGQJhMBGMpqZFhvPGnS2ryne62srF4Fb0YoLYgChxZ+p1hBJVnK PHFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VAuvP+co; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s22-20020a170906bc5600b0094f2948b15csi18788429ejv.205.2023.05.02.16.15.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 16:15:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=VAuvP+co; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EC2333858D1E for ; Tue, 2 May 2023 23:15:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC2333858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683069313; bh=1TOXmfiwQXa41NDMl5+QoDrG8TxbjWvkv7fULuYztlc=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=VAuvP+coDloYX2jNqZeOpNBN90AQ5auY9DDPj9cFfosKYJ+n/n2iBNY0LIdNiQT6p ef3QGIvkrHfUoyAZZgyY0qsHGafcfiqRSkCsj6U2tEke0le+sjjiDFnm20fgYcOiDL PJjN+0YU95BOASyKpgP/aiF3FbtkJ6JUtDKI1EpQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by sourceware.org (Postfix) with ESMTPS id 1A12F3858D1E for ; Tue, 2 May 2023 23:14:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A12F3858D1E Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 342K5fNk026446 for ; Tue, 2 May 2023 16:14:27 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qavhem1c1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 02 May 2023 16:14:27 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 2 May 2023 16:14:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 2 May 2023 16:14:26 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id DE5963F705D; Tue, 2 May 2023 16:14:25 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH] Add stats to simple_dce_from_worklist Date: Tue, 2 May 2023 16:14:17 -0700 Message-ID: <20230502231417.872953-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: nJ2BFpopo3BZcHXv_bGWCLrJTqW4QWsy X-Proofpoint-GUID: nJ2BFpopo3BZcHXv_bGWCLrJTqW4QWsy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-02_12,2023-04-27_01,2023-02-09_01 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Andrew Pinski via Gcc-patches From: Andrew Pinski Reply-To: Andrew Pinski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764826089976924501?= X-GMAIL-MSGID: =?utf-8?q?1764826089976924501?= While looking to move substitute_and_fold_engine over to use simple_dce_from_worklist, I noticed that we don't record the stats of the removed stmts/phis. So this does that. OK? Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * tree-ssa-dce.cc (simple_dce_from_worklist): Record stats on removed number of statements and phis. --- gcc/tree-ssa-dce.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc index 1fd88e8ee37..86a33e1a40d 100644 --- a/gcc/tree-ssa-dce.cc +++ b/gcc/tree-ssa-dce.cc @@ -2099,6 +2099,8 @@ make_pass_cd_dce (gcc::context *ctxt) void simple_dce_from_worklist (bitmap worklist) { + long phiremoved = 0; + long stmtremoved = 0; while (! bitmap_empty_p (worklist)) { /* Pop item. */ @@ -2144,12 +2146,20 @@ simple_dce_from_worklist (bitmap worklist) } gimple_stmt_iterator gsi = gsi_for_stmt (t); if (gimple_code (t) == GIMPLE_PHI) - remove_phi_node (&gsi, true); + { + remove_phi_node (&gsi, true); + phiremoved++; + } else { unlink_stmt_vdef (t); gsi_remove (&gsi, true); release_defs (t); + stmtremoved++; } } + statistics_counter_event (cfun, "PHIs removed", + phiremoved); + statistics_counter_event (cfun, "Statements removed", + stmtremoved); }