public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1046] c++: optimize specialization of templated member functions
@ 2022-06-10 20:10 Patrick Palka
0 siblings, 0 replies; only message in thread
From: Patrick Palka @ 2022-06-10 20:10 UTC (permalink / raw)
To: gcc-cvs
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-10 20:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 20:10 [gcc r13-1046] c++: optimize specialization of templated member functions Patrick Palka
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).