re PR lto/59326 (FAIL: gcc.dg/vect/vect-simd-clone-*.c)
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. lto/ * lto.c (compare_tree_sccs_1): Handle OMP_CLAUSE. testsuite/ * 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. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r205514
This commit is contained in:
parent
c193f58b67
commit
e06f9964af
9 changed files with 139 additions and 10 deletions
|
@ -1,3 +1,17 @@
|
|||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 (); }
|
||||
};
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
7
gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
Normal file
7
gcc/testsuite/gcc.dg/vect/vect-simd-clone-12.c
Normal file
|
@ -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" } } */
|
17
gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c
Normal file
17
gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue