From: Richard Sandiford <richard.sandiford@arm.com>
To: Richard Biener <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Maintain LC SSA when doing SVE vectorization
Date: Tue, 05 Jul 2022 11:41:47 +0100 [thread overview]
Message-ID: <mptfsjf3kpg.fsf@arm.com> (raw)
In-Reply-To: <20220704130120.E955B1342C@imap2.suse-dmz.suse.de> (Richard Biener's message of "Mon, 4 Jul 2022 15:01:20 +0200 (CEST)")
Richard Biener <rguenther@suse.de> writes:
> The final loop IV use after the loop has that not in LC SSA
> (and inserts not simplified _2 = _3 - 0 stmts). In particular
> since it splits the exit edge when there's a virtual PHI in the
> destination it breaks virtual LC SSA form (but likely also
> non-virtual).
>
> The following properly inserts LC PHIs instead.
>
> Bootstrap & regtest pending on x86_64-unknown-linux-gnu.
>
> OK if that succeeds?
LGTM, thanks.
Richard
>
> Thanks,
> Richard.
>
> 2022-07-04 Richard Biener <rguenther@suse.de>
>
> * tree-vect-loop-manip.cc (vect_set_loop_condition_normal):
> Maintain LC SSA.
> ---
> gcc/tree-vect-loop-manip.cc | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
> index 895957472c9..eba71c50428 100644
> --- a/gcc/tree-vect-loop-manip.cc
> +++ b/gcc/tree-vect-loop-manip.cc
> @@ -920,9 +920,22 @@ vect_set_loop_condition_normal (class loop *loop, tree niters, tree step,
>
> if (final_iv)
> {
> - gassign *assign = gimple_build_assign (final_iv, MINUS_EXPR,
> - indx_after_incr, init);
> - gsi_insert_on_edge_immediate (single_exit (loop), assign);
> + gassign *assign;
> + edge exit = single_exit (loop);
> + gcc_assert (single_pred_p (exit->dest));
> + tree phi_dest
> + = integer_zerop (init) ? final_iv : copy_ssa_name (indx_after_incr);
> + /* Make sure to maintain LC SSA form here and elide the subtraction
> + if the value is zero. */
> + gphi *phi = create_phi_node (phi_dest, exit->dest);
> + add_phi_arg (phi, indx_after_incr, exit, UNKNOWN_LOCATION);
> + if (!integer_zerop (init))
> + {
> + assign = gimple_build_assign (final_iv, MINUS_EXPR,
> + phi_dest, init);
> + gimple_stmt_iterator gsi = gsi_after_labels (exit->dest);
> + gsi_insert_before (&gsi, assign, GSI_SAME_STMT);
> + }
> }
>
> return cond_stmt;
prev parent reply other threads:[~2022-07-05 10:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 13:01 Richard Biener
2022-07-05 10:41 ` Richard Sandiford [this message]
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=mptfsjf3kpg.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).