diff options
author | Tom de Vries <tom@codesourcery.com> | 2015-11-30 16:34:26 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2015-11-30 16:34:26 +0000 |
commit | e0ca27c53103d532b51a61679b5d4c13d35a09d0 (patch) | |
tree | fe36cf7c64756119ed297892e4582c3f0d2973bc /gcc/testsuite/gcc.dg/pr46032.c | |
parent | 7b90c63a28e85014656ecab28459dcd23c7d2457 (diff) | |
download | gcc-e0ca27c53103d532b51a61679b5d4c13d35a09d0.zip gcc-e0ca27c53103d532b51a61679b5d4c13d35a09d0.tar.gz gcc-e0ca27c53103d532b51a61679b5d4c13d35a09d0.tar.bz2 |
Handle BUILT_IN_GOMP_PARALLEL in ipa-pta
2015-11-30 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/46032
* tree-ssa-structalias.c (find_func_aliases_for_call_arg): New function,
factored out of ...
(find_func_aliases_for_call): ... here.
(find_func_aliases_for_builtin_call, find_func_clobbers): Handle
BUILT_IN_GOMP_PARALLEL.
(ipa_pta_execute): Same. Handle node->parallelized_function as a local
function.
* gcc.dg/pr46032.c: New test.
* testsuite/libgomp.c/pr46032.c: New test.
From-SVN: r231076
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr46032.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr46032.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr46032.c b/gcc/testsuite/gcc.dg/pr46032.c new file mode 100644 index 0000000..b91190e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr46032.c @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp -ftree-vectorize -std=c99 -fipa-pta -fdump-tree-vect-all" } */ + +extern void abort (void); + +#define nEvents 1000 + +static void __attribute__((noinline, noclone, optimize("-fno-tree-vectorize"))) +init (unsigned *results, unsigned *pData) +{ + unsigned int i; + for (i = 0; i < nEvents; ++i) + pData[i] = i % 3; +} + +static void __attribute__((noinline, noclone, optimize("-fno-tree-vectorize"))) +check (unsigned *results) +{ + unsigned sum = 0; + for (int idx = 0; idx < (int)nEvents; idx++) + sum += results[idx]; + + if (sum != 1998) + abort (); +} + +int +main (void) +{ + unsigned results[nEvents]; + unsigned pData[nEvents]; + unsigned coeff = 2; + + init (&results[0], &pData[0]); + +#pragma omp parallel for + for (int idx = 0; idx < (int)nEvents; idx++) + results[idx] = coeff * pData[idx]; + + check (&results[0]); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "note: vectorized 1 loop" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-not "versioning for alias required" "vect" } } */ + |