mirror of git://gcc.gnu.org/git/gcc.git
[42/46] Add vec_info::replace_stmt
This patch adds a helper for replacing a stmt_vec_info's statement with a new statement. 2018-07-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vectorizer.h (vec_info::replace_stmt): Declare. * tree-vectorizer.c (vec_info::replace_stmt): New function. * tree-vect-slp.c (vect_remove_slp_scalar_calls): Use it. * tree-vect-stmts.c (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. From-SVN: r263157
This commit is contained in:
parent
b5b56c2a03
commit
9d97912b85
|
|
@ -1,3 +1,11 @@
|
||||||
|
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
|
* tree-vectorizer.h (vec_info::replace_stmt): Declare.
|
||||||
|
* tree-vectorizer.c (vec_info::replace_stmt): New function.
|
||||||
|
* tree-vect-slp.c (vect_remove_slp_scalar_calls): Use it.
|
||||||
|
* tree-vect-stmts.c (vectorizable_call): Likewise.
|
||||||
|
(vectorizable_simd_clone_call): Likewise.
|
||||||
|
|
||||||
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
|
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
* tree-vectorizer.h (vec_info::remove_stmt): Declare.
|
* tree-vectorizer.h (vec_info::remove_stmt): Declare.
|
||||||
|
|
|
||||||
|
|
@ -4049,11 +4049,8 @@ vect_remove_slp_scalar_calls (slp_tree node)
|
||||||
continue;
|
continue;
|
||||||
lhs = gimple_call_lhs (stmt);
|
lhs = gimple_call_lhs (stmt);
|
||||||
new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
|
new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
|
||||||
set_vinfo_for_stmt (new_stmt, stmt_info);
|
|
||||||
set_vinfo_for_stmt (stmt, NULL);
|
|
||||||
STMT_VINFO_STMT (stmt_info) = new_stmt;
|
|
||||||
gsi = gsi_for_stmt (stmt);
|
gsi = gsi_for_stmt (stmt);
|
||||||
gsi_replace (&gsi, new_stmt, false);
|
stmt_info->vinfo->replace_stmt (&gsi, stmt_info, new_stmt);
|
||||||
SSA_NAME_DEF_STMT (gimple_assign_lhs (new_stmt)) = new_stmt;
|
SSA_NAME_DEF_STMT (gimple_assign_lhs (new_stmt)) = new_stmt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3634,10 +3634,7 @@ vectorizable_call (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
|
||||||
|
|
||||||
gassign *new_stmt
|
gassign *new_stmt
|
||||||
= gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
|
= gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
|
||||||
set_vinfo_for_stmt (new_stmt, stmt_info);
|
vinfo->replace_stmt (gsi, stmt_info, new_stmt);
|
||||||
set_vinfo_for_stmt (stmt_info->stmt, NULL);
|
|
||||||
STMT_VINFO_STMT (stmt_info) = new_stmt;
|
|
||||||
gsi_replace (gsi, new_stmt, false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -4375,10 +4372,7 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_info,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
new_stmt = gimple_build_nop ();
|
new_stmt = gimple_build_nop ();
|
||||||
set_vinfo_for_stmt (new_stmt, stmt_info);
|
vinfo->replace_stmt (gsi, stmt_info, new_stmt);
|
||||||
set_vinfo_for_stmt (stmt, NULL);
|
|
||||||
STMT_VINFO_STMT (stmt_info) = new_stmt;
|
|
||||||
gsi_replace (gsi, new_stmt, true);
|
|
||||||
unlink_stmt_vdef (stmt);
|
unlink_stmt_vdef (stmt);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -602,6 +602,22 @@ vec_info::remove_stmt (stmt_vec_info stmt_info)
|
||||||
free_stmt_vec_info (stmt_info);
|
free_stmt_vec_info (stmt_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Replace the statement at GSI by NEW_STMT, both the vectorization
|
||||||
|
information and the function itself. STMT_INFO describes the statement
|
||||||
|
at GSI. */
|
||||||
|
|
||||||
|
void
|
||||||
|
vec_info::replace_stmt (gimple_stmt_iterator *gsi, stmt_vec_info stmt_info,
|
||||||
|
gimple *new_stmt)
|
||||||
|
{
|
||||||
|
gimple *old_stmt = stmt_info->stmt;
|
||||||
|
gcc_assert (!stmt_info->pattern_stmt_p && old_stmt == gsi_stmt (*gsi));
|
||||||
|
set_vinfo_for_stmt (old_stmt, NULL);
|
||||||
|
set_vinfo_for_stmt (new_stmt, stmt_info);
|
||||||
|
stmt_info->stmt = new_stmt;
|
||||||
|
gsi_replace (gsi, new_stmt, true);
|
||||||
|
}
|
||||||
|
|
||||||
/* A helper function to free scev and LOOP niter information, as well as
|
/* A helper function to free scev and LOOP niter information, as well as
|
||||||
clear loop constraint LOOP_C_FINITE. */
|
clear loop constraint LOOP_C_FINITE. */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,7 @@ struct vec_info {
|
||||||
struct dr_vec_info *lookup_dr (data_reference *);
|
struct dr_vec_info *lookup_dr (data_reference *);
|
||||||
void move_dr (stmt_vec_info, stmt_vec_info);
|
void move_dr (stmt_vec_info, stmt_vec_info);
|
||||||
void remove_stmt (stmt_vec_info);
|
void remove_stmt (stmt_vec_info);
|
||||||
|
void replace_stmt (gimple_stmt_iterator *, stmt_vec_info, gimple *);
|
||||||
|
|
||||||
/* The type of vectorization. */
|
/* The type of vectorization. */
|
||||||
vec_kind kind;
|
vec_kind kind;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue