On Wed, Jan 24, 2018 at 06:51:54PM +0100, Richard Biener wrote:
> >Well, "omp declare simd" is a part of the ABI just for the original
> >exported
> >functions, for everything else it is a pure optimization, but I'm not
> >sure
> >if we want to deoptimize e.g. callers of these functions outside of
> >loops
> >by disabling the signature changing cloning for those.  For calls from
> >within OpenMP simd regions or other loops where we try hard to
> >vectorize
> >them, it might make sense not to change those callers, for callers from
> >other loops, a question.
> 
> Until we can distinguish the cases I think not changing the signature by
> default might be a good thing.

Done thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.

2018-01-25  Jakub Jelinek  <ja...@redhat.com>

        PR middle-end/83977
        * ipa-fnsummary.c (compute_fn_summary): Clear can_change_signature
        on functions with #pragma omp declare simd or functions with simd
        attribute.
        * omp-simd-clone.c (expand_simd_clones): Revert 2018-01-24 change.
        * config/i386/i386.c (ix86_simd_clone_compute_vecsize_and_simdlen):
        Remove trailing \n from warning_at calls.

        * c-c++-common/gomp/pr83977-1.c: Add -w to dg-options.

--- gcc/ipa-fnsummary.c.jj      2018-01-25 12:13:06.651327787 +0100
+++ gcc/ipa-fnsummary.c 2018-01-25 12:14:22.282340706 +0100
@@ -2467,7 +2467,11 @@ compute_fn_summary (struct cgraph_node *
         info->inlinable = tree_inlinable_function_p (node->decl);
 
        /* Type attributes can use parameter indices to describe them.  */
-       if (TYPE_ATTRIBUTES (TREE_TYPE (node->decl)))
+       if (TYPE_ATTRIBUTES (TREE_TYPE (node->decl))
+          /* Likewise for #pragma omp declare simd functions or functions
+             with simd attribute.  */
+          || lookup_attribute ("omp declare simd",
+                               DECL_ATTRIBUTES (node->decl)))
         node->local.can_change_signature = false;
        else
         {
--- gcc/omp-simd-clone.c.jj     2018-01-25 12:13:06.624327783 +0100
+++ gcc/omp-simd-clone.c        2018-01-25 12:14:22.282340706 +0100
@@ -1574,10 +1574,6 @@ expand_simd_clones (struct cgraph_node *
   tree attr = lookup_attribute ("omp declare simd",
                                DECL_ATTRIBUTES (node->decl));
   if (attr == NULL_TREE
-      /* Ignore artificial decls with an abstract origin, results of function
-        cloning, versioning etc.  We want to handle certain builtins
-        with simd attribute, like __builtin_sin.  */
-      || (DECL_ARTIFICIAL (node->decl) && DECL_ABSTRACT_ORIGIN (node->decl))
       || node->global.inlined_to
       || lookup_attribute ("noclone", DECL_ATTRIBUTES (node->decl)))
     return;
--- gcc/config/i386/i386.c.jj   2018-01-24 23:41:33.714031847 +0100
+++ gcc/config/i386/i386.c      2018-01-25 12:16:02.231357778 +0100
@@ -50224,7 +50224,7 @@ ix86_simd_clone_compute_vecsize_and_simd
        break;
       default:
        warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
-                   "unsupported return type %qT for simd\n", ret_type);
+                   "unsupported return type %qT for simd", ret_type);
        return 0;
       }
 
@@ -50246,7 +50246,7 @@ ix86_simd_clone_compute_vecsize_and_simd
        break;
       default:
        warning_at (DECL_SOURCE_LOCATION (node->decl), 0,
-                   "unsupported argument type %qT for simd\n", TREE_TYPE (t));
+                   "unsupported argument type %qT for simd", TREE_TYPE (t));
        return 0;
       }
 
--- gcc/testsuite/c-c++-common/gomp/pr83977-1.c.jj      2018-01-24 
17:26:25.217357997 +0100
+++ gcc/testsuite/c-c++-common/gomp/pr83977-1.c 2018-01-25 12:18:34.196383735 
+0100
@@ -1,6 +1,6 @@
 /* PR middle-end/83977 */
 /* { dg-do compile } */
-/* { dg-additional-options "-O2" } */
+/* { dg-additional-options "-O2 -w" } */
 
 struct S { int a, b, c; };
 


        Jakub

Reply via email to