summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fold-const.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d64b513128a..29a87a34541 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2011-06-10 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/49361
+ * fold-const.c (fold_binary_loc): Only fold x * x to pow (x, 2.0)
+ when not already in gimple form.
+
+2011-06-10 Richard Guenther <rguenther@suse.de>
+
PR bootstrap/49344
* tree-ssa-math-opts.c (convert_mult_to_fma): Use
FOR_EACH_PHI_OR_STMT_USE.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9a3f8cb0fec..e1a497eda96 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -10519,7 +10519,8 @@ fold_binary_loc (location_t loc,
}
/* Optimize x*x as pow(x,2.0), which is expanded as x*x. */
- if (optimize_function_for_speed_p (cfun)
+ if (!in_gimple_form
+ && optimize_function_for_speed_p (cfun)
&& operand_equal_p (arg0, arg1, 0))
{
tree powfn = mathfn_built_in (type, BUILT_IN_POW);