From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99629 invoked by alias); 27 Apr 2015 09:55:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 99550 invoked by uid 89); 27 Apr 2015 09:55:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Apr 2015 09:55:22 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-5.uk.mimecast.lan; Mon, 27 Apr 2015 10:55:17 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Apr 2015 10:55:17 +0100 Message-ID: <553E0785.1080104@arm.com> Date: Mon, 27 Apr 2015 09:55:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches CC: Segher Boessenkool Subject: [PATCH][combine][obvious] Use std::swap instead of manually swapping X-MC-Unique: fbSMUuyJQp6mo3nbevaAVQ-1 Content-Type: multipart/mixed; boundary="------------060102000303020805040103" X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01588.txt.bz2 This is a multi-part message in MIME format. --------------060102000303020805040103 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-length: 501 Hi all, This is another one of those std::swap patches, this time I was in the comb= ine neighbourhood Bootstrapped on x86_64 and tested on aarch64. Precedents suggest these changes are considered obvious. So I'll commit this in a couple of days unless someone objects. Thanks, Kyrill 2015-04-27 Kyrylo Tkachov * combine.c (simplify_if_then_else): Use std::swap instead of manually swapping. (known_cond): Likewise. (simplify_comparison): Likewise. --------------060102000303020805040103 Content-Type: text/x-patch; name=combine-swap.patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="combine-swap.patch" Content-length: 2243 commit e8aa8f2ec22cf548bc05f0f8e56a13a2bdd1c228 Author: Kyrylo Tkachov Date: Fri Apr 24 17:47:14 2015 +0100 [combine][obvious] Use std::swap instead of manually swapping diff --git a/gcc/combine.c b/gcc/combine.c index 9f840cb..5f7cbc0 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6185,7 +6185,7 @@ simplify_if_then_else (rtx x) if (false_code =3D=3D EQ) { swapped =3D 1, true_code =3D EQ, false_code =3D NE; - temp =3D true_rtx, true_rtx =3D false_rtx, false_rtx =3D temp; + std::swap (true_rtx, false_rtx); } =20 /* If we are comparing against zero and the expression being tested = has @@ -6250,7 +6250,7 @@ simplify_if_then_else (rtx x) SUBST (XEXP (x, 1), false_rtx); SUBST (XEXP (x, 2), true_rtx); =20 - temp =3D true_rtx, true_rtx =3D false_rtx, false_rtx =3D temp; + std::swap (true_rtx, false_rtx); cond =3D XEXP (x, 0); =20 /* It is possible that the conditional has been simplified out. */ @@ -9022,7 +9022,6 @@ static rtx known_cond (rtx x, enum rtx_code cond, rtx reg, rtx val) { enum rtx_code code =3D GET_CODE (x); - rtx temp; const char *fmt; int i, j; =20 @@ -9062,7 +9061,7 @@ known_cond (rtx x, enum rtx_code cond, rtx reg, rtx v= al) else if (COMPARISON_P (x) || COMMUTATIVE_ARITH_P (x)) { if (rtx_equal_p (XEXP (x, 0), val)) - cond =3D swap_condition (cond), temp =3D val, val =3D reg, reg =3D temp; + cond =3D swap_condition (cond), std::swap (val, reg); =20 if (rtx_equal_p (XEXP (x, 0), reg) && rtx_equal_p (XEXP (x, 1), val)) { @@ -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 =3D op0, op0 =3D op1, op1 =3D tem; + std::swap (op0, op1); code =3D swap_condition (code); } =20 @@ -12341,7 +12340,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0,= rtx *pop1) /* We may have changed the comparison operands. Re-canonicalize. */ if (swap_commutative_operands_p (op0, op1)) { - tem =3D op0, op0 =3D op1, op1 =3D tem; + std::swap (op0, op1); code =3D swap_condition (code); } =20 --------------060102000303020805040103--