public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1046] c++: optimize specialization of templated member functions Date: Fri, 10 Jun 2022 20:10:44 +0000 (GMT) [thread overview] Message-ID: <20220610201044.AF9913856253@sourceware.org> (raw) https://gcc.gnu.org/g:f9b5a8e58dfd0642bea932d449ad46da9e57396f commit r13-1046-gf9b5a8e58dfd0642bea932d449ad46da9e57396f Author: Patrick Palka <ppalka@redhat.com> Date: Fri Jun 10 16:09:58 2022 -0400 c++: optimize specialization of templated member functions This applies one of the lookup_template_class optimizations from the previous patch to instantiate_template as well. gcc/cp/ChangeLog: * pt.cc (instantiate_template): Don't substitute the context of the most general template if that of the partially instantiated template is already non-dependent. Diff: --- gcc/cp/pt.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 079cadff37c..1f91fc20f7f 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -21714,8 +21714,14 @@ instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain) ++processing_template_decl; if (DECL_CLASS_SCOPE_P (gen_tmpl)) { - tree ctx = tsubst_aggr_type (DECL_CONTEXT (gen_tmpl), targ_ptr, - complain, gen_tmpl, true); + tree ctx; + if (!uses_template_parms (DECL_CONTEXT (tmpl))) + /* If the context of the partially instantiated template is + already non-dependent, then we might as well use it. */ + ctx = DECL_CONTEXT (tmpl); + else + ctx = tsubst_aggr_type (DECL_CONTEXT (gen_tmpl), targ_ptr, + complain, gen_tmpl, true); push_nested_class (ctx); }
reply other threads:[~2022-06-10 20:10 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220610201044.AF9913856253@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).