diff options
author | Richard Guenther <rguenther@suse.de> | 2006-05-07 13:07:22 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2006-05-07 13:07:22 +0000 |
commit | ed52affe53af75a099b132ed9957f3df28636f49 (patch) | |
tree | 3dd46ae043a71d836aae430f74c237ff07adf664 | |
parent | ef5d0a896e8a7efb1a51a628c9fe7eea4f4e99a6 (diff) | |
download | gcc-ed52affe53af75a099b132ed9957f3df28636f49.zip gcc-ed52affe53af75a099b132ed9957f3df28636f49.tar.gz gcc-ed52affe53af75a099b132ed9957f3df28636f49.tar.bz2 |
re PR middle-end/27136 (Compile failure with -O -ffast-math)
2006-05-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27136
* tree-ssa-loop-niter.c (get_val_for): Correct function
comment, assert requirements.
(loop_niter_by_eval): Stop processing if the iterated
value did not simplify.
* gcc.dg/torture/pr27136.c: New testcase.
From-SVN: r113601
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr27136.c | 10 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 10 |
4 files changed, 31 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eed3b07..bc21174 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2006-05-07 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/27136 + * tree-ssa-loop-niter.c (get_val_for): Correct function + comment, assert requirements. + (loop_niter_by_eval): Stop processing if the iterated + value did not simplify. + 2006-05-07 Mircea Namolaru <namolaru@il.ibm.com> * opts.c (flag_see): remove its setting at -O3. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d289aee..7ddd103 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-05-07 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/27136 + * gcc.dg/torture/pr27136.c: New testcase. + 2006-05-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/24813 diff --git a/gcc/testsuite/gcc.dg/torture/pr27136.c b/gcc/testsuite/gcc.dg/torture/pr27136.c new file mode 100644 index 0000000..32b7bf1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr27136.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-ffast-math" } */ + +void foo() +{ + double x; + + for (x = 2; x < 10; x *= x) + ; +} diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index bc359ad..a3c5791 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1301,7 +1301,7 @@ get_base_for (struct loop *loop, tree x) /* Given an expression X, then - * if BASE is NULL_TREE, X must be a constant and we return X. + * if X is NULL_TREE, we return the constant BASE. * otherwise X is a SSA name, whose value in the considered loop is derived by a chain of operations with constant from a result of a phi node in the header of the loop. Then we return value of X when the value of the @@ -1314,6 +1314,8 @@ get_val_for (tree x, tree base) use_operand_p op; ssa_op_iter iter; + gcc_assert (is_gimple_min_invariant (base)); + if (!x) return base; @@ -1414,7 +1416,11 @@ loop_niter_by_eval (struct loop *loop, edge exit) } for (j = 0; j < 2; j++) - val[j] = get_val_for (next[j], val[j]); + { + val[j] = get_val_for (next[j], val[j]); + if (!is_gimple_min_invariant (val[j])) + return chrec_dont_know; + } } return chrec_dont_know; |