aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-01-17 12:17:24 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-01-17 12:17:24 +0000
commit8a5b57cdfd40c2996c755d4cc2707c5ea3c2ca67 (patch)
tree89ce4f78749dc7f9bd9689f363fa59e973cae20f /gcc/tree-ssa-math-opts.c
parentf779b9aec9e34471fa2933ee21eb368e08e68a85 (diff)
downloadgcc-8a5b57cdfd40c2996c755d4cc2707c5ea3c2ca67.zip
gcc-8a5b57cdfd40c2996c755d4cc2707c5ea3c2ca67.tar.gz
gcc-8a5b57cdfd40c2996c755d4cc2707c5ea3c2ca67.tar.bz2
re PR tree-optimization/34825 (ICE with -funsafe-math-optimizations)
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. * gcc.dg/pr34825.c: New testcase. From-SVN: r131595
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 543169a..5a7bf8b 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -275,7 +275,11 @@ is_division_by (tree use_stmt, tree def)
{
return TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
&& TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == RDIV_EXPR
- && TREE_OPERAND (GIMPLE_STMT_OPERAND (use_stmt, 1), 1) == def;
+ && TREE_OPERAND (GIMPLE_STMT_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 (GIMPLE_STMT_OPERAND (use_stmt, 1), 0) != def;
}
/* Walk the subset of the dominator tree rooted at OCC, setting the