From a5a57bf378674be59968b4929f9647a72a3181c8 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 24 Jul 2015 15:00:59 +0000 Subject: [PATCH] Add transform_to_exit_first_loop_alt dump success message 2015-07-24 Tom de Vries * tree-parloops.c (gen_parallel_loop): Add debug print for alternative exit-first loop transform. * 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. From-SVN: r226164 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 14 ++++++++++++++ .../gcc.dg/parloops-exit-first-loop-alt-2.c | 9 ++------- .../gcc.dg/parloops-exit-first-loop-alt-3.c | 9 ++------- .../gcc.dg/parloops-exit-first-loop-alt-4.c | 9 ++------- .../gcc.dg/parloops-exit-first-loop-alt-5.c | 9 ++------- .../gcc.dg/parloops-exit-first-loop-alt-6.c | 9 ++------- .../gcc.dg/parloops-exit-first-loop-alt-7.c | 9 ++------- .../gcc.dg/parloops-exit-first-loop-alt-pr66652.c | 11 +++-------- .../gcc.dg/parloops-exit-first-loop-alt.c | 10 +++------- .../gfortran.dg/parloops-exit-first-loop-alt-2.f95 | 9 ++------- .../gfortran.dg/parloops-exit-first-loop-alt.f95 | 10 +++------- gcc/tree-parloops.c | 10 +++++++++- 13 files changed, 51 insertions(+), 72 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87375082ca0..59910bf992f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-07-24 Tom de Vries + + * tree-parloops.c (gen_parallel_loop): Add debug print for alternative + exit-first loop transform. + 2015-07-24 Cesar Philippidis PR 66714 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 244bf587ae7..9db26430e07 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2015-07-24 Tom de Vries + + * 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 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 24e605a5877..f1cf75f1f5f 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 fec53a19628..c7154ba09ad 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 2b8d2898824..5f7fe684133 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 3f799cf234d..3c1e99b58ac 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 ee19a55849a..edc60ba5253 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 c3373425281..38be2e8fee5 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 2ea097d06f9..6f3ece59d2e 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 #include @@ -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 0b6916507f4..44596e3858a 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 f26a6e375ad..52434f2a9e3 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 6dc8a38c1ef..1eb9dfd801e 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 88f22e85d44..6e75cb13648 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 -- 2.30.2