Commit a5a57bf3 by Tom de Vries Committed by Tom de Vries

Add transform_to_exit_first_loop_alt dump success message

2015-07-24  Tom de Vries  <tom@codesourcery.com>

	* 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
parent 68180eba
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> 2015-07-24 Cesar Philippidis <cesar@codesourcery.com>
PR 66714 PR 66714
......
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> 2015-07-24 Ilya Enkovich <enkovich.gnu@gmail.com>
PR ipa/66566 PR ipa/66566
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* Constant bound, vector addition. */
...@@ -19,9 +19,4 @@ f (void) ...@@ -19,9 +19,4 @@ f (void)
c[i] = a[i] + b[i]; c[i] = a[i] + b[i];
} }
/* Three times three array accesses: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* Variable bound, reduction. */
...@@ -18,9 +18,4 @@ f (unsigned int n, unsigned int *__restrict__ a) ...@@ -18,9 +18,4 @@ f (unsigned int n, unsigned int *__restrict__ a)
return sum; return sum;
} }
/* Three array accesses: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* Constant bound, reduction. */
...@@ -20,9 +20,4 @@ f (void) ...@@ -20,9 +20,4 @@ f (void)
return sum; return sum;
} }
/* Three array accesses: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* 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, ...@@ -14,9 +14,4 @@ f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
c[i] = a[i] + b[i]; c[i] = a[i] + b[i];
} }
/* Three times a store: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* Variable bound, vector addition, unsigned loop counter, signed bound. */
...@@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, ...@@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
c[i] = a[i] + b[i]; c[i] = a[i] + b[i];
} }
/* Three times a store: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* Variable bound, vector addition, signed loop counter, signed bound. */
...@@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b, ...@@ -14,9 +14,4 @@ f (int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
c[i] = a[i] + b[i]; c[i] = a[i] + b[i];
} }
/* Three times a store: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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 <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -22,10 +22,5 @@ f (unsigned int n, unsigned int sum) ...@@ -22,10 +22,5 @@ f (unsigned int n, unsigned int sum)
return sum; return sum;
} }
/* Four times % 13: /* { dg-final { scan-tree-dump-times "parallelizing inner loop" 1 "parloops" } } */
- once in f._loopfn.0 /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 0 "parloops" } } */
- 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-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target pthread } */ /* { 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. */ /* 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, ...@@ -14,9 +14,5 @@ f (unsigned int n, unsigned int *__restrict__ a, unsigned int *__restrict__ b,
c[i] = a[i] + b[i]; c[i] = a[i] + b[i];
} }
/* Three times a store: /* { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } } */
- 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-additional-options "-O2" } ! { dg-additional-options "-O2" }
! { dg-require-effective-target pthread } ! { dg-require-effective-target pthread }
! { dg-additional-options "-ftree-parallelize-loops=2" } ! { dg-additional-options "-ftree-parallelize-loops=2" }
! { dg-additional-options "-fdump-tree-parloops" } ! { dg-additional-options "-fdump-tree-parloops-details" }
! Constant bound, vector addition. ! Constant bound, vector addition.
...@@ -16,9 +16,4 @@ subroutine foo () ...@@ -16,9 +16,4 @@ subroutine foo ()
end do end do
end subroutine foo end subroutine foo
! Three times plus 25: ! { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } }
! - 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-additional-options "-O2" } ! { dg-additional-options "-O2" }
! { dg-require-effective-target pthread } ! { dg-require-effective-target pthread }
! { dg-additional-options "-ftree-parallelize-loops=2" } ! { dg-additional-options "-ftree-parallelize-loops=2" }
! { dg-additional-options "-fdump-tree-parloops" } ! { dg-additional-options "-fdump-tree-parloops-details" }
! Variable bound, vector addition. ! Variable bound, vector addition.
...@@ -17,9 +17,5 @@ subroutine foo (nr) ...@@ -17,9 +17,5 @@ subroutine foo (nr)
end do end do
end subroutine foo end subroutine foo
! Three times plus 25: ! { dg-final { scan-tree-dump-times "alternative exit-first loop transform succeeded" 1 "parloops" } }
! - 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" } }
...@@ -2246,7 +2246,15 @@ gen_parallel_loop (struct loop *loop, ...@@ -2246,7 +2246,15 @@ gen_parallel_loop (struct loop *loop,
increment) and immediately follows the loop exit test. Attempt to move the 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 entry of the loop directly before the exit check and increase the number of
iterations of the loop by one. */ 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 /* 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 loop body: move the exit condition of LOOP to the beginning of its
......
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