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
> + 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
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)
> > > > > >
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
_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
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
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
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
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