> +/* Return the pattern result if the original definition of VAR is
> replaced by
> + a pattern stmt. Otherwise, return VAR. */
> +static tree
> +get_pattern_var (tree var, loop_vec_info loop_vinfo)
> +{
> + gimple *stmt;
> + stmt_vec_info stmt_info;
> +
> + if (TREE_CODE (var) == SSA_NAME
> + && (stmt = SSA_NAME_DEF_STMT (var))
> + && is_gimple_assign_or_call (stmt)
> + && (stmt_info = loop_vinfo->lookup_stmt (stmt))
> + && STMT_VINFO_IN_PATTERN_P (stmt_info))
> + {
> + stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
> + stmt = stmt_info->stmt;
> + if (gimple_code (stmt) == GIMPLE_CALL)
> + var = gimple_call_lhs (stmt);
> + else
> + var = gimple_assign_lhs (stmt);
> + }
> +
> + return var;
> +}
Can you use lookup_def and vect_stmt_to_vectorize + gimple_get_lhs
instead? Apart from that it looks ok.
--
Regards
Robin