public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ipa: "naked" attribute implies "noipa" attribute
@ 2021-08-13  9:14 Martin Liška
  2021-08-13 10:31 ` Jan Hubicka
  2021-08-16  6:15 ` Richard Biener
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Liška @ 2021-08-13  9:14 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

Hi.

This is a first part fixing the PR. It makes sense making "naked" functions "noipa".
What's missing is IPA MOD pass support where the pass should not optimize fns
with "noipa" attributes.

@Honza: Can you please implement that?

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

	PR ipa/101354

gcc/ChangeLog:

	* attribs.c (decl_attributes): Make naked functions "noipa"
	  functions.
---
  gcc/attribs.c | 11 +++--------
  1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gcc/attribs.c b/gcc/attribs.c
index afa485ed37d..e149f5b66dd 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -517,14 +517,9 @@ decl_attributes (tree *node, tree attributes, int flags,
    if (TREE_CODE (*node) == FUNCTION_DECL
        && attributes
        && lookup_attribute ("naked", attributes) != NULL
-      && lookup_attribute_spec (get_identifier ("naked")))
-    {
-      if (lookup_attribute ("noinline", attributes) == NULL)
-	attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
-
-      if (lookup_attribute ("noclone", attributes) == NULL)
-	attributes = tree_cons (get_identifier ("noclone"),  NULL, attributes);
-    }
+      && lookup_attribute_spec (get_identifier ("naked"))
+      &&(lookup_attribute ("noipa", attributes) == NULL))
+	attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);
  
    /* A "noipa" function attribute implies "noinline", "noclone" and "no_icf"
       for those targets that support it.  */
-- 
2.32.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipa: "naked" attribute implies "noipa" attribute
  2021-08-13  9:14 [PATCH] ipa: "naked" attribute implies "noipa" attribute Martin Liška
@ 2021-08-13 10:31 ` Jan Hubicka
  2021-08-13 14:03   ` Martin Liška
  2021-08-16  6:15 ` Richard Biener
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Hubicka @ 2021-08-13 10:31 UTC (permalink / raw)
  To: Martin Liška; +Cc: gcc-patches

> Hi.
> 
> This is a first part fixing the PR. It makes sense making "naked" functions "noipa".
> What's missing is IPA MOD pass support where the pass should not optimize fns
> with "noipa" attributes.
> 
> @Honza: Can you please implement that?

Hmm, I had patch for that somewhere, will do that.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?

OK, except for..
> +      && lookup_attribute_spec (get_identifier ("naked"))
> +      &&(lookup_attribute ("noipa", attributes) == NULL))

missing space or extra braces here.  I am not sure how much we play with
NULL_TREE these days.

Honza
> +	attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);
>    /* A "noipa" function attribute implies "noinline", "noclone" and "no_icf"
>       for those targets that support it.  */
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipa: "naked" attribute implies "noipa" attribute
  2021-08-13 10:31 ` Jan Hubicka
@ 2021-08-13 14:03   ` Martin Liška
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Liška @ 2021-08-13 14:03 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On 8/13/21 12:31 PM, Jan Hubicka wrote:
>> Hi.
>>
>> This is a first part fixing the PR. It makes sense making "naked" functions "noipa".
>> What's missing is IPA MOD pass support where the pass should not optimize fns
>> with "noipa" attributes.
>>
>> @Honza: Can you please implement that?
> 
> Hmm, I had patch for that somewhere, will do that.

Please do so, I'm going to assign you the PR.

>>
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>>
>> Ready to be installed?
> 
> OK, except for..
>> +      && lookup_attribute_spec (get_identifier ("naked"))
>> +      &&(lookup_attribute ("noipa", attributes) == NULL))
> 
> missing space or extra braces here.  I am not sure how much we play with
> NULL_TREE these days.

Sure, I'm going to fix it and push to master.

Martin

> 
> Honza
>> +	attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);
>>     /* A "noipa" function attribute implies "noinline", "noclone" and "no_icf"
>>        for those targets that support it.  */
>> -- 
>> 2.32.0
>>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipa: "naked" attribute implies "noipa" attribute
  2021-08-13  9:14 [PATCH] ipa: "naked" attribute implies "noipa" attribute Martin Liška
  2021-08-13 10:31 ` Jan Hubicka
@ 2021-08-16  6:15 ` Richard Biener
  2021-08-16  6:16   ` Richard Biener
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Biener @ 2021-08-16  6:15 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jan Hubicka

