From patchwork Thu Jul 20 02:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 122952 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2842052vqt; Wed, 19 Jul 2023 19:42:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5iqrHoQqMtLG6xRHkp6VkpmSkh5FNfQtUAjaTRxHY/olsfEdoxiGXWVD97IvsEc6EZYLW X-Received: by 2002:a17:907:3e9a:b0:989:450:e56a with SMTP id hs26-20020a1709073e9a00b009890450e56amr5061959ejc.76.1689820973610; Wed, 19 Jul 2023 19:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689820973; cv=none; d=google.com; s=arc-20160816; b=cOp4uCJUalg2dr94sHaXJLzZTN0sEB33hDfb0L4zT9vLCI0rmqAJdZTEKRRC99JJjO DckV01Jzf67ZVJ9aqgLI1jw5+nuoVs88aO5L5SrFL3NrHxGHTtiamIP2s9TFWPCVjVYd iD+VqGzIxMHLPOO2tqLc3w3Xp12knvxLPM2SWjIl+ECNEw6hKpgkLfHsLfO/f/4FtCix rt7UAEanQALrEh6apWzYJRKPa/FEFIhV3s3yzDajWQ2keGWz9uuS9nQEnZ2Gw9lCwKLW QeNS/nepu0Nj3Yc2EVBGtsIycLhwJ9LM1f6BlzGVrGuAILNxV29sUwO5y+4Xe1Ugg0u5 joXA== 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=KstYa2llOoMzJuOrmOno7cbnokbh64XOrXNpW+Bl2WU=; fh=09okz+w4tVyhQmqNBttR063P0zKcIsLE1JRBioNPGC4=; b=xwZ2REE2vSBcvQxI/bezVcqJ4ZUvYaFIZy9H1AxDreoA8l+qgpYWlUQiUEyvchKO+u cLYVZ9iw7zVQP1BRu4fG1ek1iw7p5ZJroBjAmphtR+SVpQCC0Lx6D+71SIXG6TATYqS3 62uC+avtq6yjxfOCrPdALKXLkezZcDhzS38qjUto2DqxQa79A3mR8ihE/daCfjIozR9I QFs22l5ZWefW/1zy4N2IZPaTLkL/acOFt1i4unWpbuREHzdGbK5pDAda188LNF57wDCZ N0a6goS9JTz1Zft9nrTmH8EXspfFWm1N+9su3uh7TtTQn49byb6mUpGqmQWayetmp1jo u1bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="k/xxJ3W9"; 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id e2-20020a17090618e200b0098859d239dfsi3302581ejf.796.2023.07.19.19.42.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 19:42:53 -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="k/xxJ3W9"; 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 74841385701C for ; Thu, 20 Jul 2023 02:42:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74841385701C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689820972; bh=KstYa2llOoMzJuOrmOno7cbnokbh64XOrXNpW+Bl2WU=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=k/xxJ3W9yqAznkgIBUpoJENs622cUlhfTngCDQQICfWq/VNs1GU84Y4ON9YIJJ8MG reXFhU/mxaT4vxQ8utCxatfqTBl3YuOLXREaaFJlFqiyno0IgYVrL/pQloIvWpIH/c P2POiahKebPnTwMTOuRJ099lBVNLAUkNNkotpg2A= 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 53A383858C78 for ; Thu, 20 Jul 2023 02:42:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 53A383858C78 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 36JGGwRU001874 for ; Wed, 19 Jul 2023 19:42:04 -0700 Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3rxj62abe9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jul 2023 19:42:04 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 19 Jul 2023 19:42:02 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 19 Jul 2023 19:42:02 -0700 Received: from vpnclient.wrightpinski.org.com (unknown [10.69.242.187]) by maili.marvell.com (Postfix) with ESMTP id 7EF013F7073; Wed, 19 Jul 2023 19:42:02 -0700 (PDT) To: CC: Andrew Pinski Subject: [PATCH] Move combine over to statistics_counter_event. Date: Wed, 19 Jul 2023 19:41:42 -0700 Message-ID: <20230720024142.1448443-1-apinski@marvell.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Proofpoint-GUID: odCPzJ6XyEyoayY2ZXKiFnCphKTr_YFI X-Proofpoint-ORIG-GUID: odCPzJ6XyEyoayY2ZXKiFnCphKTr_YFI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-19_16,2023-07-19_01,2023-05-22_02 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_PASS, 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: INBOX X-GMAIL-THRID: 1771905717330806453 X-GMAIL-MSGID: 1771905717330806453 Since we have statistics_counter_event now, combine should use that instead of it is own custom printing of statistics. The only thing that is not done any more after this patch is printing out the total stats for the whole TU. Note you need to use -fdump-rtl-combine-stats to get the stats in the combine dump unlike before where the stats was dumped directly into the file. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * combine.cc (dump_combine_stats): Remove. (dump_combine_total_stats): Remove. (total_attempts, total_merges, total_extras, total_successes): Remove. (combine_instructions): Don't increment total stats instead use statistics_counter_event. * dumpfile.cc (print_combine_total_stats): Remove. * dumpfile.h (print_combine_total_stats): Remove. (dump_combine_total_stats): Remove. * passes.cc (finish_optimization_passes): Don't call print_combine_total_stats. * rtl.h (dump_combine_total_stats): Remove. (dump_combine_stats): Remove. --- gcc/combine.cc | 30 ++++-------------------------- gcc/dumpfile.cc | 9 --------- gcc/dumpfile.h | 3 --- gcc/passes.cc | 7 ------- gcc/rtl.h | 2 -- 5 files changed, 4 insertions(+), 47 deletions(-) diff --git a/gcc/combine.cc b/gcc/combine.cc index d9161b257e8..4bf867d74b0 100644 --- a/gcc/combine.cc +++ b/gcc/combine.cc @@ -108,10 +108,6 @@ static int combine_extras; static int combine_successes; -/* Totals over entire compilation. */ - -static int total_attempts, total_merges, total_extras, total_successes; - /* combine_instructions may try to replace the right hand side of the second instruction with the value of an associated REG_EQUAL note before throwing it at try_combine. That is problematic when there @@ -1456,10 +1452,10 @@ retry: undobuf.frees = 0; } - total_attempts += combine_attempts; - total_merges += combine_merges; - total_extras += combine_extras; - total_successes += combine_successes; + statistics_counter_event (cfun, "attempts", combine_attempts); + statistics_counter_event (cfun, "merges", combine_merges); + statistics_counter_event (cfun, "extras", combine_extras); + statistics_counter_event (cfun, "successes", combine_successes); nonzero_sign_valid = 0; rtl_hooks = general_rtl_hooks; @@ -14936,24 +14932,6 @@ unmentioned_reg_p (rtx equiv, rtx expr) return false; } -DEBUG_FUNCTION void -dump_combine_stats (FILE *file) -{ - fprintf - (file, - ";; Combiner statistics: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n\n", - combine_attempts, combine_merges, combine_extras, combine_successes); -} - -void -dump_combine_total_stats (FILE *file) -{ - fprintf - (file, - "\n;; Combiner totals: %d attempts, %d substitutions (%d requiring new space),\n;; %d successes.\n", - total_attempts, total_merges, total_extras, total_successes); -} - /* Make pseudo-to-pseudo copies after every hard-reg-to-pseudo-copy, because the reg-to-reg copy can usefully combine with later instructions, but we do not want to combine the hard reg into later instructions, for that diff --git a/gcc/dumpfile.cc b/gcc/dumpfile.cc index 51f68c8c6b4..a2050d13009 100644 --- a/gcc/dumpfile.cc +++ b/gcc/dumpfile.cc @@ -2074,15 +2074,6 @@ dump_function (int phase, tree fn) } } -/* Print information from the combine pass on dump_file. */ - -void -print_combine_total_stats (void) -{ - if (dump_file) - dump_combine_total_stats (dump_file); -} - /* Enable RTL dump for all the RTL passes. */ bool diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h index 7d5eca899dc..c41940624ca 100644 --- a/gcc/dumpfile.h +++ b/gcc/dumpfile.h @@ -647,14 +647,11 @@ class auto_dump_scope auto_dump_scope scope (NAME, USER_LOC) extern void dump_function (int phase, tree fn); -extern void print_combine_total_stats (void); extern bool enable_rtl_dump_file (void); /* In tree-dump.cc */ extern void dump_node (const_tree, dump_flags_t, FILE *); -/* In combine.cc */ -extern void dump_combine_total_stats (FILE *); /* In cfghooks.cc */ extern void dump_bb (FILE *, basic_block, int, dump_flags_t); diff --git a/gcc/passes.cc b/gcc/passes.cc index d7b0ad271a1..6f894a41d22 100644 --- a/gcc/passes.cc +++ b/gcc/passes.cc @@ -359,13 +359,6 @@ finish_optimization_passes (void) dumps->dump_finish (pass_profile_1->static_pass_number); } - if (optimize > 0) - { - dumps->dump_start (pass_combine_1->static_pass_number, NULL); - print_combine_total_stats (); - dumps->dump_finish (pass_combine_1->static_pass_number); - } - /* Do whatever is necessary to finish printing the graphs. */ for (i = TDI_end; (dfi = dumps->get_dump_file_info (i)) != NULL; ++i) if (dfi->graph_dump_initialized) diff --git a/gcc/rtl.h b/gcc/rtl.h index 098dc4ccc1c..03b7d058295 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -4216,8 +4216,6 @@ extern bool validate_subreg (machine_mode, machine_mode, /* In combine.cc */ extern unsigned int extended_count (const_rtx, machine_mode, int); extern rtx remove_death (unsigned int, rtx_insn *); -extern void dump_combine_stats (FILE *); -extern void dump_combine_total_stats (FILE *); extern rtx make_compound_operation (rtx, enum rtx_code); /* In sched-rgn.cc. */