Commit fefcf532 by Kyrylo Tkachov Committed by Kyrylo Tkachov

[combine][obvious] Use std::swap instead of manually swapping

	* combine.c (simplify_if_then_else): Use std::swap instead
	of manually swapping.
	(known_cond): Likewise.
	(simplify_comparison): Likewise.

From-SVN: r222468
parent 01f61a78
2015-04-27 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* combine.c (simplify_if_then_else): Use std::swap instead
of manually swapping.
(known_cond): Likewise.
(simplify_comparison): Likewise.
2015-04-27 Peter Bergner <bergner@vnet.ibm.com> 2015-04-27 Peter Bergner <bergner@vnet.ibm.com>
PR target/64579 PR target/64579
......
...@@ -6194,7 +6194,7 @@ simplify_if_then_else (rtx x) ...@@ -6194,7 +6194,7 @@ simplify_if_then_else (rtx x)
if (false_code == EQ) if (false_code == EQ)
{ {
swapped = 1, true_code = EQ, false_code = NE; swapped = 1, true_code = EQ, false_code = NE;
temp = true_rtx, true_rtx = false_rtx, false_rtx = temp; std::swap (true_rtx, false_rtx);
} }
/* If we are comparing against zero and the expression being tested has /* If we are comparing against zero and the expression being tested has
...@@ -6259,7 +6259,7 @@ simplify_if_then_else (rtx x) ...@@ -6259,7 +6259,7 @@ simplify_if_then_else (rtx x)
SUBST (XEXP (x, 1), false_rtx); SUBST (XEXP (x, 1), false_rtx);
SUBST (XEXP (x, 2), true_rtx); SUBST (XEXP (x, 2), true_rtx);
temp = true_rtx, true_rtx = false_rtx, false_rtx = temp; std::swap (true_rtx, false_rtx);
cond = XEXP (x, 0); cond = XEXP (x, 0);
/* It is possible that the conditional has been simplified out. */ /* It is possible that the conditional has been simplified out. */
...@@ -9031,7 +9031,6 @@ static rtx ...@@ -9031,7 +9031,6 @@ static rtx
known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val) known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val)
{ {
enum rtx_code code = GET_CODE (x); enum rtx_code code = GET_CODE (x);
rtx temp;
const char *fmt; const char *fmt;
int i, j; int i, j;
...@@ -9071,7 +9070,10 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val) ...@@ -9071,7 +9070,10 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val)
else if (COMPARISON_P (x) || COMMUTATIVE_ARITH_P (x)) else if (COMPARISON_P (x) || COMMUTATIVE_ARITH_P (x))
{ {
if (rtx_equal_p (XEXP (x, 0), val)) if (rtx_equal_p (XEXP (x, 0), val))
cond = swap_condition (cond), temp = val, val = reg, reg = temp; {
std::swap (val, reg);
cond = swap_condition (cond);
}
if (rtx_equal_p (XEXP (x, 0), reg) && rtx_equal_p (XEXP (x, 1), val)) if (rtx_equal_p (XEXP (x, 0), reg) && rtx_equal_p (XEXP (x, 1), val))
{ {
...@@ -11448,7 +11450,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) ...@@ -11448,7 +11450,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
is already a constant integer. */ is already a constant integer. */
if (swap_commutative_operands_p (op0, op1)) if (swap_commutative_operands_p (op0, op1))
{ {
tem = op0, op0 = op1, op1 = tem; std::swap (op0, op1);
code = swap_condition (code); code = swap_condition (code);
} }
...@@ -12335,7 +12337,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) ...@@ -12335,7 +12337,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
/* We may have changed the comparison operands. Re-canonicalize. */ /* We may have changed the comparison operands. Re-canonicalize. */
if (swap_commutative_operands_p (op0, op1)) if (swap_commutative_operands_p (op0, op1))
{ {
tem = op0, op0 = op1, op1 = tem; std::swap (op0, op1);
code = swap_condition (code); code = swap_condition (code);
} }
......
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