Commit 7c82d827 by Tom de Vries Committed by Tom de Vries

Add transform_to_exit_first_loop_alt

2015-06-05  Tom de Vries  <tom@codesourcery.com>

	merge from gomp4 branch:
	2015-05-28  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/65443
	* tree-parloops.c (replace_imm_uses, replace_uses_in_bb_by)
	(replace_uses_in_bbs_by, transform_to_exit_first_loop_alt)
	(try_transform_to_exit_first_loop_alt): New function.
	(transform_to_exit_first_loop): Use
	try_transform_to_exit_first_loop_alt.

	* gcc.dg/parloops-exit-first-loop-alt-2.c: New test.
	* gcc.dg/parloops-exit-first-loop-alt-3.c: New test.
	* gcc.dg/parloops-exit-first-loop-alt.c: New test.

	* testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c: New test.
	* testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c: New test.
	* testsuite/libgomp.c/parloops-exit-first-loop-alt.c: New test.

From-SVN: r224154
parent ddb63209
2015-06-05 Tom de Vries <tom@codesourcery.com>
merge from gomp4 branch:
2015-05-28 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/65443
* tree-parloops.c (replace_imm_uses, replace_uses_in_bb_by)
(replace_uses_in_bbs_by, transform_to_exit_first_loop_alt)
(try_transform_to_exit_first_loop_alt): New function.
(transform_to_exit_first_loop): Use
try_transform_to_exit_first_loop_alt.
2015-06-05 James Greenhalgh <james.greenhalgh@arm.com>
* builtins.c (expand_builtin_atomic_compare_exchange): Call
......
2015-06-05 Tom de Vries <tom@codesourcery.com>
merge from gomp4 branch:
2015-05-28 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/65443
* gcc.dg/parloops-exit-first-loop-alt-2.c: New test.
* gcc.dg/parloops-exit-first-loop-alt-3.c: New test.
* gcc.dg/parloops-exit-first-loop-alt.c: New test.
2015-06-05 Nathan Sidwell <nathan@acm.org>
PR c++/52595
......
/* { dg-do compile } */
/* { dg-require-effective-target pthread } */
/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */
#define N 1000
unsigned int a[N];
unsigned int b[N];
unsigned int c[N];
void __attribute__((noclone,noinline))
f (unsigned int n)
{
int i;
for (i = 0; i < N; ++i)
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-do compile } */
/* { dg-require-effective-target pthread } */
/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */
unsigned int *a;
unsigned int __attribute__((noclone,noinline))
f (unsigned int n)
{
int i;
unsigned int sum = 1;
for (i = 0; i < n; ++i)
sum += a[i];
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-do compile } */
/* { dg-require-effective-target pthread } */
/* { dg-options "-O2 -ftree-parallelize-loops=2 -fdump-tree-parloops" } */
#define N 1000
unsigned int a[N];
unsigned int b[N];
unsigned int c[N];
void __attribute__((noclone,noinline))
f (unsigned int n)
{
int i;
for (i = 0; i < n; ++i)
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" } } */
2015-06-05 Tom de Vries <tom@codesourcery.com>
merge from gomp4 branch:
2015-05-28 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/65443
* testsuite/libgomp.c/parloops-exit-first-loop-alt-2.c: New test.
* testsuite/libgomp.c/parloops-exit-first-loop-alt-3.c: New test.
* testsuite/libgomp.c/parloops-exit-first-loop-alt.c: New test.
2015-05-29 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
* testsuite/libgomp.graphite/bounds.c: Adjust for
......
/* { dg-do run } */
/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
#include <stdio.h>
#include <stdlib.h>
#define N 1000
unsigned int a[N];
unsigned int b[N];
unsigned int c[N];
void __attribute__((noclone,noinline))
f (void)
{
int i;
for (i = 0; i < N; ++i)
c[i] = a[i] + b[i];
}
int
main (void)
{
int i, j;
/* Complexify loop to inhibit parloops. */
for (j = 0; j < 100; ++j)
for (i = 0; i < 10; i++)
{
int k = i + (10 * j);
a[k] = k;
b[k] = (k * 3) % 7;
c[k] = k * 2;
}
f ();
for (i = 0; i < N; i++)
{
unsigned int actual = c[i];
unsigned int expected = i + ((i * 3) % 7);
if (actual != expected)
abort ();
}
return 0;
}
/* { dg-do run } */
/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
unsigned int *a;
unsigned int __attribute__((noclone,noinline))
f (unsigned int n)
{
int i;
unsigned int sum = 1;
for (i = 0; i < n; ++i)
sum += a[i];
return sum;
}
int
main (void)
{
unsigned int res;
unsigned int array[4000];
int i;
for (i = 0; i < 4000; ++i)
array[i] = i % 7;
a = &array[0];
res = f (4000);
return !(res == 11995);
}
/* { dg-do run } */
/* { dg-options "-O2 -ftree-parallelize-loops=2" } */
#include <stdio.h>
#include <stdlib.h>
#define N 1000
unsigned int a[N];
unsigned int b[N];
unsigned int c[N];
void __attribute__((noclone,noinline))
f (unsigned int n)
{
int i;
for (i = 0; i < n; ++i)
c[i] = a[i] + b[i];
}
int
main (void)
{
int i, j;
/* Complexify loop to inhibit parloops. */
for (j = 0; j < 100; ++j)
for (i = 0; i < 10; i++)
{
int k = i + (10 * j);
a[k] = k;
b[k] = (k * 3) % 7;
c[k] = k * 2;
}
f (N);
for (i = 0; i < N; i++)
{
unsigned int actual = c[i];
unsigned int expected = i + ((i * 3) % 7);
if (actual != expected)
abort ();
}
return 0;
}
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