On Fri, Aug 13, 2021 at 11:14 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hi.
>
> This is a first part fixing the PR. It makes sense making "naked" functions "noipa".
> What's missing is IPA MOD pass support where the pass should not optimize fns
> with "noipa" attributes.
>
> @Honza: Can you please implement that?
>
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>
> Ready to be installed?
> Thanks,
> Martin
>
>         PR ipa/101354
>
> gcc/ChangeLog:
>
>         * attribs.c (decl_attributes): Make naked functions "noipa"
>           functions.
> ---
>   gcc/attribs.c | 11 +++--------
>   1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/gcc/attribs.c b/gcc/attribs.c
> index afa485ed37d..e149f5b66dd 100644
> --- a/gcc/attribs.c
> +++ b/gcc/attribs.c
> @@ -517,14 +517,9 @@ decl_attributes (tree *node, tree attributes, int flags,
>     if (TREE_CODE (*node) == FUNCTION_DECL
>         && attributes
>         && lookup_attribute ("naked", attributes) != NULL
> -      && lookup_attribute_spec (get_identifier ("naked")))
> -    {
> -      if (lookup_attribute ("noinline", attributes) == NULL)
> -       attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
> -
> -      if (lookup_attribute ("noclone", attributes) == NULL)
> -       attributes = tree_cons (get_identifier ("noclone"),  NULL, attributes);
> -    }
> +      && lookup_attribute_spec (get_identifier ("naked"))
> +      &&(lookup_attribute ("noipa", attributes) == NULL))
> +       attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);

that adds noipa only for the purpose of "decomposing" it below.

>     /* A "noipa" function attribute implies "noinline", "noclone" and "no_icf"
>        for those targets that support it.  */
> --
> 2.32.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipa: "naked" attribute implies "noipa" attribute
  2021-08-16  6:15 ` Richard Biener
@ 2021-08-16  6:16   ` Richard Biener
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Biener @ 2021-08-16  6:16 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches, Jan Hubicka

On Mon, Aug 16, 2021 at 8:15 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Fri, Aug 13, 2021 at 11:14 AM Martin Liška <mliska@suse.cz> wrote:
> >
> > Hi.
> >
> > This is a first part fixing the PR. It makes sense making "naked" functions "noipa".
> > What's missing is IPA MOD pass support where the pass should not optimize fns
> > with "noipa" attributes.
> >
> > @Honza: Can you please implement that?
> >
> > Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> >
> > Ready to be installed?
> > Thanks,
> > Martin
> >
> >         PR ipa/101354
> >
> > gcc/ChangeLog:
> >
> >         * attribs.c (decl_attributes): Make naked functions "noipa"
> >           functions.
> > ---
> >   gcc/attribs.c | 11 +++--------
> >   1 file changed, 3 insertions(+), 8 deletions(-)
> >
> > diff --git a/gcc/attribs.c b/gcc/attribs.c
> > index afa485ed37d..e149f5b66dd 100644
> > --- a/gcc/attribs.c
> > +++ b/gcc/attribs.c
> > @@ -517,14 +517,9 @@ decl_attributes (tree *node, tree attributes, int flags,
> >     if (TREE_CODE (*node) == FUNCTION_DECL
> >         && attributes
> >         && lookup_attribute ("naked", attributes) != NULL
> > -      && lookup_attribute_spec (get_identifier ("naked")))
> > -    {
> > -      if (lookup_attribute ("noinline", attributes) == NULL)
> > -       attributes = tree_cons (get_identifier ("noinline"), NULL, attributes);
> > -
> > -      if (lookup_attribute ("noclone", attributes) == NULL)
> > -       attributes = tree_cons (get_identifier ("noclone"),  NULL, attributes);
> > -    }
> > +      && lookup_attribute_spec (get_identifier ("naked"))
> > +      &&(lookup_attribute ("noipa", attributes) == NULL))
> > +       attributes = tree_cons (get_identifier ("noipa"), NULL, attributes);
>
> that adds noipa only for the purpose of "decomposing" it below.

Hmm, no, we do seem to check for "noipa" in quite some places, so ignore
me.

Richard.

> >     /* A "noipa" function attribute implies "noinline", "noclone" and "no_icf"
> >        for those targets that support it.  */
> > --
> > 2.32.0
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-16  6:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13  9:14 [PATCH] ipa: "naked" attribute implies "noipa" attribute Martin Liška
2021-08-13 10:31 ` Jan Hubicka
2021-08-13 14:03   ` Martin Liška
2021-08-16  6:15 ` Richard Biener
2021-08-16  6:16   ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).