This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]