Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Jason Merrill via Gcc-patches
use the enclosing arg level. Relative to the previous patch, this increases the % of calls to tsubst_template_args that benefit from this optimization a further 10% (30% -> 40%), and reduces memory usage for e.g. zip.cpp from range-v3 a further 2.5% (1.5% -> 4%). -- >8 -- Subje

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Patrick Palka via Gcc-patches
> + return this TREE_VEC instead of allocating a new one if > > > > > > > possible. > > > > > > > This > > > > > > > + will either be ARGS or a level from ARGS. */ > > > > > > > + tree maybe_reuse = N

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-07 Thread Patrick Palka via Gcc-patches
tree orig_arg = TREE_VEC_ELT (t, i); > > > > > > tree new_arg; > > > > > > @@ -13580,56 +13586,90 @@ tsubst_template_args (tree t, tree args, > > > > > > tsubst_flags_t complain, tree in_decl) > > > > > >

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-06 Thread Jason Merrill via Gcc-patches
assert that 'out' never exceeds 'len', > and simplified the test orig_arg && (PACK_EXPANSION_P (orig_arg) || ARGUMENT_PACK_P (orig_arg)) && TREE_CODE (elts[i]) == TREE_VEC to just orig_arg && PACK_EXPANSION_P (orig_arg) && TRE

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-06 Thread Patrick Palka via Gcc-patches
_arg (orig_arg, args, complain, > > > > in_decl); > > > >+ /* If T heuristically appears to be a set of generic > > > > template > > > > +arguments, set MAYBE_REUSE to the corresponding level from > > > > + ARGS. */ &g

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-05 Thread Jason Merrill via Gcc-patches
On 7/5/22 10:06, Patrick Palka wrote: On Fri, 1 Jul 2022, Jason Merrill wrote: On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic DECL_TI_ARGS corresponds to an identity mapping of the given arguments, and hence its safe to always elide

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-05 Thread Patrick Palka via Gcc-patches
On Fri, 1 Jul 2022, Jason Merrill wrote: > On 6/29/22 13:42, Patrick Palka wrote: > > In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic > > DECL_TI_ARGS corresponds to an identity mapping of the given arguments, > > and hence its safe to always elide such substitution. But this

Re: [PATCH] c++: generic targs and identity substitution [PR105956]

2022-07-01 Thread Jason Merrill via Gcc-patches
On 6/29/22 13:42, Patrick Palka wrote: In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic DECL_TI_ARGS corresponds to an identity mapping of the given arguments, and hence its safe to always elide such substitution. But this PR demonstrates that such a substitution isn't always

[PATCH] c++: generic targs and identity substitution [PR105956]

2022-06-29 Thread Patrick Palka via Gcc-patches
In r13-1045-gcb7fd1ea85feea I assumed that substitution into generic DECL_TI_ARGS corresponds to an identity mapping of the given arguments, and hence its safe to always elide such substitution. But this PR demonstrates that such a substitution isn't always the identity mapping, in particular when