From: Joseph Myers Date: Sat, 19 Nov 2005 12:32:23 +0000 (+0000) Subject: combine.c (make_compound_operation): Swap operands of commutative operation if necess... X-Git-Tag: releases/gcc-4.2.0~5862 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=756191b7c51263603b91b45f60d5d6acf7250711;p=thirdparty%2Fgcc.git combine.c (make_compound_operation): Swap operands of commutative operation if necessary before returning. * combine.c (make_compound_operation): Swap operands of commutative operation if necessary before returning. From-SVN: r107219 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1200433e317e..21b558572606 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-11-19 Joseph S. Myers + + * combine.c (make_compound_operation): Swap operands of + commutative operation if necessary before returning. + 2005-11-19 Richard Guenther PR middle-end/23294 diff --git a/gcc/combine.c b/gcc/combine.c index 9f910a7b336e..b43b9b621c66 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6914,6 +6914,16 @@ make_compound_operation (rtx x, enum rtx_code in_code) SUBST (XEXP (x, i), new); } + /* If this is a commutative operation, the changes to the operands + may have made it noncanonical. */ + if (COMMUTATIVE_ARITH_P (x) + && swap_commutative_operands_p (XEXP (x, 0), XEXP (x, 1))) + { + tem = XEXP (x, 0); + SUBST (XEXP (x, 0), XEXP (x, 1)); + SUBST (XEXP (x, 1), tem); + } + return x; }