aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-01-07 10:53:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-01-07 10:53:30 +0000
commitcef158f9253739ab1b1f4342d530b933f1e1fc34 (patch)
tree518bb42576e6930222440ecd11448fd0360f85b9
parent238e3a40af2349190dc662aed9476576af4b4516 (diff)
downloadgcc-cef158f9253739ab1b1f4342d530b933f1e1fc34.zip
gcc-cef158f9253739ab1b1f4342d530b933f1e1fc34.tar.gz
gcc-cef158f9253739ab1b1f4342d530b933f1e1fc34.tar.bz2
re PR middle-end/38751 (odd performance regression with -Os)
2009-01-07 Richard Guenther <rguenther@suse.de> PR middle-end/38751 * fold-const.c (extract_muldiv): Remove obsolete comment. (fold_plusminus_mult_expr): Undo MINUS_EXPR to PLUS_EXPR canonicalization for the canonicalization. From-SVN: r143152
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c16
2 files changed, 18 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8a606a..81804116 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-07 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/38751
+ * fold-const.c (extract_muldiv): Remove obsolete comment.
+ (fold_plusminus_mult_expr): Undo MINUS_EXPR
+ to PLUS_EXPR canonicalization for the canonicalization.
+
2009-01-07 Gerald Pfeifer <gerald@pfeifer.com>
* doc/install.texi (alpha*-dec-osf*): Remove note on 32-bit
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index be542b7..9b4106b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6008,10 +6008,6 @@ optimize_minmax_comparison (enum tree_code code, tree type, tree op0, tree op1)
expression would not overflow or that overflow is undefined for the type
in the language in question.
- We also canonicalize (X + 7) * 4 into X * 4 + 28 in the hope that either
- the machine has a multiply-accumulate insn or that this is part of an
- addressing calculation.
-
If we return a non-null expression, it is an equivalent form of the
original computation, but need not be in the original type.
@@ -7439,7 +7435,17 @@ fold_plusminus_mult_expr (enum tree_code code, tree type, tree arg0, tree arg1)
else if (TREE_CODE (arg1) == INTEGER_CST)
{
arg10 = build_one_cst (type);
- arg11 = arg1;
+ /* As we canonicalize A - 2 to A + -2 get rid of that sign for
+ the purpose of this canonicalization. */
+ if (TREE_INT_CST_HIGH (arg1) == -1
+ && negate_expr_p (arg1)
+ && code == PLUS_EXPR)
+ {
+ arg11 = negate_expr (arg1);
+ code = MINUS_EXPR;
+ }
+ else
+ arg11 = arg1;
}
else
{