Hello. This is a small follow-up patch, where local.local flag should be also dropped for a default implementation.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Martin
>From 0d7b793b23e6dad738abaee32a9e0fbf0f4c70c5 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Mon, 13 Mar 2017 09:55:40 +0100 Subject: [PATCH] Fix multiple target clones nodes (PR lto/66295). gcc/ChangeLog: 2017-03-13 Martin Liska <mli...@suse.cz> PR lto/66295 * multiple_target.c (expand_target_clones): Drop local.local flag for default implementation. gcc/testsuite/ChangeLog: 2017-03-13 Martin Liska <mli...@suse.cz> PR lto/66295 * gcc.dg/tree-prof/pr66295.c: New test. --- gcc/multiple_target.c | 1 + gcc/testsuite/gcc.dg/tree-prof/pr66295.c | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-prof/pr66295.c diff --git a/gcc/multiple_target.c b/gcc/multiple_target.c index 7b735ae81ae..4a835bbcc17 100644 --- a/gcc/multiple_target.c +++ b/gcc/multiple_target.c @@ -327,6 +327,7 @@ expand_target_clones (struct cgraph_node *node, bool definition) tree attributes = make_attribute ("target", "default", DECL_ATTRIBUTES (node->decl)); DECL_ATTRIBUTES (node->decl) = attributes; + node->local.local = false; location_t saved_loc = input_location; input_location = DECL_SOURCE_LOCATION (node->decl); bool ret diff --git a/gcc/testsuite/gcc.dg/tree-prof/pr66295.c b/gcc/testsuite/gcc.dg/tree-prof/pr66295.c new file mode 100644 index 00000000000..1ab7e6c8f64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/pr66295.c @@ -0,0 +1,34 @@ +/* { dg-require-ifunc "" } */ +/* { dg-options "-O2" } */ + +static double bar (double *__restrict, double *__restrict, int) +__attribute__ ((target_clones("avx,avx2,avx512f,default"))); + +double +foo (double *__restrict a, double *__restrict b, int n) +{ + return bar (a,b,n); +} + +double +bar (double *__restrict a, double *__restrict b, int n) /* { dg-error "attribute\[^\n\r]*foo\[^\n\r]* is unknown" } */ +{ + double s; + int i; + s = 0.0; + for (i=0; i<n; i++) + s += a[i] + b[i]; + + return s; +} + +#define N 5 + +int main () +{ + double a[N] = {1.2f, 1.2f, 1.2f, 1.2f, 1.2f }; + double b[N] = {1.2f, 1.2f, 1.2f, 1.2f, 1.2f }; + + __builtin_printf ("value: %.5f\n", foo (a, b, N)); + return 0; +} -- 2.11.1