diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-17 12:17:24 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-01-17 12:17:24 +0000 |
commit | 119368d7e809efce50a918c57594cdb58bcaf412 (patch) | |
tree | 89ce4f78749dc7f9bd9689f363fa59e973cae20f /gcc/tree-ssa-math-opts.c | |
parent | e5e1149640694e658cff398ecb1e45aec07b856d (diff) | |
download | gcc-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.c | 6 |
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 |