+2008-02-05 Richard Guenther <rguenther@suse.de>
+
+ Backport from mainline:
+ 2008-01-17 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/34825
+ * tree-ssa-math-opts.c (is_division_by): Do not recognize
+ x / x as division to handle.
+
2008-02-05 Joseph Myers <joseph@codesourcery.com>
* doc/include/texinfo.tex: Update to version 2008-02-04.16.
+2008-02-05 Richard Guenther <rguenther@suse.de>
+
+ Backport from mainline:
+ 2008-01-17 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/34825
+ * gcc.dg/pr34825.c: New testcase.
+
2008-02-05 Richard Guenther <rguenther@suse.de>
Backport from mainline:
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -funsafe-math-optimizations" } */
+
+double foo(double x, double y)
+{
+ return x == y ? x/y*x/y : 0;
+}
+
{
return TREE_CODE (use_stmt) == MODIFY_EXPR
&& TREE_CODE (TREE_OPERAND (use_stmt, 1)) == RDIV_EXPR
- && TREE_OPERAND (TREE_OPERAND (use_stmt, 1), 1) == def;
+ && TREE_OPERAND (TREE_OPERAND (use_stmt, 1), 1) == def
+ /* Do not recognize x / x as valid division, as we are getting
+ confused later by replacing all immediate uses x in such
+ a stmt. */
+ && TREE_OPERAND (TREE_OPERAND (use_stmt, 1), 0) != def;
}
/* Walk the subset of the dominator tree rooted at OCC, setting the