From 4e1952ab19938ee492bc15c0df77f959ab0cd9d3 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Fri, 24 Jul 2015 16:46:04 +0000 Subject: [PATCH] [obvious] Use std::swap instead of manually swapping in a few more places * alias.c (nonoverlapping_memrefs_p): Use std::swap instead of manually swapping values. * cse.c (fold_rtx): Likewise. * lra-eliminations.c (form_sum): Likewise. From-SVN: r226179 --- gcc/ChangeLog | 7 +++++++ gcc/alias.c | 6 +++--- gcc/cse.c | 5 ++--- gcc/lra-eliminations.c | 3 +-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f2f87bdc21..5a859634702 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-07-24 Kyrylo Tkachov + + * alias.c (nonoverlapping_memrefs_p): Use std::swap instead of + manually swapping values. + * cse.c (fold_rtx): Likewise. + * lra-eliminations.c (form_sum): Likewise. + 2015-07-24 Uros Bizjak PR target/64003 diff --git a/gcc/alias.c b/gcc/alias.c index 69e37326a68..4681e3f8b96 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -2466,7 +2466,7 @@ nonoverlapping_memrefs_p (const_rtx x, const_rtx y, bool loop_invariant) rtx basex, basey; bool moffsetx_known_p, moffsety_known_p; HOST_WIDE_INT moffsetx = 0, moffsety = 0; - HOST_WIDE_INT offsetx = 0, offsety = 0, sizex, sizey, tem; + HOST_WIDE_INT offsetx = 0, offsety = 0, sizex, sizey; /* Unless both have exprs, we can't tell anything. */ if (exprx == 0 || expry == 0) @@ -2596,8 +2596,8 @@ nonoverlapping_memrefs_p (const_rtx x, const_rtx y, bool loop_invariant) /* Put the values of the memref with the lower offset in X's values. */ if (offsetx > offsety) { - tem = offsetx, offsetx = offsety, offsety = tem; - tem = sizex, sizex = sizey, sizey = tem; + std::swap (offsetx, offsety); + std::swap (sizex, sizey); } /* If we don't know the size of the lower-offset value, we can't tell diff --git a/gcc/cse.c b/gcc/cse.c index 96adf18e6b7..88c82fc8d74 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -3297,9 +3297,8 @@ fold_rtx (rtx x, rtx_insn *insn) consistent with the order in X. */ if (canonicalize_change_group (insn, x)) { - rtx tem; - tem = const_arg0, const_arg0 = const_arg1, const_arg1 = tem; - tem = folded_arg0, folded_arg0 = folded_arg1, folded_arg1 = tem; + std::swap (const_arg0, const_arg1); + std::swap (folded_arg0, folded_arg1); } apply_change_group (); diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c index c8da0c20dea..fdf4179927e 100644 --- a/gcc/lra-eliminations.c +++ b/gcc/lra-eliminations.c @@ -215,7 +215,6 @@ setup_elimination_map (void) static rtx form_sum (rtx x, rtx y) { - rtx tem; machine_mode mode = GET_MODE (x); if (mode == VOIDmode) @@ -229,7 +228,7 @@ form_sum (rtx x, rtx y) else if (CONST_INT_P (y)) return plus_constant (mode, x, INTVAL (y)); else if (CONSTANT_P (x)) - tem = x, x = y, y = tem; + std::swap (x, y); if (GET_CODE (x) == PLUS && CONSTANT_P (XEXP (x, 1))) return form_sum (XEXP (x, 0), form_sum (XEXP (x, 1), y)); -- 2.30.2