aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/combine.c10
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1200433..21b5585 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/combine.c b/gcc/combine.c
index 9f910a7..b43b9b6 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;
}