This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make inlining consistent in LTO and non-LTO mode (PR target/71991).
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Martin Liška <mliska at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Jun 2017 16:24:04 +0200
- Subject: Re: [PATCH] Make inlining consistent in LTO and non-LTO mode (PR target/71991).
- Authentication-results: sourceware.org; auth=none
- References: <41799444-fc9f-526e-e792-0bcb5f5d1440@suse.cz>
> - /* If callee has no option attributes, then it is ok to inline. */
> - if (!callee_tree)
> + /* If callee has no option attributes (or default),
> + then it is ok to inline. */
> + if (!callee_tree || callee_tree == target_option_default_node)
I am not sure this actually makes sense, because target_option_default_node is not very
meaningful for LTO (it contains whatever was passed to LTO driver). Perhaps one can check
for explicit optimization/machine attribute and whether caller and callee come from
same compilation unit, though this is quite hackish and will do unexpected things with COMDATs.
honza
> ret = true;
>
> /* If caller has no option attributes, but callee does then it is not ok to
> diff --git a/gcc/testsuite/gcc.dg/torture/pr71991.c b/gcc/testsuite/gcc.dg/torture/pr71991.c
> new file mode 100644
> index 00000000000..79c927f6844
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/torture/pr71991.c
> @@ -0,0 +1,12 @@
> +/* PR target/71991 */
> +
> +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-std=c99" } */
> +
> +static inline int __attribute__ ((__always_inline__)) fn1 () { return 0; }
> +static inline int __attribute__ ((target("inline-all-stringops"))) fn2 () { return fn1 (); }
> +
> +int main()
> +{
> + return fn2();
> +}
>