This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][combine][obvious] Use std::swap instead of manually swapping
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 27 Apr 2015 09:37:52 -0500
- Subject: Re: [PATCH][combine][obvious] Use std::swap instead of manually swapping
- Authentication-results: sourceware.org; auth=none
- References: <553E0785 dot 1080104 at arm dot com>
On Mon, Apr 27, 2015 at 10:55:17AM +0100, Kyrill Tkachov wrote:
> Precedents suggest these changes are considered obvious.
> So I'll commit this in a couple of days unless someone objects.
Yes it's obvious. One tiny thing...
> @@ -9062,7 +9061,7 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val)
> else if (COMPARISON_P (x) || COMMUTATIVE_ARITH_P (x))
> {
> if (rtx_equal_p (XEXP (x, 0), val))
> - cond = swap_condition (cond), temp = val, val = reg, reg = temp;
> + cond = swap_condition (cond), std::swap (val, reg);
>
> if (rtx_equal_p (XEXP (x, 0), reg) && rtx_equal_p (XEXP (x, 1), val))
> {
Might as well write this as two statements, like everywhere else, e.g.
> @@ -11454,7 +11453,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1)
> is already a constant integer. */
> if (swap_commutative_operands_p (op0, op1))
> {
> - tem = op0, op0 = op1, op1 = tem;
> + std::swap (op0, op1);
> code = swap_condition (code);
> }
Thanks,
Segher