summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-14 11:59:59 +0000
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>2017-03-14 11:59:59 +0000
commit71482ab7dda085743bf68ec67393b11cf4cb7f41 (patch)
tree1712f24925c28f73979fba9d927b731868478f9e
parentc47b78eb70689c251ed7046e2b2e96f922d92582 (diff)
downloadgcc-71482ab7dda085743bf68ec67393b11cf4cb7f41.tar.gz
Fix multiple target clones nodes (PR lto/66295).
2017-03-14 Martin Liska <mliska@suse.cz> PR lto/66295 * multiple_target.c (expand_target_clones): Drop local.local flag for default implementation. 2017-03-14 Martin Liska <mliska@suse.cz> PR lto/66295 * gcc.dg/tree-prof/pr66295.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246119 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/multiple_target.c1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tree-prof/pr66295.c34
4 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8b84aabe0ef..458faddc8ae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-14 Martin Liska <mliska@suse.cz>
+
+ PR lto/66295
+ * multiple_target.c (expand_target_clones): Drop local.local
+ flag for default implementation.
+
2017-03-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/80030
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/ChangeLog b/gcc/testsuite/ChangeLog
index a3af8055414..eec5c79acf7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-14 Martin Liska <mliska@suse.cz>
+
+ PR lto/66295
+ * gcc.dg/tree-prof/pr66295.c: New test.
+
2017-03-13 Martin Liska <mliska@suse.cz>
PR middle-end/78339
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;
+}