From 0d0a4e205bb6da84e9218c483acf7b13453f0698 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Tue, 31 Jul 2018 14:21:51 +0000 Subject: [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 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 --- gcc/tree-vect-stmts.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'gcc/tree-vect-stmts.c') diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 8f4b66d..f21599e 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -10310,14 +10310,11 @@ supportable_widening_operation (enum tree_code code, gimple *stmt, same operation. One such an example is s += a * b, where elements in a and b cannot be reordered. Here we check if the vector defined by STMT is only directly used in the reduction statement. */ - tree lhs = gimple_assign_lhs (stmt); - use_operand_p dummy; - gimple *use_stmt; - stmt_vec_info use_stmt_info = NULL; - if (single_imm_use (lhs, &dummy, &use_stmt) - && (use_stmt_info = vinfo_for_stmt (use_stmt)) - && STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def) - return true; + tree lhs = gimple_assign_lhs (stmt); + stmt_vec_info use_stmt_info = loop_info->lookup_single_use (lhs); + if (use_stmt_info + && STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def) + return true; } c1 = VEC_WIDEN_MULT_LO_EXPR; c2 = VEC_WIDEN_MULT_HI_EXPR; -- cgit v1.1