From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Ignore ignored operands in vect_get_and_check_slp_defs
Date: Wed, 28 Oct 2020 15:09:45 +0100 (CET) [thread overview]
Message-ID: <nycvar.YFH.7.76.2010281509330.10319@elmra.sevgm.obk> (raw)
This passes down skip_args to vect_get_and_check_slp_defs to skip
ignored ops there, too and not fail SLP discovery. This fixes
gcc.target/aarch64/sve/reduc_strict_5.c
Bootstrap & regtest running on x86_64-unknown-linux-gnu.
2020-10-28 Richard Biener <rguenther@suse.de>
* tree-vect-slp.c (vect_get_and_check_slp_defs): For skipped
args just push NULLs and vect_uninitialized_def.
(vect_build_slp_tree_2): Allocate skip_args for all ops
and pass it down to vect_get_and_check_slp_defs.
---
gcc/tree-vect-slp.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 9f1da3070f5..c98f747d4a9 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -413,6 +413,7 @@ vect_def_types_match (enum vect_def_type dta, enum vect_def_type dtb)
ok return 0. */
static int
vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
+ bool *skip_args,
vec<stmt_vec_info> stmts, unsigned stmt_num,
vec<slp_oprnd_info> *oprnds_info)
{
@@ -507,6 +508,14 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
return -1;
}
+ if (skip_args[i])
+ {
+ oprnd_info->def_stmts.quick_push (NULL);
+ oprnd_info->ops.quick_push (NULL_TREE);
+ oprnd_info->first_dt = vect_uninitialized_def;
+ continue;
+ }
+
if (def_stmt_info && is_pattern_stmt_p (def_stmt_info))
oprnd_info->any_pattern = true;
@@ -589,6 +598,12 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
/* Now match the operand definition types to that of the first stmt. */
for (i = 0; i < number_of_oprnds;)
{
+ if (skip_args[i])
+ {
+ ++i;
+ continue;
+ }
+
oprnd_info = (*oprnds_info)[i];
dt = dts[i];
stmt_vec_info def_stmt_info = oprnd_info->def_stmts[stmt_num];
@@ -1412,7 +1427,8 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
/* If the SLP node is a PHI (induction or reduction), terminate
the recursion. */
- bool skip_args[2] = { false, false };
+ bool *skip_args = XALLOCAVEC (bool, nops);
+ memset (skip_args, 0, nops);
if (loop_vec_info loop_vinfo = dyn_cast <loop_vec_info> (vinfo))
if (gphi *stmt = dyn_cast <gphi *> (stmt_info->stmt))
{
@@ -1557,7 +1573,7 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
slp_oprnd_info oprnd_info;
FOR_EACH_VEC_ELT (stmts, i, stmt_info)
{
- int res = vect_get_and_check_slp_defs (vinfo, swap[i],
+ int res = vect_get_and_check_slp_defs (vinfo, swap[i], skip_args,
stmts, i, &oprnds_info);
if (res != 0)
matches[(res == -1) ? 0 : i] = false;
@@ -1582,19 +1598,19 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
slp_tree child;
unsigned int j;
- if (oprnd_info->first_dt == vect_uninitialized_def)
+ /* We're skipping certain operands from processing, for example
+ outer loop reduction initial defs. */
+ if (skip_args[i])
{
- /* COND_EXPR have one too many eventually if the condition
- is a SSA name. */
- gcc_assert (i == 3 && nops == 4);
+ children.safe_push (NULL);
continue;
}
- /* We're skipping certain operands from processing, for example
- outer loop reduction initial defs. */
- if (i <= 1 && skip_args[i])
+ if (oprnd_info->first_dt == vect_uninitialized_def)
{
- children.safe_push (NULL);
+ /* COND_EXPR have one too many eventually if the condition
+ is a SSA name. */
+ gcc_assert (i == 3 && nops == 4);
continue;
}
--
2.26.2
reply other threads:[~2020-10-28 14:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=nycvar.YFH.7.76.2010281509330.10319@elmra.sevgm.obk \
--to=rguenther@suse.de \
--cc=gcc-patches@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).