diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-04 12:12:50 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-04 12:12:50 +0000 |
commit | 0a5fa2b7bb7cef9dd55790bf386a5e7c09284947 (patch) | |
tree | ebedb017ebbb3aaafa250c0876b89feb978c51d9 /gcc | |
parent | 4f0fcaada710e71cc98685eee4a4b7edc183a25b (diff) | |
download | gcc-0a5fa2b7bb7cef9dd55790bf386a5e7c09284947.tar.gz |
Fix PR43209: Do not decrease the cost of an IV candidate when the cost is infinite.
2010-03-03 Changpeng Fang <changpeng.fang@amd.com>
PR middle-end/43209
* tree-ssa-loop-ivopts.c (determine_use_iv_cost_condition): Do not decrease
the cost of an IV candidate when the cost is infinite.
* gcc.dg/tree-ssa/ivopts-4.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157217 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/ivopts-4.c | 8 | ||||
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 5 |
4 files changed, 22 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d68800760d3..93b2d76f77d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-04 Changpeng Fang <changpeng.fang@amd.com> + + PR middle-end/43209 + * tree-ssa-loop-ivopts.c (determine_use_iv_cost_condition): Do not decrease + the cost of an IV candidate when the cost is infinite. + 2010-03-04 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * doc/extend.texi (Vector Extensions, X86 Built-in Functions): diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c06fe365ae5..5565dd3240d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-04 Changpeng Fang <changpeng.fang@amd.com> + + PR middle-end/43209 + * gcc.dg/tree-ssa/ivopts-4.c: New. + 2010-03-03 Janis Johnson <janis187@us.ibm.com> * lib/target-supports-dg.exp (check-flags): Provide defaults for diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ivopts-4.c b/gcc/testsuite/gcc.dg/tree-ssa/ivopts-4.c new file mode 100644 index 00000000000..90801523986 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ivopts-4.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-options "-O1" } */ +void foo(int *p, long i, int j) +{ + do { + p[i]++; + } while (i += j); +} diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 74dadf77897..e6565dbdf99 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1,5 +1,5 @@ /* Induction variable optimizations. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -4121,7 +4121,8 @@ determine_use_iv_cost_condition (struct ivopts_data *data, TODO: The constant that we're substracting from the cost should be target-dependent. This information should be added to the target costs for each backend. */ - if (integer_zerop (*bound_cst) + if (!infinite_cost_p (elim_cost) /* Do not try to decrease infinite! */ + && integer_zerop (*bound_cst) && (operand_equal_p (*control_var, cand->var_after, 0) || operand_equal_p (*control_var, cand->var_before, 0))) elim_cost.cost -= 1; |