diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-10-04 09:50:38 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-10-04 09:50:38 +0200 |
commit | 5c38262d95bedc091083cc881d9e21cd1f215a9a (patch) | |
tree | e7a8605743c6aa3f81e39c7c50e404afff3dab36 | |
parent | 21375f0ded2dbc4240bd9e3bfcb8f48451ce02b4 (diff) | |
download | gcc-5c38262d95bedc091083cc881d9e21cd1f215a9a.zip gcc-5c38262d95bedc091083cc881d9e21cd1f215a9a.tar.gz gcc-5c38262d95bedc091083cc881d9e21cd1f215a9a.tar.bz2 |
re PR tree-optimization/82374 (#pragma GCC optimize is not applied to openmp-generated functions)
PR tree-optimization/82374
* omp-low.c (create_omp_child_function): Copy DECL_ATTRIBUTES,
DECL_FUNCTION_SPECIFIC_OPTIMIZATION,
DECL_FUNCTION_SPECIFIC_TARGET and DECL_FUNCTION_VERSIONED from
current_function_decl to the new decl.
* gcc.dg/gomp/pr82374.c: New test.
From-SVN: r253395
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/omp-low.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/pr82374.c | 31 |
4 files changed, 52 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7a448b..3512f9e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-10-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/82374 + * omp-low.c (create_omp_child_function): Copy DECL_ATTRIBUTES, + DECL_FUNCTION_SPECIFIC_OPTIMIZATION, + DECL_FUNCTION_SPECIFIC_TARGET and DECL_FUNCTION_VERSIONED from + current_function_decl to the new decl. + 2017-10-03 Michael Meissner <meissner@linux.vnet.ibm.com> * config/rs6000/rs6000-builtin.def (BU_FLOAT128_2_HW): Define new diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 8ed8f7c..3645661 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -1626,6 +1626,14 @@ create_omp_child_function (omp_context *ctx, bool task_copy) DECL_CONTEXT (decl) = NULL_TREE; DECL_INITIAL (decl) = make_node (BLOCK); BLOCK_SUPERCONTEXT (DECL_INITIAL (decl)) = decl; + DECL_ATTRIBUTES (decl) = DECL_ATTRIBUTES (current_function_decl); + DECL_FUNCTION_SPECIFIC_OPTIMIZATION (decl) + = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (current_function_decl); + DECL_FUNCTION_SPECIFIC_TARGET (decl) + = DECL_FUNCTION_SPECIFIC_TARGET (current_function_decl); + DECL_FUNCTION_VERSIONED (decl) + = DECL_FUNCTION_VERSIONED (current_function_decl); + if (omp_maybe_offloaded_ctx (ctx)) { cgraph_node::get_create (decl)->offloadable = 1; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9205fbe..8166465 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-04 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/82374 + * gcc.dg/gomp/pr82374.c: New test. + 2017-10-04 Richard Biener <rguenther@suse.de> * gfortran.dg/graphite/id-17.f: For ilp32 allow graphite codegen diff --git a/gcc/testsuite/gcc.dg/gomp/pr82374.c b/gcc/testsuite/gcc.dg/gomp/pr82374.c new file mode 100644 index 0000000..0ac70ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr82374.c @@ -0,0 +1,31 @@ +/* PR tree-optimization/82374 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-vectorize -fdump-tree-vect-details" } */ +/* { dg-additional-options "-mavx -mno-avx2" { target i?86-*-* x86_64-*-* } } */ +/* { dg-additional-options "-mvsx" { target powerpc_vsx_ok } } */ + +#define SIZE (1024 * 1024 * 1024) + +float a[SIZE]; +float b[SIZE]; +float c[SIZE]; +float d[SIZE]; + +__attribute__((optimize ("O2", "tree-vectorize"))) void +foo (void) +{ + int i; +#pragma omp parallel for + for (i = 0; i < SIZE; i++) + c[i] = a[i] + b[i]; +} + +__attribute__((optimize ("O2", "tree-vectorize"))) void +bar (void) +{ + int i; + for (i = 0; i < SIZE; i++) + d[i] = a[i] + b[i]; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { { i?86-*-* x86_64-*-* } || { powerpc_vsx_ok } } } } } */ |