]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport "Fix ICE for SIMD clones usage in LTO"
authorTom de Vries <tom@codesourcery.com>
Tue, 16 Feb 2016 16:22:18 +0000 (16:22 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 16 Feb 2016 16:22:18 +0000 (16:22 +0000)
2016-02-16  Tom de Vries  <tom@codesourcery.com>

backport from trunk:
2015-10-21  Ilya Enkovich  <enkovich.gnu@gmail.com>

* omp-low.c (simd_clone_create): Set in_other_partition
for created clones.

* gcc.dg/lto/simd-function_0.c: New test.

From-SVN: r233464

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/simd-function_0.c [new file with mode: 0644]

index 320a9e846fabafd1840041e2341a108b824e7c14..68f9d8def6cfae4bbbeee825c9ef4bd9e5414d9d 100644 (file)
@@ -1,3 +1,11 @@
+2016-02-16  Tom de Vries  <tom@codesourcery.com>
+
+       backport from trunk:
+       2015-10-21  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * omp-low.c (simd_clone_create): Set in_other_partition
+       for created clones.
+
 2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>
 
        Backport from mainline
index b6ddf4883cbc7736f77576ca908aeabc67a562d1..f105529e54ea316e178d54a9a05e87092a10076f 100644 (file)
@@ -11192,6 +11192,8 @@ simd_clone_create (struct cgraph_node *old_node)
       DECL_STATIC_DESTRUCTOR (new_decl) = 0;
       new_node
        = cgraph_copy_node_for_versioning (old_node, new_decl, vNULL, NULL);
+      if (old_node->in_other_partition)
+       new_node->in_other_partition = 1;
       cgraph_call_function_insertion_hooks (new_node);
     }
   if (new_node == NULL)
index 8a19de5cc789bf0dda3ee7753c36e63edb202f6b..0c5c2f2ecf295b6fe1a68cf1c750b173aaf5f757 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-16  Tom de Vries  <tom@codesourcery.com>
+
+       backport from trunk:
+       2015-10-21  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       * gcc.dg/lto/simd-function_0.c: New test.
+
 2016-02-13  Oleg Endo  <olegendo@gcc.gnu.org>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/lto/simd-function_0.c b/gcc/testsuite/gcc.dg/lto/simd-function_0.c
new file mode 100644 (file)
index 0000000..cda31aa
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-lto-do link } */
+/* { dg-require-effective-target avx2 } */
+/* { dg-lto-options { { -fopenmp-simd -O3 -ffast-math -mavx2 -flto -flto-partition=max } } } */
+
+#define SIZE 4096
+float x[SIZE];
+
+
+#pragma omp declare simd
+float
+__attribute__ ((noinline))
+my_mul (float x, float y) {
+  return x * y;
+}
+
+__attribute__ ((noinline))
+int foo ()
+{
+  int i = 0;
+#pragma omp simd safelen (16)
+  for (i = 0; i < SIZE; i++)
+    x[i] = my_mul ((float)i, 9932.3323);
+  return (int)x[0];
+}
+
+int main ()
+{
+  int i = 0;
+  for (i = 0; i < SIZE; i++)
+    x[i] = my_mul ((float) i, 9932.3323);
+  foo ();
+  return (int)x[0];
+}
+