aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-07-31 14:21:51 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-07-31 14:21:51 +0000
commit0d0a4e205bb6da84e9218c483acf7b13453f0698 (patch)
tree1ca4973bd7c74cc1e5bda94fe35cba4da262da40 /gcc/tree-vectorizer.c
parentc98d05955ba54fcdbae37f2a9e81b8cca6f1ca59 (diff)
downloadgcc-0d0a4e205bb6da84e9218c483acf7b13453f0698.zip
gcc-0d0a4e205bb6da84e9218c483acf7b13453f0698.tar.gz
gcc-0d0a4e205bb6da84e9218c483acf7b13453f0698.tar.bz2
[09/46] Add vec_info::lookup_single_use
This patch adds a helper function for seeing whether there is a single user of an SSA name, and whether that user has a stmt_vec_info. 2018-07-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vectorizer.h (vec_info::lookup_single_use): Declare. * tree-vectorizer.c (vec_info::lookup_single_use): New function. * tree-vect-loop.c (vectorizable_reduction): Use it instead of a single_imm_use-based sequence. * tree-vect-stmts.c (supportable_widening_operation): Likewise. From-SVN: r263124
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 372cf69..2640aab 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -548,6 +548,20 @@ vec_info::lookup_def (tree name)
return NULL;
}
+/* See whether there is a single non-debug statement that uses LHS and
+ whether that statement has an associated stmt_vec_info. Return the
+ stmt_vec_info if so, otherwise return null. */
+
+stmt_vec_info
+vec_info::lookup_single_use (tree lhs)
+{
+ use_operand_p dummy;
+ gimple *use_stmt;
+ if (single_imm_use (lhs, &dummy, &use_stmt))
+ return lookup_stmt (use_stmt);
+ return NULL;
+}
+
/* A helper function to free scev and LOOP niter information, as well as
clear loop constraint LOOP_C_FINITE. */