===================================================================
@@ -220,7 +220,7 @@ struct vec_info {
stmt_vec_info add_stmt (gimple *);
stmt_vec_info lookup_stmt (gimple *);
stmt_vec_info lookup_def (tree);
- stmt_vec_info lookup_single_use (tree);
+ stmt_vec_info lookup_single_use (stmt_vec_info);
struct dr_vec_info *lookup_dr (data_reference *);
void move_dr (stmt_vec_info, stmt_vec_info);
void remove_stmt (stmt_vec_info);
===================================================================
@@ -544,13 +544,14 @@ 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. */
+/* See whether there is a single non-debug use of the lhs of STMT_INFO
+ and whether the containing 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)
+vec_info::lookup_single_use (stmt_vec_info stmt_info)
{
+ tree lhs = gimple_get_lhs (stmt_info->stmt);
use_operand_p dummy;
gimple *use_stmt;
if (single_imm_use (lhs, &dummy, &use_stmt))
===================================================================
@@ -6180,7 +6180,7 @@ vectorizable_reduction (stmt_vec_info st
stmt_vec_info use_stmt_info;
if (ncopies > 1
&& STMT_VINFO_RELEVANT (reduc_stmt_info) <= vect_used_only_live
- && (use_stmt_info = loop_vinfo->lookup_single_use (phi_result))
+ && (use_stmt_info = loop_vinfo->lookup_single_use (stmt_info))
&& vect_stmt_to_vectorize (use_stmt_info) == reduc_stmt_info)
single_defuse_cycle = true;
@@ -6947,10 +6947,9 @@ vectorizable_reduction (stmt_vec_info st
in vectorizable_reduction and there are no intermediate stmts
participating. */
stmt_vec_info use_stmt_info;
- tree reduc_phi_result = gimple_phi_result (reduc_def_phi);
if (ncopies > 1
&& (STMT_VINFO_RELEVANT (stmt_info) <= vect_used_only_live)
- && (use_stmt_info = loop_vinfo->lookup_single_use (reduc_phi_result))
+ && (use_stmt_info = loop_vinfo->lookup_single_use (reduc_def_info))
&& vect_stmt_to_vectorize (use_stmt_info) == stmt_info)
{
single_defuse_cycle = true;
===================================================================
@@ -10237,8 +10237,8 @@ supportable_widening_operation (enum tre
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_info->stmt);
- stmt_vec_info use_stmt_info = loop_info->lookup_single_use (lhs);
+ stmt_vec_info use_stmt_info
+ = loop_info->lookup_single_use (stmt_info);
if (use_stmt_info
&& STMT_VINFO_DEF_TYPE (use_stmt_info) == vect_reduction_def)
return true;