tree-parloops.c (parloops_is_slp_reduction): Do not set LOOP_VINFO_OPERANDS_SWAPPED.

2019-09-19  Richard Biener  <rguenther@suse.de>

	* tree-parloops.c (parloops_is_slp_reduction): Do not set
	LOOP_VINFO_OPERANDS_SWAPPED.
	(parloops_is_simple_reduction): Likewise.
	* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Do not
	initialize operands_swapped.
	(_loop_vec_info::~_loop_vec_info): Do not re-canonicalize stmts.
	(vect_is_slp_reduction): Do not swap operands.
	* tree-vectorizer.h (_loop_vec_info::operands_swapped): Remove.
	(LOOP_VINFO_OPERANDS_SWAPPED): Likewise.

From-SVN: r275928
This commit is contained in:
Richard Biener 2019-09-19 06:08:33 +00:00 committed by Richard Biener
parent fbd33afe47
commit a7268fd765
4 changed files with 18 additions and 81 deletions

View File

@ -1,3 +1,15 @@
2019-09-19 Richard Biener <rguenther@suse.de>
* tree-parloops.c (parloops_is_slp_reduction): Do not set
LOOP_VINFO_OPERANDS_SWAPPED.
(parloops_is_simple_reduction): Likewise.
* tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Do not
initialize operands_swapped.
(_loop_vec_info::~_loop_vec_info): Do not re-canonicalize stmts.
(vect_is_slp_reduction): Do not swap operands.
* tree-vectorizer.h (_loop_vec_info::operands_swapped): Remove.
(LOOP_VINFO_OPERANDS_SWAPPED): Likewise.
2019-09-19 Hongtao Liu <hongtao.liu@intel.com>
PR target/87007

View File

@ -347,9 +347,6 @@ parloops_is_slp_reduction (loop_vec_info loop_info, gimple *phi,
gimple_assign_rhs1_ptr (next_stmt),
gimple_assign_rhs2_ptr (next_stmt));
update_stmt (next_stmt);
if (CONSTANT_CLASS_P (gimple_assign_rhs1 (next_stmt)))
LOOP_VINFO_OPERANDS_SWAPPED (loop_info) = true;
}
else
return false;
@ -831,9 +828,6 @@ parloops_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info,
if (dump_enabled_p ())
report_ploop_op (MSG_NOTE, def_stmt,
"detected reduction: need to swap operands: ");
if (CONSTANT_CLASS_P (gimple_assign_rhs1 (def_stmt)))
LOOP_VINFO_OPERANDS_SWAPPED (loop_info) = true;
}
else
{

View File

@ -832,7 +832,6 @@ _loop_vec_info::_loop_vec_info (class loop *loop_in, vec_info_shared *shared)
fully_masked_p (false),
peeling_for_gaps (false),
peeling_for_niter (false),
operands_swapped (false),
no_data_dependencies (false),
has_mask_store (false),
scalar_loop_scaling (profile_probability::uninitialized ()),
@ -906,57 +905,6 @@ release_vec_loop_masks (vec_loop_masks *masks)
_loop_vec_info::~_loop_vec_info ()
{
int nbbs;
gimple_stmt_iterator si;
int j;
nbbs = loop->num_nodes;
for (j = 0; j < nbbs; j++)
{
basic_block bb = bbs[j];
for (si = gsi_start_bb (bb); !gsi_end_p (si); )
{
gimple *stmt = gsi_stmt (si);
/* We may have broken canonical form by moving a constant
into RHS1 of a commutative op. Fix such occurrences. */
if (operands_swapped && is_gimple_assign (stmt))
{
enum tree_code code = gimple_assign_rhs_code (stmt);
if ((code == PLUS_EXPR
|| code == POINTER_PLUS_EXPR
|| code == MULT_EXPR)
&& CONSTANT_CLASS_P (gimple_assign_rhs1 (stmt)))
swap_ssa_operands (stmt,
gimple_assign_rhs1_ptr (stmt),
gimple_assign_rhs2_ptr (stmt));
else if (code == COND_EXPR
&& CONSTANT_CLASS_P (gimple_assign_rhs2 (stmt)))
{
tree cond_expr = gimple_assign_rhs1 (stmt);
enum tree_code cond_code = TREE_CODE (cond_expr);
if (TREE_CODE_CLASS (cond_code) == tcc_comparison)
{
bool honor_nans = HONOR_NANS (TREE_OPERAND (cond_expr,
0));
cond_code = invert_tree_comparison (cond_code,
honor_nans);
if (cond_code != ERROR_MARK)
{
TREE_SET_CODE (cond_expr, cond_code);
swap_ssa_operands (stmt,
gimple_assign_rhs2_ptr (stmt),
gimple_assign_rhs3_ptr (stmt));
}
}
}
}
gsi_next (&si);
}
}
free (bbs);
release_vec_loop_masks (&masks);
@ -2715,7 +2663,8 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi,
}
else
{
tree op = gimple_assign_rhs2 (next_stmt);
gcc_assert (gimple_assign_rhs1 (next_stmt) == lhs);
tree op = gimple_assign_rhs2 (next_stmt);
stmt_vec_info def_stmt_info = loop_info->lookup_def (op);
/* Check that the other def is either defined in the loop
@ -2725,23 +2674,12 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi,
&& flow_bb_inside_loop_p (loop, gimple_bb (def_stmt_info->stmt))
&& vect_valid_reduction_input_p (def_stmt_info))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "swapping oprnds: %G",
next_stmt);
swap_ssa_operands (next_stmt,
gimple_assign_rhs1_ptr (next_stmt),
gimple_assign_rhs2_ptr (next_stmt));
update_stmt (next_stmt);
if (CONSTANT_CLASS_P (gimple_assign_rhs1 (next_stmt)))
LOOP_VINFO_OPERANDS_SWAPPED (loop_info) = true;
lhs = gimple_assign_lhs (next_stmt);
continue;
}
else
return false;
}
lhs = gimple_assign_lhs (next_stmt);
return false;
}
}
/* Build up the actual chain. */

View File

@ -528,12 +528,6 @@ public:
we need to peel off iterations at the end to form an epilogue loop. */
bool peeling_for_niter;
/* Reductions are canonicalized so that the last operand is the reduction
operand. If this places a constant into RHS1, this decanonicalizes
GIMPLE for other phases, so we must track when this has occurred and
fix it up. */
bool operands_swapped;
/* True if there are no loop carried data dependencies in the loop.
If loop->safelen <= 1, then this is always true, either the loop
didn't have any loop carried data dependencies, or the loop is being
@ -610,7 +604,6 @@ public:
#define LOOP_VINFO_REDUCTION_CHAINS(L) (L)->reduction_chains
#define LOOP_VINFO_TARGET_COST_DATA(L) (L)->target_cost_data
#define LOOP_VINFO_PEELING_FOR_GAPS(L) (L)->peeling_for_gaps
#define LOOP_VINFO_OPERANDS_SWAPPED(L) (L)->operands_swapped
#define LOOP_VINFO_PEELING_FOR_NITER(L) (L)->peeling_for_niter
#define LOOP_VINFO_NO_DATA_DEPENDENCIES(L) (L)->no_data_dependencies
#define LOOP_VINFO_SCALAR_LOOP(L) (L)->scalar_loop