diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-07-31 14:22:01 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-07-31 14:22:01 +0000 |
commit | fef96d8e2a370e826acdf914d51c88aa2657340a (patch) | |
tree | 1f0d6677d4d581b174517778c0b522f98005c80f /gcc/tree-vect-patterns.c | |
parent | dbe1b846648fad29d105e2e503120a4279a32593 (diff) | |
download | gcc-fef96d8e2a370e826acdf914d51c88aa2657340a.zip gcc-fef96d8e2a370e826acdf914d51c88aa2657340a.tar.gz gcc-fef96d8e2a370e826acdf914d51c88aa2657340a.tar.bz2 |
[11/46] Pass back a stmt_vec_info from vect_is_simple_use
This patch makes vect_is_simple_use pass back a stmt_vec_info to
those callers that want it. Most users only need the stmt_vec_info
but some need the gimple stmt too.
It's probably high time we added a class to represent "simple operands"
instead, but I have a separate series that tries to clean up how
operands are handled (with a view to allowing mixed vector sizes).
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vectorizer.h (vect_is_simple_use): Add an optional
stmt_vec_info * parameter before the optional gimple **.
* tree-vect-stmts.c (vect_is_simple_use): Likewise.
(process_use, vect_get_vec_def_for_operand_1): Update callers.
(vect_get_vec_def_for_operand, vectorizable_shift): Likewise.
* tree-vect-loop.c (vectorizable_reduction): Likewise.
(vectorizable_live_operation): Likewise.
* tree-vect-patterns.c (type_conversion_p): Likewise.
(vect_look_through_possible_promotion): Likewise.
(vect_recog_rotate_pattern): Likewise.
* tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise.
From-SVN: r263126
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index f4174e4..4ac8f9b 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -250,7 +250,9 @@ type_conversion_p (tree name, gimple *use_stmt, bool check_sign, enum vect_def_type dt; stmt_vinfo = vinfo_for_stmt (use_stmt); - if (!vect_is_simple_use (name, stmt_vinfo->vinfo, &dt, def_stmt)) + stmt_vec_info def_stmt_info; + if (!vect_is_simple_use (name, stmt_vinfo->vinfo, &dt, &def_stmt_info, + def_stmt)) return false; if (dt != vect_internal_def @@ -371,9 +373,10 @@ vect_look_through_possible_promotion (vec_info *vinfo, tree op, while (TREE_CODE (op) == SSA_NAME && INTEGRAL_TYPE_P (op_type)) { /* See whether OP is simple enough to vectorize. */ + stmt_vec_info def_stmt_info; gimple *def_stmt; vect_def_type dt; - if (!vect_is_simple_use (op, vinfo, &dt, &def_stmt)) + if (!vect_is_simple_use (op, vinfo, &dt, &def_stmt_info, &def_stmt)) break; /* If OP is the input of a demotion, skip over it to see whether @@ -407,17 +410,15 @@ vect_look_through_possible_promotion (vec_info *vinfo, tree op, the cast is potentially vectorizable. */ if (!def_stmt) break; - if (dt == vect_internal_def) - { - caster = vinfo_for_stmt (def_stmt); - /* Ignore pattern statements, since we don't link uses for them. */ - if (single_use_p - && !STMT_VINFO_RELATED_STMT (caster) - && !has_single_use (res)) - *single_use_p = false; - } - else - caster = NULL; + caster = def_stmt_info; + + /* Ignore pattern statements, since we don't link uses for them. */ + if (caster + && single_use_p + && !STMT_VINFO_RELATED_STMT (caster) + && !has_single_use (res)) + *single_use_p = false; + gassign *assign = dyn_cast <gassign *> (def_stmt); if (!assign || !CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt))) break; @@ -1988,7 +1989,8 @@ vect_recog_rotate_pattern (stmt_vec_info stmt_vinfo, tree *type_out) || !TYPE_UNSIGNED (type)) return NULL; - if (!vect_is_simple_use (oprnd1, vinfo, &dt, &def_stmt)) + stmt_vec_info def_stmt_info; + if (!vect_is_simple_use (oprnd1, vinfo, &dt, &def_stmt_info, &def_stmt)) return NULL; if (dt != vect_internal_def |