Commit 1bc60b18 by Jan Hubicka Committed by Jan Hubicka

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
parent 6d0ae035
2012-11-05 Jan Hubicka <jh@suse.cz>
* tree-ssa-loop-niter.c (finite_loop_p): Revamp to be just wrapper of
max_loop_iterations.
2012-11-05 Joern Rennecke <joern.rennecke@embecosm.com> 2012-11-05 Joern Rennecke <joern.rennecke@embecosm.com>
* reorg.c (fill_simple_delay_slots): Avoid calling optimize_skip * reorg.c (fill_simple_delay_slots): Avoid calling optimize_skip
2012-11-05 Jan Hubicka <jh@suse.cz>
* gcc.dg/const-1.c: Update.
* gcc.dg/pure-1.c: Update.
2012-11-05 Vladimir Makarov <vmakarov@redhat.com> 2012-11-05 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/55151 PR rtl-optimization/55151
......
...@@ -35,10 +35,10 @@ foo2b(int n) ...@@ -35,10 +35,10 @@ foo2b(int n)
/* Unbounded loops are not safe. */ /* Unbounded loops are not safe. */
static int __attribute__ ((noinline)) 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 ret = 0;
int i; unsigned int i;
for (i=0; extern_const (i+n); n++) for (i=0; extern_const (i+n); n++)
ret+=extern_const (i); ret+=extern_const (i);
return ret; return ret;
......
...@@ -35,10 +35,10 @@ foo2b(int n) ...@@ -35,10 +35,10 @@ foo2b(int n)
/* Unbounded loops are not safe. */ /* Unbounded loops are not safe. */
static int __attribute__ ((noinline)) 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 ret = 0;
int i; unsigned int i;
for (i=0; extern_const (i+n); n++) for (i=0; extern_const (i+n); n++)
ret+=extern_const (i); ret+=extern_const (i);
return ret; return ret;
......
...@@ -1994,11 +1994,7 @@ find_loop_niter (struct loop *loop, edge *exit) ...@@ -1994,11 +1994,7 @@ find_loop_niter (struct loop *loop, edge *exit)
bool bool
finite_loop_p (struct loop *loop) finite_loop_p (struct loop *loop)
{ {
unsigned i; double_int nit;
VEC (edge, heap) *exits;
edge ex;
struct tree_niter_desc desc;
bool finite = false;
int flags; int flags;
if (flag_unsafe_loop_optimizations) if (flag_unsafe_loop_optimizations)
...@@ -2012,26 +2008,15 @@ finite_loop_p (struct loop *loop) ...@@ -2012,26 +2008,15 @@ finite_loop_p (struct loop *loop)
return true; return true;
} }
exits = get_loop_exit_edges (loop); if (loop->any_upper_bound
FOR_EACH_VEC_ELT (edge, exits, i, ex) || max_loop_iterations (loop, &nit))
{ {
if (!just_once_each_iteration_p (loop, ex->src)) if (dump_file && (dump_flags & TDF_DETAILS))
continue; fprintf (dump_file, "Found loop %i to be finite: upper bound found.\n",
loop->num);
if (number_of_iterations_exit (loop, ex, &desc, false)) return true;
{
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;
}
} }
VEC_free (edge, heap, exits); return false;
return finite;
} }
/* /*
......
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