Commit 572ae476 by Changpeng Fang Committed by Sebastian Pop

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
parent f8723eb6
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):
......
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
......
/* { dg-do compile } */
/* { dg-options "-O1" } */
void foo(int *p, long i, int j)
{
do {
p[i]++;
} while (i += j);
}
/* 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment