aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-08-15 13:05:32 +0200
committerRichard Biener <rguenther@suse.de>2023-08-15 14:08:35 +0200
commitf049868d8db773da4be61d82025e97453d6e9f2b (patch)
tree184b74d4a8b187ad4211abcda12b63cdeb0bfbde /gcc/tree-vectorizer.h
parent8a6097c7425c4b6294e11dea062df7a883343f47 (diff)
downloadgcc-f049868d8db773da4be61d82025e97453d6e9f2b.zip
gcc-f049868d8db773da4be61d82025e97453d6e9f2b.tar.gz
gcc-f049868d8db773da4be61d82025e97453d6e9f2b.tar.bz2
Support constants and externals in BB reduction vectorization
The following supports vectorizing BB reductions involving a constant or an invariant. * tree-vectorizer.h (_slp_instance::remain_stmts): Change to ... (_slp_instance::remain_defs): ... this. (SLP_INSTANCE_REMAIN_STMTS): Rename to ... (SLP_INSTANCE_REMAIN_DEFS): ... this. (slp_root::remain): New. (slp_root::slp_root): Adjust. * tree-vect-slp.cc (vect_free_slp_instance): Adjust. (vect_build_slp_instance): Get extra remain parameter, adjust former handling of a cut off stmt. (vect_analyze_slp_instance): Adjust. (vect_analyze_slp): Likewise. (_bb_vec_info::~_bb_vec_info): Likewise. (vectorizable_bb_reduc_epilogue): Dump something if we fail. (vect_slp_check_for_constructors): Handle non-internal defs as remain defs of a reduction. (vectorize_slp_instance_root_stmt): Adjust. * gcc.dg/vect/bb-slp-75.c: New testcase.
Diffstat (limited to 'gcc/tree-vectorizer.h')
-rw-r--r--gcc/tree-vectorizer.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 5987a32..1de1449 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -259,7 +259,7 @@ public:
/* For slp_inst_kind_bb_reduc the defs that were not vectorized, NULL
otherwise. */
- vec<stmt_vec_info> remain_stmts;
+ vec<tree> remain_defs;
/* The unrolling factor required to vectorized this SLP instance. */
poly_uint64 unrolling_factor;
@@ -289,7 +289,7 @@ public:
#define SLP_INSTANCE_UNROLLING_FACTOR(S) (S)->unrolling_factor
#define SLP_INSTANCE_LOADS(S) (S)->loads
#define SLP_INSTANCE_ROOT_STMTS(S) (S)->root_stmts
-#define SLP_INSTANCE_REMAIN_STMTS(S) (S)->remain_stmts
+#define SLP_INSTANCE_REMAIN_DEFS(S) (S)->remain_defs
#define SLP_INSTANCE_KIND(S) (S)->kind
#define SLP_TREE_CHILDREN(S) (S)->children
@@ -1027,11 +1027,12 @@ loop_vec_info_for_loop (class loop *loop)
struct slp_root
{
slp_root (slp_instance_kind kind_, vec<stmt_vec_info> stmts_,
- vec<stmt_vec_info> roots_)
- : kind(kind_), stmts(stmts_), roots(roots_) {}
+ vec<stmt_vec_info> roots_, vec<tree> remain_ = vNULL)
+ : kind(kind_), stmts(stmts_), roots(roots_), remain(remain_) {}
slp_instance_kind kind;
vec<stmt_vec_info> stmts;
vec<stmt_vec_info> roots;
+ vec<tree> remain;
};
typedef class _bb_vec_info : public vec_info