From: Jan Hubicka Date: Mon, 5 Nov 2012 18:12:37 +0000 (+0100) Subject: const-1.c: Update. X-Git-Tag: releases/gcc-4.8.0~2266 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1bc60b1814a5f0d09a54dbc2b996ceed2d93a89c;p=thirdparty%2Fgcc.git const-1.c: Update. * gcc.dg/const-1.c: Update. * gcc.dg/pure-1.c: Update. * tree-ssa-loop-niter.c (finite_loop_p): Revamp to be just wrapper of max_loop_iterations. From-SVN: r193175 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 61280127794a..026d62f07f17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-11-05 Jan Hubicka + + * tree-ssa-loop-niter.c (finite_loop_p): Revamp to be just wrapper of + max_loop_iterations. + 2012-11-05 Joern Rennecke * reorg.c (fill_simple_delay_slots): Avoid calling optimize_skip diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c3103661f695..4d6a7dcc42c7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-11-05 Jan Hubicka + + * gcc.dg/const-1.c: Update. + * gcc.dg/pure-1.c: Update. + 2012-11-05 Vladimir Makarov PR rtl-optimization/55151 diff --git a/gcc/testsuite/gcc.dg/const-1.c b/gcc/testsuite/gcc.dg/const-1.c index 2657c9b5738b..2a532f8969e2 100644 --- a/gcc/testsuite/gcc.dg/const-1.c +++ b/gcc/testsuite/gcc.dg/const-1.c @@ -35,10 +35,10 @@ foo2b(int n) /* Unbounded loops are not safe. */ static int __attribute__ ((noinline)) -foo3(int n) /* { dg-warning "const\[^\n\]* normally" "detect const candidate" } */ +foo3(unsigned int n) /* { dg-warning "const\[^\n\]* normally" "detect const candidate" } */ { int ret = 0; - int i; + unsigned int i; for (i=0; extern_const (i+n); n++) ret+=extern_const (i); return ret; diff --git a/gcc/testsuite/gcc.dg/pure-2.c b/gcc/testsuite/gcc.dg/pure-2.c index 97ba31f0261f..8c2ba56cd51a 100644 --- a/gcc/testsuite/gcc.dg/pure-2.c +++ b/gcc/testsuite/gcc.dg/pure-2.c @@ -35,10 +35,10 @@ foo2b(int n) /* Unbounded loops are not safe. */ static int __attribute__ ((noinline)) -foo3(int n) /* { dg-warning "pure\[^\n\]* normally" "detect pure candidate" } */ +foo3(unsigned int n) /* { dg-warning "pure\[^\n\]* normally" "detect pure candidate" } */ { int ret = 0; - int i; + unsigned int i; for (i=0; extern_const (i+n); n++) ret+=extern_const (i); return ret; diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 87b550cf5b4e..3936e60ac635 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1994,11 +1994,7 @@ find_loop_niter (struct loop *loop, edge *exit) bool finite_loop_p (struct loop *loop) { - unsigned i; - VEC (edge, heap) *exits; - edge ex; - struct tree_niter_desc desc; - bool finite = false; + double_int nit; int flags; if (flag_unsafe_loop_optimizations) @@ -2012,26 +2008,15 @@ finite_loop_p (struct loop *loop) return true; } - exits = get_loop_exit_edges (loop); - FOR_EACH_VEC_ELT (edge, exits, i, ex) + if (loop->any_upper_bound + || max_loop_iterations (loop, &nit)) { - if (!just_once_each_iteration_p (loop, ex->src)) - continue; - - if (number_of_iterations_exit (loop, ex, &desc, false)) - { - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "Found loop %i to be finite: iterating ", loop->num); - print_generic_expr (dump_file, desc.niter, TDF_SLIM); - fprintf (dump_file, " times\n"); - } - finite = true; - break; - } + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Found loop %i to be finite: upper bound found.\n", + loop->num); + return true; } - VEC_free (edge, heap, exits); - return finite; + return false; } /*