This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR81921


On Tue, Aug 22, 2017 at 12:15 PM, Richard Biener <rguenther@suse.de> wrote:
>
> The following patch fixes PR81921 (and LTO build of libgo) which I ran
> into when trying to enable free-lang-data for non-LTO compiles.
>
> free-lang-data forces a DECL_FUNCTION_SPECIFIC_TARGET for all functions
> so we have them ending up with target_option_default_node eventually
> which is something ix86_can_inline_p doesn't expect (I tried forcing
> a compare of the actual options but that fails as well as we get
> spurious differences in use-fpmath, the default node with -m32
> -march=x86_64 doesn't have it while non-default nodes have it).
>
> The patch is what I consider safe for branches, we might want to work
> on sth better (actually comparing always and fixing the fpmath issue)
> on trunk as followup.
>
> Bootstrap & regtest running on x86_64-unknown-linux-gnu, ok for trunk
> and active branches?
>
> Note the change to the ref = false conditional isn't strictly necessary
> but it makes -flto and non-flto behave consistently.
>
> Thanks,
> Richard.
>
> 2017-08-22  Richard Biener  <rguenther@suse.de>
>
>         PR target/81921
>         * config/i386/i386.c (ix86_can_inline_p): Treat
>         target_option_default_node as non-existent.

LGTM.

Please give the patch some soaking time in the mainline before
backporting it to release branches.

Thanks,
Uros.

> Index: gcc/config/i386/i386.c
> ===================================================================
> --- gcc/config/i386/i386.c      (revision 251266)
> +++ gcc/config/i386/i386.c      (working copy)
> @@ -7507,12 +7507,12 @@ ix86_can_inline_p (tree caller, tree cal
>    tree callee_tree = DECL_FUNCTION_SPECIFIC_TARGET (callee);
>
>    /* If callee has no option attributes, then it is ok to inline.  */
> -  if (!callee_tree)
> +  if (!callee_tree || callee_tree == target_option_default_node)
>      ret = true;
>
>    /* If caller has no option attributes, but callee does then it is not ok to
>       inline.  */
> -  else if (!caller_tree)
> +  else if (!caller_tree || caller_tree == target_option_default_node)
>      ret = false;
>
>    else
> Index: gcc/testsuite/gcc.target/i386/pr81921.c
> ===================================================================
> --- gcc/testsuite/gcc.target/i386/pr81921.c     (nonexistent)
> +++ gcc/testsuite/gcc.target/i386/pr81921.c     (working copy)
> @@ -0,0 +1,14 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target lto } */
> +/* { dg-options "-flto -march=x86-64" } */
> +
> +extern __inline int  __attribute__((__gnu_inline__, __always_inline__, __artificial__, target("sse2")))
> +_mm_loadu_si128 (int const *__P)
> +{
> +    return *__P;
> +}
> +
> +void __attribute__((target("ssse3"))) foo (void *p)
> +{
> +  volatile int x = _mm_loadu_si128 (p);
> +}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]