summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-17 12:17:24 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-17 12:17:24 +0000
commit119368d7e809efce50a918c57594cdb58bcaf412 (patch)
tree89ce4f78749dc7f9bd9689f363fa59e973cae20f /gcc/tree-ssa-math-opts.c
parente5e1149640694e658cff398ecb1e45aec07b856d (diff)
downloadgcc-119368d7e809efce50a918c57594cdb58bcaf412.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131595 138bc75d-0d04-0410-961f-82ee72b054a4
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 543169ad932..5a7bf8bc66d 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