diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6cdb86c946..049729b6e60 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-02-27 Richard Guenther + + PR tree-optimization/43186 + * params.def (PARAM_MAX_UNROLL_ITERATIONS): New param. + * doc/invoke.texi (max-completely-peel-loop-nest-depth): Document. + * tree-ssa-loop-ivcanon.c (tree_unroll_loops_completely): Limit + unroller iterations. + 2010-02-27 H.J. Lu * config.gcc: Set the default 32bit/64bit archs if 64bit ISA is diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6a6bd92024e..36580fbd1b0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -8094,6 +8094,9 @@ The maximum number of insns of a completely peeled loop. @item max-completely-peel-times The maximum number of iterations of a loop to be suitable for complete peeling. +@item max-completely-peel-loop-nest-depth +The maximum depth of a loop nest suitable for complete peeling. + @item max-unswitch-insns The maximum number of insns of an unswitched loop. diff --git a/gcc/params.def b/gcc/params.def index 21dcb44a90e..07bfb901f0b 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -266,6 +266,11 @@ DEFPARAM(PARAM_MAX_ONCE_PEELED_INSNS, "max-once-peeled-insns", "The maximum number of insns of a peeled loop that rolls only once", 400, 0, 0) +/* The maximum depth of a loop nest we completely peel. */ +DEFPARAM(PARAM_MAX_UNROLL_ITERATIONS, + "max-completely-peel-loop-nest-depth", + "The maximum depth of a loop nest we completely peel", + 8, 0, 0) /* The maximum number of insns of an unswitched loop. */ DEFPARAM(PARAM_MAX_UNSWITCH_INSNS, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 888479505a5..bf0b7ce8b25 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-02-27 Richard Guenther + + PR tree-optimization/43186 + * gcc.c-torture/compile/pr43186.c: Adjust testcase. + 2010-02-27 Kaz Kojima * g++.dg/abi/packed1.C: Expect warning on the SH. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43186.c b/gcc/testsuite/gcc.c-torture/compile/pr43186.c index d235e9730de..7171e6ac03a 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr43186.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr43186.c @@ -5,7 +5,7 @@ void foo (int i) int a, b; if (!i) - for (a = 1; a < 3; a++) + for (a = 1; a < 4; a++) if (a) for (b = 1; b < 3; b++) foo (b); diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index df48dfd2bc8..e9841f5006f 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -522,6 +522,7 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer) struct loop *loop; bool changed; enum unroll_level ul; + int iteration = 0; do { @@ -554,7 +555,8 @@ tree_unroll_loops_completely (bool may_increase_size, bool unroll_outer) scev_reset (); } } - while (changed); + while (changed + && ++iteration <= PARAM_VALUE (PARAM_MAX_UNROLL_ITERATIONS)); return 0; }