Hi all,

Here is the next battle in the war against manual swapping, this time in ifcvt.
Bootstrapped and tested on aarch64, x86_64.

Committed as obvious with r224429.

Thanks,
Kyrill

2015-06-12  Kyrylo Tkachov  <kyrylo.tkac...@arm.com>

        * ifcvt.c (noce_try_store_flag_constants): Use std::swap instead of
        manually swapping.
        (noce_try_cmove_arith): Likewise.
        (noce_get_alt_condition): Likewise.

diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 9475c00..986f28f 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1227,7 +1227,7 @@ noce_try_store_flag_constants (struct noce_if_info *if_info)
 
       if (reversep)
 	{
-	  tmp = itrue; itrue = ifalse; ifalse = tmp;
+	  std::swap (itrue, ifalse);
 	  diff = trunc_int_for_mode (-(unsigned HOST_WIDE_INT) diff, mode);
 	}
 
@@ -1689,11 +1689,9 @@ noce_try_cmove_arith (struct noce_if_info *if_info)
 
       if (reversep)
 	{
-	  rtx tmp;
-	  rtx_insn *tmp_insn;
 	  code = reversed_comparison_code (if_info->cond, if_info->jump);
-	  tmp = a, a = b, b = tmp;
-	  tmp_insn = insn_a, insn_a = insn_b, insn_b = tmp_insn;
+	  std::swap (a, b);
+	  std::swap (insn_a, insn_b);
 	}
     }
 
@@ -1875,9 +1873,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
 
 	      if (CONST_INT_P (op_a))
 		{
-		  rtx tmp = op_a;
-		  op_a = op_b;
-		  op_b = tmp;
+		  std::swap (op_a, op_b);
 		  code = swap_condition (code);
 		}
 	    }

Reply via email to