public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: "Martin Liška" <mliska@suse.cz>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] C++: target attribute - local decl
Date: Thu, 4 Mar 2021 10:03:59 -0500	[thread overview]
Message-ID: <301ab0a4-59ee-454a-cfff-45594c49adb2@redhat.com> (raw)
In-Reply-To: <752a6974-2069-eba1-faf0-03aa9689288d@suse.cz>

On 3/4/21 3:19 AM, Martin Liška wrote:
> On 3/2/21 6:57 PM, Jason Merrill wrote:
>> On 3/2/21 5:34 AM, Martin Liška wrote:
>>> On 3/1/21 8:58 PM, Jason Merrill wrote:
>>>> On 3/1/21 11:59 AM, Martin Liška wrote:
>>>>> On 3/1/21 5:36 PM, Jason Merrill wrote:
>>>>>> On 3/1/21 7:43 AM, Martin Liška wrote:
>>>>>>> On 2/22/21 11:53 PM, Jason Merrill wrote:
>>>>>>>> The problem seems to be with the handling of local decls.  If 
>>>>>>>> DECL_LOCAL_DECL_P, you need to look at DECL_LOCAL_DECL_ALIAS to 
>>>>>>>> find the namespace-scope decl.  But then if there is no 
>>>>>>>> preceding namespace-scope declaration, the new decl created by 
>>>>>>>> push_local_extern_decl_alias doesn't have a cgraph node, either. 
>>>>>>>> I guess maybe_function_versions 
>>>>>>>> also needs to look through DECL_LOCAL_DECL_ALIAS.
>>>>>>>
>>>>>>> Ah, I see. Are you sure about the name 'maybe_function_versions'? 
>>>>>>> I can't find it.
>>>>>>
>>>>>> Ah, it's maybe_version_functions, sorry.
>>>>>
>>>>> Thanks, I see the function now.
>>>>> So about your guess:
>>>>>
>>>>>> I guess maybe_function_versions also needs to look through 
>>>>>> DECL_LOCAL_DECL_ALIAS.
>>>>>
>>>>> Do you mean maybe_version_functions's argument 'record' should 
>>>>> depend on DECL_LOCAL_DECL_ALIAS of newdecl/oldddecl
>>>>> (if present)? Or that DECL_FUNCTION_VERSIONED should be set for 
>>>>> DECL_LOCAL_DECL_ALIASes of the newdecl/olddecl
>>>>> function declarations?
>>>>
>>>> The latter.
>>>
>>> I see, but will not help us. Problem is that
>>> #2  0x00000000015d8899 in ix86_get_function_versions_dispatcher 
>>> (decl=0x7ffff7755000) at 
>>> /home/marxin/Programming/gcc/gcc/config/i386/i386-features.c:2862
>>>
>>> is called for a declaration for which
>>>
>>> Breakpoint 5, maybe_version_functions (newdecl=<function_decl 
>>> 0x7ffff7755000 f>, olddecl=<function_decl 0x7ffff7751f00 f>, 
>>> record=false) at /home/marxin/Programming/gcc/gcc/cp/decl.c:1118
>>>
>>> is called with record=false. So that cgraph_node is not created for it.
>>>
>>> Or is a possible solution that get_function_version_dispatcher should 
>>> look through the DECL_LOCAL_DECL_ALIAS?
>>
>> Yes, I was thinking both that function and maybe_version_functions.
>>
>> Jason
>>
> 
> All right, the following patch fixes that.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

> +  record_function_versions (olddecl, olddecl, record);
> +  if (DECL_LOCAL_DECL_P (olddecl)
> +      && DECL_LOCAL_DECL_ALIAS (olddecl) != NULL_TREE)
> +    record_function_versions (olddecl, DECL_LOCAL_DECL_ALIAS (olddecl), true);
>  
> +  record_function_versions (olddecl, newdecl, record);
> +  if (DECL_LOCAL_DECL_P (newdecl)
> +      && DECL_LOCAL_DECL_ALIAS (newdecl) != NULL_TREE)
> +    record_function_versions (olddecl, DECL_LOCAL_DECL_ALIAS (newdecl), true);

Do you really need to register all these pairs?  I was expecting that 
you'd just look through DECL_LOCAL_DECL_ALIAS and then register the pair 
you end up with.  Local decls shouldn't need a cgraph node.

Jason


  reply	other threads:[~2021-03-04 15:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 12:15 Martin Liška
2021-02-22 22:53 ` Jason Merrill
2021-03-01 12:43   ` Martin Liška
2021-03-01 16:36     ` Jason Merrill
2021-03-01 16:59       ` Martin Liška
2021-03-01 19:58         ` Jason Merrill
2021-03-02 10:34           ` Martin Liška
2021-03-02 17:57             ` Jason Merrill
2021-03-04  8:19               ` Martin Liška
2021-03-04 15:03                 ` Jason Merrill [this message]
2021-03-04 15:39                   ` Martin Liška
2021-03-04 15:45                     ` Jason Merrill
2021-03-04 15:52                       ` Martin Liška
2021-03-04 20:54                         ` Jason Merrill
2021-03-08  9:33                           ` Martin Liška
2021-03-16 20:12                             ` Jason Merrill

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=301ab0a4-59ee-454a-cfff-45594c49adb2@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).