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
This commit is contained in:
Joseph Myers 2005-11-19 12:32:23 +00:00 committed by Joseph Myers
parent 0ed9a3e314
commit 756191b7c5
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-11-19 Joseph S. Myers <joseph@codesourcery.com>
* combine.c (make_compound_operation): Swap operands of
commutative operation if necessary before returning.
2005-11-19 Richard Guenther <rguenther@suse.de>
PR middle-end/23294

View File

@ -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;
}