diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 | 9 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 | 10 | ||||
-rw-r--r-- | gcc/tree-parloops.c | 10 |
13 files changed, 51 insertions, 72 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8737508..59910bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-07-24 Tom de Vries <tom@codesourcery.com> + + * tree-parloops.c (gen_parallel_loop): Add debug print for alternative + exit-first loop transform. + 2015-07-24 Cesar Philippidis <cesar@codesourcery.com> PR 66714 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 244bf58..9db2643 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2015-07-24 Tom de Vries <tom@codesourcery.com> + + * gcc.dg/parloops-exit-first-loop-alt-2.c: Use debug print for + alternative exit-first loop transform. + * gcc.dg/parloops-exit-first-loop-alt-3.c: Same. + * gcc.dg/parloops-exit-first-loop-alt-4.c: Same. + * gcc.dg/parloops-exit-first-loop-alt-5.c: Same. + * gcc.dg/parloops-exit-first-loop-alt-6.c: Same. + * gcc.dg/parloops-exit-first-loop-alt-7.c: Same. + * gcc.dg/parloops-exit-first-loop-alt-pr66652.c: Same. + * gcc.dg/parloops-exit-first-loop-alt.c: Same. + * gfortran.dg/parloops-exit-first-loop-alt-2.f95: Same. + * gfortran.dg/parloops-exit-first-loop-alt.f95: Same. + 2015-07-24 Ilya Enkovich <enkovich.gnu@gmail.com> PR ipa/66566 diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c index 24e605a..f1cf75f 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Constant bound, vector addition. */ @@ -19,9 +19,4 @@ f (void) c[i] = a[i] + b[i]; } -/* Three times three array accesses: - - three in f._loopfn.0 - - three in the parallel - - three in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)\\\[i" 9 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c index fec53a1..c7154ba 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, reduction. */ @@ -18,9 +18,4 @@ f (unsigned int n, unsigned int *__restrict__ a) return sum; } -/* Three array accesses: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)\\\* 4" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c index 2b8d289..5f7fe68 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-4.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Constant bound, reduction. */ @@ -20,9 +20,4 @@ f (void) return sum; } -/* Three array accesses: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)\\\* 4" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c index 3f799cf..3c1e99b 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-5.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, unsigned loop counter, unsigned bound. */ @@ -14,9 +14,4 @@ f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c index ee19a55..edc60ba 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-6.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, unsigned loop counter, signed bound. */ @@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c index c337342..38be2e8 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-7.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, signed loop counter, signed bound. */ @@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c index 2ea097d..6f3ece5 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt-pr66652.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ #include <stdio.h> #include <stdlib.h> @@ -22,10 +22,5 @@ f (unsigned int n, unsigned int sum) return sum; } -/* Four times % 13: - - once in f._loopfn.0 - - once in the parallel - - once in the low iteration count loop - - once for a peeled off last iteration following the parallel. - In other words, we want try_transform_to_exit_first_loop_alt to fail. */ -/* { dg-final { scan-tree-dump-times "(?n)% 13" 4 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "parallelizing inner loop" 1 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 0 "parloops" } } */ diff --git a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c index 0b69165..44596e3 100644 --- a/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c +++ b/gcc/testsuite/gcc.dg/parloops-exit-first-loop-alt.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target pthread } */ -/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */ +/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops-details" } */ /* Variable bound, vector addition, signed loop counter, unsigned bound. */ @@ -14,9 +14,5 @@ f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, c[i] = a[i] + b[i]; } -/* Three times a store: - - one in f._loopfn.0 - - one in the parallel - - one in the low iteration count loop - Crucially, none for a peeled off last iteration following the parallel. */ -/* { dg-final { scan-tree-dump-times "(?n)^ \\*_\[0-9\]*" 3 "parloops" } } */ +/* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */ + diff --git a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 index f26a6e3..52434f2 100644 --- a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 +++ b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt-2.f95 @@ -1,7 +1,7 @@ ! { dg-additional-options "-O2" } ! { dg-require-effective-target pthread } ! { dg-additional-options "-ftree-parallelize-loops=2" } -! { dg-additional-options "-fdump-tree-parloops" } +! { dg-additional-options "-fdump-tree-parloops-details" } ! Constant bound, vector addition. @@ -16,9 +16,4 @@ subroutine foo () end do end subroutine foo -! Three times plus 25: -! - once in f._loopfn.0 -! - once in the parallel -! - once in the low iteration count loop -! Crucially, none for a peeled off last iteration following the parallel. -! { dg-final { scan-tree-dump-times "(?n) \\+ 25;" 3 "parloops" } } +! { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } diff --git a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 index 6dc8a38..1eb9dfd 100644 --- a/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 +++ b/gcc/testsuite/gfortran.dg/parloops-exit-first-loop-alt.f95 @@ -1,7 +1,7 @@ ! { dg-additional-options "-O2" } ! { dg-require-effective-target pthread } ! { dg-additional-options "-ftree-parallelize-loops=2" } -! { dg-additional-options "-fdump-tree-parloops" } +! { dg-additional-options "-fdump-tree-parloops-details" } ! Variable bound, vector addition. @@ -17,9 +17,5 @@ subroutine foo (nr) end do end subroutine foo -! Three times plus 25: -! - once in f._loopfn.0 -! - once in the parallel -! - once in the low iteration count loop -! Crucially, none for a peeled off last iteration following the parallel. -! { dg-final { scan-tree-dump-times "(?n) \\+ 25;" 3 "parloops" } } +! { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } + diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 88f22e8..6e75cb1 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2246,7 +2246,15 @@ gen_parallel_loop (struct loop *loop, increment) and immediately follows the loop exit test. Attempt to move the entry of the loop directly before the exit check and increase the number of iterations of the loop by one. */ - if (!try_transform_to_exit_first_loop_alt (loop, reduction_list, nit)) + if (try_transform_to_exit_first_loop_alt (loop, reduction_list, nit)) + { + if (dump_file + && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "alternative exit-first loop transform succeeded" + " for loop %d\n", loop->num); + } + else { /* Fall back on the method that handles more cases, but duplicates the loop body: move the exit condition of LOOP to the beginning of its |