summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorChangpeng Fang <changpeng.fang@amd.com>2010-03-04 12:12:50 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-03-04 12:12:50 +0000
commit572ae4769aebdf9e2ca738674f698f2a4b3347cd (patch)
treeebedb017ebbb3aaafa250c0876b89feb978c51d9 /gcc/tree-ssa-loop-ivopts.c
parentf8723eb6ec75ec0b362c02f61578750e4fd49cc4 (diff)
downloadgcc-572ae4769aebdf9e2ca738674f698f2a4b3347cd.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. From-SVN: r157217
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c5
1 files changed, 3 insertions, 2 deletions
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;