Commit 8c383600 by Jan Hubicka Committed by Jan Hubicka

loop-unroll.c (decide_unroll_constant_iterations, [...]): Use likely upper bounds.

	* loop-unroll.c (decide_unroll_constant_iterations,
	decide_unroll_runtime_iterations, decide_unroll_stupid): Use
	likely upper bounds.
	* loop-iv.c (find_simple_exit): Dump likely upper bounds.

	* gcc.dg/unroll-6.c: Update template.
	* gcc.dg/unroll-7.c: New testcase.
	* gcc.dg/unroll-8.c: New testcase.

From-SVN: r236986
parent 268143a4
2016-06-01 Jan Hubicka <hubicka@ucw.cz>
* loop-unroll.c (decide_unroll_constant_iterations,
decide_unroll_runtime_iterations, decide_unroll_stupid): Use
likely upper bounds.
* loop-iv.c (find_simple_exit): Dump likely upper bounds.
2016-06-01 Thomas Schwinge <thomas@codesourcery.com>
* tree-core.h (enum omp_clause_code): Remove
......
......@@ -2998,6 +2998,8 @@ find_simple_exit (struct loop *loop, struct niter_desc *desc)
fprintf (dump_file, " upper bound: %li\n",
(long)get_max_loop_iterations_int (loop));
fprintf (dump_file, " likely upper bound: %li\n",
(long)get_likely_max_loop_iterations_int (loop));
fprintf (dump_file, " realistic bound: %li\n",
(long)get_estimated_loop_iterations_int (loop));
}
......
......@@ -396,7 +396,7 @@ decide_unroll_constant_iterations (struct loop *loop, int flags)
of iterations. */
if (desc->niter < 2 * nunroll
|| ((get_estimated_loop_iterations (loop, &iterations)
|| get_max_loop_iterations (loop, &iterations))
|| get_likely_max_loop_iterations (loop, &iterations))
&& wi::ltu_p (iterations, 2 * nunroll)))
{
if (dump_file)
......@@ -706,7 +706,7 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags)
/* Check whether the loop rolls. */
if ((get_estimated_loop_iterations (loop, &iterations)
|| get_max_loop_iterations (loop, &iterations))
|| get_likely_max_loop_iterations (loop, &iterations))
&& wi::ltu_p (iterations, 2 * nunroll))
{
if (dump_file)
......@@ -1162,7 +1162,7 @@ decide_unroll_stupid (struct loop *loop, int flags)
/* Check whether the loop rolls. */
if ((get_estimated_loop_iterations (loop, &iterations)
|| get_max_loop_iterations (loop, &iterations))
|| get_likely_max_loop_iterations (loop, &iterations))
&& wi::ltu_p (iterations, 2 * nunroll))
{
if (dump_file)
......
2016-06-01 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/unroll-6.c: Update template.
* gcc.dg/unroll-7.c: New testcase.
* gcc.dg/unroll-8.c: New testcase.
2016-06-01 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt56.ad[sb]: New test.
......
......@@ -28,7 +28,7 @@ int t2()
abort ();
return 0;
}
/* { dg-final { scan-rtl-dump-times "upper bound: 999999" 1 "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-times " upper bound: 999999" 1 "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-not "realistic bound: 999999" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-times "upper bound: 2999999" 1 "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-times " upper bound: 2999999" 1 "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-times "realistic bound: 2999999" 1 "loop2_unroll" } } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-rtl-loop2_unroll -funroll-loops" } */
int t(int *a)
{
int i;
for (i=0;i<1000000;i++)
a[i]++;
}
/* { dg-final { scan-rtl-dump "Unrolled loop" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "number of iterations: .const_int 999999" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "upper bound: 999999" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "realistic bound: 999999" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "Considering unrolling loop with constant number of iterations" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-not "Invalid sum" "loop2_unroll" } } */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-rtl-loop2_unroll -funroll-loops" } */
struct a {int a[7];};
int t(struct a *a, int n)
{
int i;
for (i=0;i<n;i++)
a->a[i]++;
}
/* { dg-final { scan-rtl-dump-not "Unrolled loop" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "likely upper bound: 7" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "realistic bound: -1" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump "Not unrolling loop, doesn't roll" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-not "Invalid sum" "loop2_unroll" } } */
/* { dg-final { scan-rtl-dump-not "upper bound: -1" "loop2_unroll" } } */
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