From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id EFAA63858C33 for ; Thu, 20 Jul 2023 07:34:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EFAA63858C33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2b961822512so6394841fa.2 for ; Thu, 20 Jul 2023 00:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689838498; x=1690443298; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=PmOBVaYImjME5+oAK5o/MrGzJ6Khui3FvjiFwYZ1Vmk=; b=Mm4DTDulDZuThCKSUVOQIG2DuaeYmc8tg013rOdRbKZT9MFNjt4ZXS7qAeDM3LVOGf wVpD6Zrcn4tqua4XJe7FthjNfE63tY0mt9EnUirTN0xrd6pSVp0ZmLDStqIsMk4aUyzX 4ythK7v/q8b+4fEtggZbf1sjRtvdeAcvKMiDdEHweLRTRwad5LRLuaJCJHmxAOOkyd0e OlouZ9dhgq6TYzsR1dIs+yQ4AY8nxrkuRE26Csp3RtXk2sVe+/jZCUfsViT5ZgVpvZg9 hpH5JIcFCJEdtWeBYPqr+pJHIUbE1jYkTf8yy8QY2KPrem11Md6F4N3duqVts7ubQ23A Dq3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689838498; x=1690443298; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PmOBVaYImjME5+oAK5o/MrGzJ6Khui3FvjiFwYZ1Vmk=; b=SfD4U4n1QjMp5aRWZPL/CYA6Ywx09z1XLUW68mVGsL8Nxglu+8SJT1qpUWdXCeqeg0 di8wGNNhNuDVvp/SuY4nCQznAuqoNRdrbbyF2sH2tU1hP44vN4g/GUrAxoxOtaVEYG0G z8YajOQCV24avbrsnn/LEMv/SyI9RcTmXtRxO/gVxVwKka0R1zG+Lpmu/15uWRFAzOEm EpWAXz+B5cvf4dzJY5QOUtYRUqSxVrGcsJUnHz90iYl8wI+DpoHea9+WzSDZsiz6s9Ok +bNu3io7XFNk1b53eEJ9T+zqlhXctwh5SxVEIskZZs7MF3L1xsma0gkmDoT0egniFQ+a GV3g== X-Gm-Message-State: ABy/qLbxngKjEO1PM5rPafrxxQewvGMWIy1f3+up+RKbHuQl3IwzNKns yPUiggjfC7O8yy6xRODysSub1JXX5GijjNnfMgY5btXR X-Google-Smtp-Source: APBJJlHUV6bA2tQx2Mf8MIMQ4VAC+v18kxk2qjrSVsibKoZBYWeNDk/zIKkuR3mCq4vVHD8NicirQI3k8LuHXJUvbOU= X-Received: by 2002:a2e:8841:0:b0:2b6:dc84:b93e with SMTP id z1-20020a2e8841000000b002b6dc84b93emr1597708ljj.21.1689838498239; Thu, 20 Jul 2023 00:34:58 -0700 (PDT) MIME-Version: 1.0 References: <20230720024142.1448443-1-apinski@marvell.com> In-Reply-To: <20230720024142.1448443-1-apinski@marvell.com> From: Richard Biener Date: Thu, 20 Jul 2023 09:34:23 +0200 Message-ID: Subject: Re: [PATCH] Move combine over to statistics_counter_event. To: Andrew Pinski Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,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 List-Id: On Thu, Jul 20, 2023 at 4:42=E2=80=AFAM Andrew Pinski via Gcc-patches wrote: > > 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. you can use -fdump-statistics-stats to get the total counts (but not in the combine dumpfile). > > Note you need to use -fdump-rtl-combine-stats to get the stats in the com= bine > dump unlike before where the stats was dumped directly into the file. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. OK. Thanks, Richard. > 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 =3D 0; > } > > - total_attempts +=3D combine_attempts; > - total_merges +=3D combine_merges; > - total_extras +=3D combine_extras; > - total_successes +=3D 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 =3D 0; > rtl_hooks =3D 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 requirin= g 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, bec= ause > 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 =3D TDI_end; (dfi =3D dumps->get_dump_file_info (i)) !=3D 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. */ > -- > 2.31.1 >