* [PATCH][obvious] Use std::swap instead of manually swapping in a few more places
@ 2015-07-24 17:53 Kyrill Tkachov
0 siblings, 0 replies; only message in thread
From: Kyrill Tkachov @ 2015-07-24 17:53 UTC (permalink / raw)
To: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
Hi all,
This patch uses std::swap in a few places in the midend, replacing the manual approach, and removing
a few, now unused, local variables in the process.
Bootstrapped on x86_64.
Committed as obvious with r226179.
Thanks,
Kyrill
2015-07-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* alias.c (nonoverlapping_memrefs_p): Use std::swap instead of
manually swapping values.
* cse.c (fold_rtx): Likewise.
* lra-eliminations.c (form_sum): Likewise.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: midend-swaps.patch --]
[-- Type: text/x-patch; name=midend-swaps.patch, Size: 2411 bytes --]
commit 8ab508f57d6f10ac6ec97f61f80689807821772f
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Fri Jul 24 16:16:35 2015 +0100
[obvious] Use std::swap instead of manually swapping in a few more places
diff --git a/gcc/alias.c b/gcc/alias.c
index 3203722..fa7d5d8 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)
@@ -2583,8 +2583,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 1c14d83..112cac5 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 c8da0c2..fdf4179 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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-24 16:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 17:53 [PATCH][obvious] Use std::swap instead of manually swapping in a few more places Kyrill Tkachov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).