+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
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));
}
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)
/* 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)
/* 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.
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" } } */
--- /dev/null
+/* { 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" } } */
--- /dev/null
+/* { 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" } } */