middle-end: have vect_recog_cond_store_pattern use pattern statement for cond if available
When vectorizing a conditional operation we rely on the bool_recog pattern to hit and convert the bool of the operand to a valid mask. However we are currently not using the converted operand as this is in a pattern statement. This change updates it to look at the actual statement to be vectorized so we pick up the pattern. Note that there are no tests here since vectorization will fail until we correctly lower all boolean conditionals early. Tests for these are in the next patch, namely vect-conditional_store_5.c and vect-conditional_store_6.c. And the existing vect-conditional_store_[1-4].c checks that the other cases are still handled correctly. gcc/ChangeLog: * tree-vect-patterns.cc (vect_recog_cond_store_pattern): Use pattern statement.
This commit is contained in:
parent
67eaf67360
commit
a50f54c0d0
1 changed files with 9 additions and 1 deletions
|
@ -6670,7 +6670,15 @@ vect_recog_cond_store_pattern (vec_info *vinfo,
|
|||
if (TREE_CODE (st_rhs) != SSA_NAME)
|
||||
return NULL;
|
||||
|
||||
gassign *cond_stmt = dyn_cast<gassign *> (SSA_NAME_DEF_STMT (st_rhs));
|
||||
auto cond_vinfo = vinfo->lookup_def (st_rhs);
|
||||
|
||||
/* If the condition isn't part of the loop then bool recog wouldn't have seen
|
||||
it and so this transformation may not be valid. */
|
||||
if (!cond_vinfo)
|
||||
return NULL;
|
||||
|
||||
cond_vinfo = vect_stmt_to_vectorize (cond_vinfo);
|
||||
gassign *cond_stmt = dyn_cast<gassign *> (STMT_VINFO_STMT (cond_vinfo));
|
||||
if (!cond_stmt || gimple_assign_rhs_code (cond_stmt) != COND_EXPR)
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue