diff options
-rw-r--r-- | gcc/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/lto-streamer-out.c | 33 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/lto.c | 40 | ||||
-rw-r--r-- | gcc/omp-low.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c | 17 |
9 files changed, 139 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 791eaef..035ab85 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,18 @@ 2013-11-29 Jakub Jelinek <jakub@redhat.com> + Richard Biener <rguenther@suse.de> + + PR lto/59326 + * omp-low.c (simd_clone_create): Return NULL if for definition + !cgraph_function_with_gimple_body_p (old_node). Call cgraph_get_body + before calling cgraph_function_versioning. + (expand_simd_clones): Look for "omp declare simd" attribute first. + Don't check targetm.simd_clone.compute_vecsize_and_simdlen here. + Punt if node->global.inlined_to. + (pass_omp_simd_clone::gate): Also enable if in_lto_p && !flag_wpa. + Disable pass if targetm.simd_clone.compute_vecsize_and_simdlen is NULL. + * lto-streamer-out.c (hash_tree): Handle OMP_CLAUSE. + +2013-11-29 Jakub Jelinek <jakub@redhat.com> PR lto/59326 * tree-core.h (enum omp_clause_schedule_kind): Add diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 2821001..3135f00 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1060,6 +1060,39 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t) } } + if (code == OMP_CLAUSE) + { + int i; + + v = iterative_hash_host_wide_int (OMP_CLAUSE_CODE (t), v); + switch (OMP_CLAUSE_CODE (t)) + { + case OMP_CLAUSE_DEFAULT: + v = iterative_hash_host_wide_int (OMP_CLAUSE_DEFAULT_KIND (t), v); + break; + case OMP_CLAUSE_SCHEDULE: + v = iterative_hash_host_wide_int (OMP_CLAUSE_SCHEDULE_KIND (t), v); + break; + case OMP_CLAUSE_DEPEND: + v = iterative_hash_host_wide_int (OMP_CLAUSE_DEPEND_KIND (t), v); + break; + case OMP_CLAUSE_MAP: + v = iterative_hash_host_wide_int (OMP_CLAUSE_MAP_KIND (t), v); + break; + case OMP_CLAUSE_PROC_BIND: + v = iterative_hash_host_wide_int (OMP_CLAUSE_PROC_BIND_KIND (t), v); + break; + case OMP_CLAUSE_REDUCTION: + v = iterative_hash_host_wide_int (OMP_CLAUSE_REDUCTION_CODE (t), v); + break; + default: + break; + } + for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++) + visit (OMP_CLAUSE_OPERAND (t, i)); + visit (OMP_CLAUSE_CHAIN (t)); + } + return v; #undef visit diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 3ce3a32..6d6ebf6 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,4 +1,10 @@ 2013-11-29 Jakub Jelinek <jakub@redhat.com> + Richard Biener <rguenther@suse.de> + + PR lto/59326 + * lto.c (compare_tree_sccs_1): Handle OMP_CLAUSE. + +2013-11-29 Jakub Jelinek <jakub@redhat.com> PR lto/59326 * lto.c (mentions_vars_p_omp_clause): New function. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 26084bf..1f46238 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1410,6 +1410,36 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map) TREE_STRING_LENGTH (t1)) != 0) return false; + if (code == OMP_CLAUSE) + { + compare_values (OMP_CLAUSE_CODE); + switch (OMP_CLAUSE_CODE (t1)) + { + case OMP_CLAUSE_DEFAULT: + compare_values (OMP_CLAUSE_DEFAULT_KIND); + break; + case OMP_CLAUSE_SCHEDULE: + compare_values (OMP_CLAUSE_SCHEDULE_KIND); + break; + case OMP_CLAUSE_DEPEND: + compare_values (OMP_CLAUSE_DEPEND_KIND); + break; + case OMP_CLAUSE_MAP: + compare_values (OMP_CLAUSE_MAP_KIND); + break; + case OMP_CLAUSE_PROC_BIND: + compare_values (OMP_CLAUSE_PROC_BIND_KIND); + break; + case OMP_CLAUSE_REDUCTION: + compare_values (OMP_CLAUSE_REDUCTION_CODE); + compare_values (OMP_CLAUSE_REDUCTION_GIMPLE_INIT); + compare_values (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE); + break; + default: + break; + } + } + #undef compare_values @@ -1633,6 +1663,16 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map) } } + if (code == OMP_CLAUSE) + { + int i; + + for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t1)]; i++) + compare_tree_edges (OMP_CLAUSE_OPERAND (t1, i), + OMP_CLAUSE_OPERAND (t2, i)); + compare_tree_edges (OMP_CLAUSE_CHAIN (t1), OMP_CLAUSE_CHAIN (t2)); + } + #undef compare_tree_edges return true; diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 71dc811..c929157 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -10912,8 +10912,13 @@ simd_clone_create (struct cgraph_node *old_node) { struct cgraph_node *new_node; if (old_node->definition) - new_node = cgraph_function_versioning (old_node, vNULL, NULL, NULL, false, - NULL, NULL, "simdclone"); + { + if (!cgraph_function_with_gimple_body_p (old_node)) + return NULL; + cgraph_get_body (old_node); + new_node = cgraph_function_versioning (old_node, vNULL, NULL, NULL, + false, NULL, NULL, "simdclone"); + } else { tree old_decl = old_node->decl; @@ -11622,13 +11627,13 @@ simd_clone_adjust (struct cgraph_node *node) static void expand_simd_clones (struct cgraph_node *node) { - if (lookup_attribute ("noclone", DECL_ATTRIBUTES (node->decl))) - return; - tree attr = lookup_attribute ("omp declare simd", DECL_ATTRIBUTES (node->decl)); - if (!attr || targetm.simd_clone.compute_vecsize_and_simdlen == NULL) + if (attr == NULL_TREE + || node->global.inlined_to + || lookup_attribute ("noclone", DECL_ATTRIBUTES (node->decl))) return; + /* Ignore #pragma omp declare simd extern int foo (); @@ -11764,8 +11769,10 @@ public: {} /* opt_pass methods: */ - bool gate () { return flag_openmp || flag_openmp_simd - || flag_enable_cilkplus; } + bool gate () { return ((flag_openmp || flag_openmp_simd + || flag_enable_cilkplus || (in_lto_p && !flag_wpa)) + && (targetm.simd_clone.compute_vecsize_and_simdlen + != NULL)); } unsigned int execute () { return ipa_omp_simd_clone (); } }; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8291675..4580ec5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2013-11-29 Jakub Jelinek <jakub@redhat.com> + PR lto/59326 + * gcc.dg/vect/vect-simd-clone-12.c: New test. + * gcc.dg/vect/vect-simd-clone-12a.c: New test. + * gcc.dg/vect/vect-simd-clone-10a.c: Remove extern keywords. + PR c/59280 * c-c++-common/pr59280.c: New test. diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c index cd42e7c..1314039 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c @@ -3,14 +3,14 @@ #include "vect-simd-clone-10.h" #pragma omp declare simd notinbranch -extern int +int foo (long int a, int b, int c) { return a + b + c; } #pragma omp declare simd notinbranch -extern long int +long int bar (int a, int b, long int c) { return a + b + c; diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c new file mode 100644 index 0000000..5c94153 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c @@ -0,0 +1,7 @@ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ +/* { dg-additional-sources vect-simd-clone-12a.c } */ + +#include "vect-simd-clone-10.c" + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c new file mode 100644 index 0000000..fcd0461 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ + +#include "vect-simd-clone-10.h" + +#pragma omp declare simd notinbranch +__attribute__((noinline)) int +foo (long int a, int b, int c) +{ + return a + b + c; +} + +#pragma omp declare simd notinbranch +__attribute__((noinline)) long int +bar (int a, int b, long int c) +{ + return a + b + c; +} |