From: Richard Biener <rguenther@suse.de>
To: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: gcc-patches@gcc.gnu.org, Andreas Krebbel <krebbel@gcc.gnu.org>
Subject: Re: [PATCH v3 1/3] reassoc: Do not bias loop-carried PHIs early
Date: Tue, 28 Sep 2021 13:21:01 +0200 (CEST) [thread overview]
Message-ID: <n7np917-q7n2-67q7-8p1-7rq396on413p@fhfr.qr> (raw)
In-Reply-To: <20210926110936.344019-2-iii@linux.ibm.com>
On Sun, 26 Sep 2021, Ilya Leoshkevich wrote:
> Biasing loop-carried PHIs during the 1st reassociation pass interferes
> with reduction chains and does not bring measurable benefits, so do it
> only during the 2nd reassociation pass.
OK.
Thanks,
Richard.
> gcc/ChangeLog:
>
> * passes.def (pass_reassoc): Rename parameter to early_p.
> * tree-ssa-reassoc.c (reassoc_bias_loop_carried_phi_ranks_p):
> New variable.
> (phi_rank): Don't bias loop-carried phi ranks
> before vectorization pass.
> (execute_reassoc): Add bias_loop_carried_phi_ranks_p parameter.
> (pass_reassoc::pass_reassoc): Add bias_loop_carried_phi_ranks_p
> initializer.
> (pass_reassoc::set_param): Set bias_loop_carried_phi_ranks_p
> value.
> (pass_reassoc::execute): Pass bias_loop_carried_phi_ranks_p to
> execute_reassoc.
> (pass_reassoc::bias_loop_carried_phi_ranks_p): New member.
> ---
> gcc/passes.def | 4 ++--
> gcc/tree-ssa-reassoc.c | 16 ++++++++++++++--
> 2 files changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/passes.def b/gcc/passes.def
> index d7a1f8c97a6..c5f915d04c6 100644
> --- a/gcc/passes.def
> +++ b/gcc/passes.def
> @@ -242,7 +242,7 @@ along with GCC; see the file COPYING3. If not see
> /* Identify paths that should never be executed in a conforming
> program and isolate those paths. */
> NEXT_PASS (pass_isolate_erroneous_paths);
> - NEXT_PASS (pass_reassoc, true /* insert_powi_p */);
> + NEXT_PASS (pass_reassoc, true /* early_p */);
> NEXT_PASS (pass_dce);
> NEXT_PASS (pass_forwprop);
> NEXT_PASS (pass_phiopt, false /* early_p */);
> @@ -325,7 +325,7 @@ along with GCC; see the file COPYING3. If not see
> NEXT_PASS (pass_lower_vector_ssa);
> NEXT_PASS (pass_lower_switch);
> NEXT_PASS (pass_cse_reciprocals);
> - NEXT_PASS (pass_reassoc, false /* insert_powi_p */);
> + NEXT_PASS (pass_reassoc, false /* early_p */);
> NEXT_PASS (pass_strength_reduction);
> NEXT_PASS (pass_split_paths);
> NEXT_PASS (pass_tracer);
> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
> index 8498cfc7aa8..420c14e8cf5 100644
> --- a/gcc/tree-ssa-reassoc.c
> +++ b/gcc/tree-ssa-reassoc.c
> @@ -180,6 +180,10 @@ along with GCC; see the file COPYING3. If not see
> point 3a in the pass header comment. */
> static bool reassoc_insert_powi_p;
>
> +/* Enable biasing ranks of loop accumulators. We don't want this before
> + vectorization, since it interferes with reduction chains. */
> +static bool reassoc_bias_loop_carried_phi_ranks_p;
> +
> /* Statistics */
> static struct
> {
> @@ -269,6 +273,9 @@ phi_rank (gimple *stmt)
> use_operand_p use;
> gimple *use_stmt;
>
> + if (!reassoc_bias_loop_carried_phi_ranks_p)
> + return bb_rank[bb->index];
> +
> /* We only care about real loops (those with a latch). */
> if (!father->latch)
> return bb_rank[bb->index];
> @@ -6940,9 +6947,10 @@ fini_reassoc (void)
> optimization of a gimple conditional. Otherwise returns zero. */
>
> static unsigned int
> -execute_reassoc (bool insert_powi_p)
> +execute_reassoc (bool insert_powi_p, bool bias_loop_carried_phi_ranks_p)
> {
> reassoc_insert_powi_p = insert_powi_p;
> + reassoc_bias_loop_carried_phi_ranks_p = bias_loop_carried_phi_ranks_p;
>
> init_reassoc ();
>
> @@ -6983,15 +6991,19 @@ public:
> {
> gcc_assert (n == 0);
> insert_powi_p = param;
> + bias_loop_carried_phi_ranks_p = !param;
> }
> virtual bool gate (function *) { return flag_tree_reassoc != 0; }
> virtual unsigned int execute (function *)
> - { return execute_reassoc (insert_powi_p); }
> + {
> + return execute_reassoc (insert_powi_p, bias_loop_carried_phi_ranks_p);
> + }
>
> private:
> /* Enable insertion of __builtin_powi calls during execute_reassoc. See
> point 3a in the pass header comment. */
> bool insert_powi_p;
> + bool bias_loop_carried_phi_ranks_p;
> }; // class pass_reassoc
>
> } // anon namespace
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)
next prev parent reply other threads:[~2021-09-28 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 11:09 [PATCH v3 0/3] reassoc: Propagate PHI_LOOP_BIAS along single uses Ilya Leoshkevich
2021-09-26 11:09 ` [PATCH v3 1/3] reassoc: Do not bias loop-carried PHIs early Ilya Leoshkevich
2021-09-28 11:21 ` Richard Biener [this message]
2021-09-26 11:09 ` [PATCH v3 2/3] reassoc: Propagate PHI_LOOP_BIAS along single uses Ilya Leoshkevich
2021-09-28 11:24 ` Richard Biener
2021-09-26 11:09 ` [PATCH v3 3/3] reassoc: Test rank biasing Ilya Leoshkevich
2021-09-28 11:28 ` Richard Biener
2021-09-28 11:46 ` Ilya Leoshkevich
2021-09-28 12:38 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=n7np917-q7n2-67q7-8p1-7rq396on413p@fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=iii@linux.ibm.com \
--cc=krebbel@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).