mirror of git://gcc.gnu.org/git/gcc.git
[04/46] Factor out the test for a valid reduction input
vect_is_slp_reduction and vect_is_simple_reduction had two instances
each of:
&& (is_gimple_assign (def_stmt)
|| is_gimple_call (def_stmt)
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
== vect_induction_def
|| (gimple_code (def_stmt) == GIMPLE_PHI
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
== vect_internal_def
&& !is_loop_header_bb_p (gimple_bb (def_stmt)))))
This patch splits it out in a subroutine.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-loop.c (vect_valid_reduction_input_p): New function,
split out from...
(vect_is_slp_reduction): ...here...
(vect_is_simple_reduction): ...and here. Remove repetition of tests
that are already known to be false.
From-SVN: r263119
This commit is contained in:
parent
6e2dd807c2
commit
83a400d0a5
|
|
@ -1,3 +1,11 @@
|
||||||
|
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
|
* tree-vect-loop.c (vect_valid_reduction_input_p): New function,
|
||||||
|
split out from...
|
||||||
|
(vect_is_slp_reduction): ...here...
|
||||||
|
(vect_is_simple_reduction): ...and here. Remove repetition of tests
|
||||||
|
that are already known to be false.
|
||||||
|
|
||||||
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
|
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
* tree-vectorizer.h (vect_free_slp_instance): Add a final_p parameter.
|
* tree-vectorizer.h (vect_free_slp_instance): Add a final_p parameter.
|
||||||
|
|
|
||||||
|
|
@ -2501,6 +2501,21 @@ report_vect_op (dump_flags_t msg_type, gimple *stmt, const char *msg)
|
||||||
dump_gimple_stmt (msg_type, TDF_SLIM, stmt, 0);
|
dump_gimple_stmt (msg_type, TDF_SLIM, stmt, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* DEF_STMT occurs in a loop that contains a potential reduction operation.
|
||||||
|
Return true if the results of DEF_STMT are something that can be
|
||||||
|
accumulated by such a reduction. */
|
||||||
|
|
||||||
|
static bool
|
||||||
|
vect_valid_reduction_input_p (gimple *def_stmt)
|
||||||
|
{
|
||||||
|
stmt_vec_info def_stmt_info = vinfo_for_stmt (def_stmt);
|
||||||
|
return (is_gimple_assign (def_stmt)
|
||||||
|
|| is_gimple_call (def_stmt)
|
||||||
|
|| STMT_VINFO_DEF_TYPE (def_stmt_info) == vect_induction_def
|
||||||
|
|| (gimple_code (def_stmt) == GIMPLE_PHI
|
||||||
|
&& STMT_VINFO_DEF_TYPE (def_stmt_info) == vect_internal_def
|
||||||
|
&& !is_loop_header_bb_p (gimple_bb (def_stmt))));
|
||||||
|
}
|
||||||
|
|
||||||
/* Detect SLP reduction of the form:
|
/* Detect SLP reduction of the form:
|
||||||
|
|
||||||
|
|
@ -2626,14 +2641,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
if (def_stmt
|
if (def_stmt
|
||||||
&& gimple_bb (def_stmt)
|
&& gimple_bb (def_stmt)
|
||||||
&& flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
|
&& flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
|
||||||
&& (is_gimple_assign (def_stmt)
|
&& vect_valid_reduction_input_p (def_stmt))
|
||||||
|| is_gimple_call (def_stmt)
|
|
||||||
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
|
|
||||||
== vect_induction_def
|
|
||||||
|| (gimple_code (def_stmt) == GIMPLE_PHI
|
|
||||||
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
|
|
||||||
== vect_internal_def
|
|
||||||
&& !is_loop_header_bb_p (gimple_bb (def_stmt)))))
|
|
||||||
{
|
{
|
||||||
lhs = gimple_assign_lhs (next_stmt);
|
lhs = gimple_assign_lhs (next_stmt);
|
||||||
next_stmt = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt));
|
next_stmt = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt));
|
||||||
|
|
@ -2656,14 +2664,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
if (def_stmt
|
if (def_stmt
|
||||||
&& gimple_bb (def_stmt)
|
&& gimple_bb (def_stmt)
|
||||||
&& flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
|
&& flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
|
||||||
&& (is_gimple_assign (def_stmt)
|
&& vect_valid_reduction_input_p (def_stmt))
|
||||||
|| is_gimple_call (def_stmt)
|
|
||||||
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
|
|
||||||
== vect_induction_def
|
|
||||||
|| (gimple_code (def_stmt) == GIMPLE_PHI
|
|
||||||
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def_stmt))
|
|
||||||
== vect_internal_def
|
|
||||||
&& !is_loop_header_bb_p (gimple_bb (def_stmt)))))
|
|
||||||
{
|
{
|
||||||
if (dump_enabled_p ())
|
if (dump_enabled_p ())
|
||||||
{
|
{
|
||||||
|
|
@ -3196,15 +3197,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
&& (code == COND_EXPR
|
&& (code == COND_EXPR
|
||||||
|| !def1 || gimple_nop_p (def1)
|
|| !def1 || gimple_nop_p (def1)
|
||||||
|| !flow_bb_inside_loop_p (loop, gimple_bb (def1))
|
|| !flow_bb_inside_loop_p (loop, gimple_bb (def1))
|
||||||
|| (def1 && flow_bb_inside_loop_p (loop, gimple_bb (def1))
|
|| vect_valid_reduction_input_p (def1)))
|
||||||
&& (is_gimple_assign (def1)
|
|
||||||
|| is_gimple_call (def1)
|
|
||||||
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1))
|
|
||||||
== vect_induction_def
|
|
||||||
|| (gimple_code (def1) == GIMPLE_PHI
|
|
||||||
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def1))
|
|
||||||
== vect_internal_def
|
|
||||||
&& !is_loop_header_bb_p (gimple_bb (def1)))))))
|
|
||||||
{
|
{
|
||||||
if (dump_enabled_p ())
|
if (dump_enabled_p ())
|
||||||
report_vect_op (MSG_NOTE, def_stmt, "detected reduction: ");
|
report_vect_op (MSG_NOTE, def_stmt, "detected reduction: ");
|
||||||
|
|
@ -3215,15 +3208,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
|
||||||
&& (code == COND_EXPR
|
&& (code == COND_EXPR
|
||||||
|| !def2 || gimple_nop_p (def2)
|
|| !def2 || gimple_nop_p (def2)
|
||||||
|| !flow_bb_inside_loop_p (loop, gimple_bb (def2))
|
|| !flow_bb_inside_loop_p (loop, gimple_bb (def2))
|
||||||
|| (def2 && flow_bb_inside_loop_p (loop, gimple_bb (def2))
|
|| vect_valid_reduction_input_p (def2)))
|
||||||
&& (is_gimple_assign (def2)
|
|
||||||
|| is_gimple_call (def2)
|
|
||||||
|| STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2))
|
|
||||||
== vect_induction_def
|
|
||||||
|| (gimple_code (def2) == GIMPLE_PHI
|
|
||||||
&& STMT_VINFO_DEF_TYPE (vinfo_for_stmt (def2))
|
|
||||||
== vect_internal_def
|
|
||||||
&& !is_loop_header_bb_p (gimple_bb (def2)))))))
|
|
||||||
{
|
{
|
||||||
if (! nested_in_vect_loop && orig_code != MINUS_EXPR)
|
if (! nested_in_vect_loop && orig_code != MINUS_EXPR)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue