Commit 14e72812 by Richard Biener Committed by Richard Biener

fold-const.c (tree_swap_operands_p): Remove unused arg.

2016-11-09  Richard Biener  <rguenther@suse.de>

	* fold-const.c (tree_swap_operands_p): Remove unused arg.
	* fold-const.c (tree_swap_operands_p): Likewise.
	(fold_binary_loc): Adjust.
	(fold_ternary_loc): Likewise.
	* genmatch.c (dt_operand::gen_gimple_exp): Likewise.
	* gimple-fold.c (fold_stmt_1): Likewise.
	* gimple-match-head.c (gimple_resimplify2): Likewise.
	(gimple_resimplify3): Likewise.
	(gimple_simplify): Likewise.
	* tree-ssa-dom.c (record_equality): Likewise.
	* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Likewise.
	* tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise.
	* tree-ssa-threadedge.c (simplify_control_stmt_condition_1): Likewise.

From-SVN: r242004
parent 2c49f22a
2016-11-09 Richard Biener <rguenther@suse.de> 2016-11-09 Richard Biener <rguenther@suse.de>
* fold-const.c (tree_swap_operands_p): Remove unused arg.
* fold-const.c (tree_swap_operands_p): Likewise.
(fold_binary_loc): Adjust.
(fold_ternary_loc): Likewise.
* genmatch.c (dt_operand::gen_gimple_exp): Likewise.
* gimple-fold.c (fold_stmt_1): Likewise.
* gimple-match-head.c (gimple_resimplify2): Likewise.
(gimple_resimplify3): Likewise.
(gimple_simplify): Likewise.
* tree-ssa-dom.c (record_equality): Likewise.
* tree-ssa-reassoc.c (optimize_range_tests_var_bound): Likewise.
* tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise.
* tree-ssa-threadedge.c (simplify_control_stmt_condition_1): Likewise.
2016-11-09 Richard Biener <rguenther@suse.de>
* tree-ssa-dom.c (canonicalize_comparison): Remove. * tree-ssa-dom.c (canonicalize_comparison): Remove.
(optimize_stmt): Remove redundant pre-propagation canonicalization (optimize_stmt): Remove redundant pre-propagation canonicalization
of comparison operand order. of comparison operand order.
...@@ -6758,7 +6758,7 @@ fold_single_bit_test (location_t loc, enum tree_code code, ...@@ -6758,7 +6758,7 @@ fold_single_bit_test (location_t loc, enum tree_code code,
isn't. */ isn't. */
bool bool
tree_swap_operands_p (const_tree arg0, const_tree arg1, bool) tree_swap_operands_p (const_tree arg0, const_tree arg1)
{ {
if (CONSTANT_CLASS_P (arg1)) if (CONSTANT_CLASS_P (arg1))
return 0; return 0;
...@@ -9132,13 +9132,13 @@ fold_binary_loc (location_t loc, ...@@ -9132,13 +9132,13 @@ fold_binary_loc (location_t loc,
/* If this is a commutative operation, and ARG0 is a constant, move it /* If this is a commutative operation, and ARG0 is a constant, move it
to ARG1 to reduce the number of tests below. */ to ARG1 to reduce the number of tests below. */
if (commutative_tree_code (code) if (commutative_tree_code (code)
&& tree_swap_operands_p (arg0, arg1, true)) && tree_swap_operands_p (arg0, arg1))
return fold_build2_loc (loc, code, type, op1, op0); return fold_build2_loc (loc, code, type, op1, op0);
/* Likewise if this is a comparison, and ARG0 is a constant, move it /* Likewise if this is a comparison, and ARG0 is a constant, move it
to ARG1 to reduce the number of tests below. */ to ARG1 to reduce the number of tests below. */
if (kind == tcc_comparison if (kind == tcc_comparison
&& tree_swap_operands_p (arg0, arg1, true)) && tree_swap_operands_p (arg0, arg1))
return fold_build2_loc (loc, swap_tree_comparison (code), type, op1, op0); return fold_build2_loc (loc, swap_tree_comparison (code), type, op1, op0);
tem = generic_simplify (loc, code, type, op0, op1); tem = generic_simplify (loc, code, type, op0, op1);
...@@ -11242,7 +11242,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, ...@@ -11242,7 +11242,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
/* If this is a commutative operation, and OP0 is a constant, move it /* If this is a commutative operation, and OP0 is a constant, move it
to OP1 to reduce the number of tests below. */ to OP1 to reduce the number of tests below. */
if (commutative_ternary_tree_code (code) if (commutative_ternary_tree_code (code)
&& tree_swap_operands_p (op0, op1, true)) && tree_swap_operands_p (op0, op1))
return fold_build3_loc (loc, code, type, op1, op0, op2); return fold_build3_loc (loc, code, type, op1, op0, op2);
tem = generic_simplify (loc, code, type, op0, op1, op2); tem = generic_simplify (loc, code, type, op0, op1, op2);
...@@ -11371,7 +11371,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, ...@@ -11371,7 +11371,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
/* If the second operand is simpler than the third, swap them /* If the second operand is simpler than the third, swap them
since that produces better jump optimization results. */ since that produces better jump optimization results. */
if (truth_value_p (TREE_CODE (arg0)) if (truth_value_p (TREE_CODE (arg0))
&& tree_swap_operands_p (op1, op2, false)) && tree_swap_operands_p (op1, op2))
{ {
location_t loc0 = expr_location_or (arg0, loc); location_t loc0 = expr_location_or (arg0, loc);
/* See if this can be inverted. If it can't, possibly because /* See if this can be inverted. If it can't, possibly because
......
...@@ -124,7 +124,7 @@ extern tree build_invariant_address (tree, tree, HOST_WIDE_INT); ...@@ -124,7 +124,7 @@ extern tree build_invariant_address (tree, tree, HOST_WIDE_INT);
extern tree constant_boolean_node (bool, tree); extern tree constant_boolean_node (bool, tree);
extern tree div_if_zero_remainder (const_tree, const_tree); extern tree div_if_zero_remainder (const_tree, const_tree);
extern bool tree_swap_operands_p (const_tree, const_tree, bool); extern bool tree_swap_operands_p (const_tree, const_tree);
extern enum tree_code swap_tree_comparison (enum tree_code); extern enum tree_code swap_tree_comparison (enum tree_code);
extern bool ptr_difference_const (tree, tree, HOST_WIDE_INT *); extern bool ptr_difference_const (tree, tree, HOST_WIDE_INT *);
......
...@@ -2701,7 +2701,7 @@ dt_operand::gen_gimple_expr (FILE *f, int indent) ...@@ -2701,7 +2701,7 @@ dt_operand::gen_gimple_expr (FILE *f, int indent)
gen_opname (child_opname0, 0); gen_opname (child_opname0, 0);
gen_opname (child_opname1, 1); gen_opname (child_opname1, 1);
fprintf_indent (f, indent, fprintf_indent (f, indent,
"if (tree_swap_operands_p (%s, %s, false))\n", "if (tree_swap_operands_p (%s, %s))\n",
child_opname0, child_opname1); child_opname0, child_opname1);
fprintf_indent (f, indent, fprintf_indent (f, indent,
" std::swap (%s, %s);\n", " std::swap (%s, %s);\n",
......
...@@ -4166,7 +4166,7 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree)) ...@@ -4166,7 +4166,7 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree))
{ {
tree rhs1 = gimple_assign_rhs1 (stmt); tree rhs1 = gimple_assign_rhs1 (stmt);
tree rhs2 = gimple_assign_rhs2 (stmt); tree rhs2 = gimple_assign_rhs2 (stmt);
if (tree_swap_operands_p (rhs1, rhs2, false)) if (tree_swap_operands_p (rhs1, rhs2))
{ {
gimple_assign_set_rhs1 (stmt, rhs2); gimple_assign_set_rhs1 (stmt, rhs2);
gimple_assign_set_rhs2 (stmt, rhs1); gimple_assign_set_rhs2 (stmt, rhs1);
...@@ -4232,7 +4232,7 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree)) ...@@ -4232,7 +4232,7 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree))
/* Canonicalize operand order. */ /* Canonicalize operand order. */
tree lhs = gimple_cond_lhs (stmt); tree lhs = gimple_cond_lhs (stmt);
tree rhs = gimple_cond_rhs (stmt); tree rhs = gimple_cond_rhs (stmt);
if (tree_swap_operands_p (lhs, rhs, false)) if (tree_swap_operands_p (lhs, rhs))
{ {
gcond *gc = as_a <gcond *> (stmt); gcond *gc = as_a <gcond *> (stmt);
gimple_cond_set_lhs (gc, rhs); gimple_cond_set_lhs (gc, rhs);
......
...@@ -151,7 +151,7 @@ gimple_resimplify2 (gimple_seq *seq, ...@@ -151,7 +151,7 @@ gimple_resimplify2 (gimple_seq *seq,
if (res_code->is_tree_code () if (res_code->is_tree_code ()
&& (TREE_CODE_CLASS ((enum tree_code) *res_code) == tcc_comparison && (TREE_CODE_CLASS ((enum tree_code) *res_code) == tcc_comparison
|| commutative_tree_code (*res_code)) || commutative_tree_code (*res_code))
&& tree_swap_operands_p (res_ops[0], res_ops[1], false)) && tree_swap_operands_p (res_ops[0], res_ops[1]))
{ {
std::swap (res_ops[0], res_ops[1]); std::swap (res_ops[0], res_ops[1]);
if (TREE_CODE_CLASS ((enum tree_code) *res_code) == tcc_comparison) if (TREE_CODE_CLASS ((enum tree_code) *res_code) == tcc_comparison)
...@@ -212,7 +212,7 @@ gimple_resimplify3 (gimple_seq *seq, ...@@ -212,7 +212,7 @@ gimple_resimplify3 (gimple_seq *seq,
bool canonicalized = false; bool canonicalized = false;
if (res_code->is_tree_code () if (res_code->is_tree_code ()
&& commutative_ternary_tree_code (*res_code) && commutative_ternary_tree_code (*res_code)
&& tree_swap_operands_p (res_ops[0], res_ops[1], false)) && tree_swap_operands_p (res_ops[0], res_ops[1]))
{ {
std::swap (res_ops[0], res_ops[1]); std::swap (res_ops[0], res_ops[1]);
canonicalized = true; canonicalized = true;
...@@ -432,7 +432,7 @@ gimple_simplify (enum tree_code code, tree type, ...@@ -432,7 +432,7 @@ gimple_simplify (enum tree_code code, tree type,
generation. */ generation. */
if ((commutative_tree_code (code) if ((commutative_tree_code (code)
|| TREE_CODE_CLASS (code) == tcc_comparison) || TREE_CODE_CLASS (code) == tcc_comparison)
&& tree_swap_operands_p (op0, op1, false)) && tree_swap_operands_p (op0, op1))
{ {
std::swap (op0, op1); std::swap (op0, op1);
if (TREE_CODE_CLASS (code) == tcc_comparison) if (TREE_CODE_CLASS (code) == tcc_comparison)
...@@ -466,7 +466,7 @@ gimple_simplify (enum tree_code code, tree type, ...@@ -466,7 +466,7 @@ gimple_simplify (enum tree_code code, tree type,
/* Canonicalize operand order both for matching and fallback stmt /* Canonicalize operand order both for matching and fallback stmt
generation. */ generation. */
if (commutative_ternary_tree_code (code) if (commutative_ternary_tree_code (code)
&& tree_swap_operands_p (op0, op1, false)) && tree_swap_operands_p (op0, op1))
std::swap (op0, op1); std::swap (op0, op1);
code_helper rcode; code_helper rcode;
......
...@@ -1136,7 +1136,7 @@ record_equality (tree x, tree y, class const_and_copies *const_and_copies) ...@@ -1136,7 +1136,7 @@ record_equality (tree x, tree y, class const_and_copies *const_and_copies)
{ {
tree prev_x = NULL, prev_y = NULL; tree prev_x = NULL, prev_y = NULL;
if (tree_swap_operands_p (x, y, false)) if (tree_swap_operands_p (x, y))
std::swap (x, y); std::swap (x, y);
/* Most of the time tree_swap_operands_p does what we want. But there /* Most of the time tree_swap_operands_p does what we want. But there
......
...@@ -2980,7 +2980,7 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length, ...@@ -2980,7 +2980,7 @@ optimize_range_tests_var_bound (enum tree_code opcode, int first, int length,
gimple_set_uid (g, uid); gimple_set_uid (g, uid);
rhs2 = gimple_assign_lhs (g); rhs2 = gimple_assign_lhs (g);
gsi_insert_before (&gsi, g, GSI_SAME_STMT); gsi_insert_before (&gsi, g, GSI_SAME_STMT);
if (tree_swap_operands_p (rhs1, rhs2, false)) if (tree_swap_operands_p (rhs1, rhs2))
{ {
std::swap (rhs1, rhs2); std::swap (rhs1, rhs2);
ccode = swap_tree_comparison (ccode); ccode = swap_tree_comparison (ccode);
......
...@@ -2580,10 +2580,10 @@ vn_nary_op_compute_hash (const vn_nary_op_t vno1) ...@@ -2580,10 +2580,10 @@ vn_nary_op_compute_hash (const vn_nary_op_t vno1)
&& commutative_tree_code (vno1->opcode)) && commutative_tree_code (vno1->opcode))
|| (vno1->length == 3 || (vno1->length == 3
&& commutative_ternary_tree_code (vno1->opcode))) && commutative_ternary_tree_code (vno1->opcode)))
&& tree_swap_operands_p (vno1->op[0], vno1->op[1], false)) && tree_swap_operands_p (vno1->op[0], vno1->op[1]))
std::swap (vno1->op[0], vno1->op[1]); std::swap (vno1->op[0], vno1->op[1]);
else if (TREE_CODE_CLASS (vno1->opcode) == tcc_comparison else if (TREE_CODE_CLASS (vno1->opcode) == tcc_comparison
&& tree_swap_operands_p (vno1->op[0], vno1->op[1], false)) && tree_swap_operands_p (vno1->op[0], vno1->op[1]))
{ {
std::swap (vno1->op[0], vno1->op[1]); std::swap (vno1->op[0], vno1->op[1]);
vno1->opcode = swap_tree_comparison (vno1->opcode); vno1->opcode = swap_tree_comparison (vno1->opcode);
......
...@@ -564,7 +564,7 @@ simplify_control_stmt_condition_1 (edge e, ...@@ -564,7 +564,7 @@ simplify_control_stmt_condition_1 (edge e,
example, op0 might be a constant while op1 is an example, op0 might be a constant while op1 is an
SSA_NAME. Failure to canonicalize will cause us to SSA_NAME. Failure to canonicalize will cause us to
miss threading opportunities. */ miss threading opportunities. */
if (tree_swap_operands_p (op0, op1, false)) if (tree_swap_operands_p (op0, op1))
{ {
cond_code = swap_tree_comparison (cond_code); cond_code = swap_tree_comparison (cond_code);
std::swap (op0, op1); std::swap (op0, op1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment