From: Jason Merrill <jason@redhat.com>
To: Patrick Palka <ppalka@redhat.com>,
Nathaniel Shead <nathanieloshead@gmail.com>
Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH] c++/modules: Stream unmergeable temporaries by value again [PR114856]
Date: Thu, 2 May 2024 13:53:44 -0400 [thread overview]
Message-ID: <68bb9908-4d0b-48ac-a86b-b8e4201aec1b@redhat.com> (raw)
In-Reply-To: <5be296d2-1ff5-f80c-302c-820305d4328c@idea>
On 5/2/24 10:40, Patrick Palka wrote:
> On Thu, 2 May 2024, Nathaniel Shead wrote:
>
>> Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk/14.2?
>>
>> Another alternative would be to stream such !DECL_NAME temporaries with
>> a merge key of MK_unique rather than attempting to find the matching
>> (nonexistant) field of the class context.
>
> Both approaches sound good to me, hard to say which one is preferable..
>
> The handling of function-scope vs class-scope temporaries seems to start
> diverging in:
>
> @@ -8861,28 +8861,6 @@ trees_out::decl_node (tree decl, walk_kind ref)
> return false;
> }
>
> ! tree ctx = CP_DECL_CONTEXT (decl);
> ! depset *dep = NULL;
> ! if (streaming_p ())
> ! dep = dep_hash->find_dependency (decl);
> ! else if (TREE_CODE (ctx) != FUNCTION_DECL
> ! || TREE_CODE (decl) == TEMPLATE_DECL
> ! || DECL_IMPLICIT_TYPEDEF_P (decl)
> ! || (DECL_LANG_SPECIFIC (decl)
> ! && DECL_MODULE_IMPORT_P (decl)))
> ! {
> ! auto kind = (TREE_CODE (decl) == NAMESPACE_DECL
> ! && !DECL_NAMESPACE_ALIAS (decl)
> ! ? depset::EK_NAMESPACE : depset::EK_DECL);
> ! dep = dep_hash->add_dependency (decl, kind);
> ! }
> !
> ! if (!dep)
> ! {
> ! /* Some internal entity of context. Do by value. */
> ! decl_value (decl, NULL);
> ! return false;
> ! }
>
> if (dep->get_entity_kind () == depset::EK_REDIRECT)
> {
>
> where for a class-scope temporary we add a dependency for it, stream
> it by reference, and then stream it by value separately, which seems
> unnecessary.
>
> So if we decide to keep the create_temporary_var change, we probably
> would want to unify this code path's handling of temporaries (i.e.
> don't add_dependency a temporary regardless of its context).
>
> If we decide your partially revert the create_temporary_var change,
> your patch LGTM.
Streaming by value sounds right, but as noted an important difference
between reference temps and others is DECL_NAME. Perhaps the code
Patrick quotes could look at that as well as the context?
Jason
next prev parent reply other threads:[~2024-05-02 17:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-01 23:50 Nathaniel Shead
2024-05-02 14:40 ` Patrick Palka
2024-05-02 17:53 ` Jason Merrill [this message]
2024-05-07 5:35 ` Nathaniel Shead
2024-05-07 19:04 ` 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=68bb9908-4d0b-48ac-a86b-b8e4201aec1b@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nathan@acm.org \
--cc=nathanieloshead@gmail.com \
--cc=ppalka@redhat.com \
/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).