c++: Reduce memory consumption for arrays of non-aggregate type.
authorJason Merrill <jason@redhat.com>
Fri, 31 Jan 2020 05:21:44 +0000 (00:21 -0500)
committerJason Merrill <jason@redhat.com>
Fri, 31 Jan 2020 23:19:31 +0000 (18:19 -0500)
commite98ebda074bf8fc5f630a93085af81f52437d851
treebbe89785ff32257304ced90495373a2c64c1bdca
parentd2b9548f38c77edc29ab0e24e516f1fb341ecea7
c++: Reduce memory consumption for arrays of non-aggregate type.

The remaining low-hanging fruit for improvement on memory consumption in the
14179 testcase was the duplication of the CONSTRUCTOR for the array by
reshape_init.  This patch changes reshape_init to reuse a single constructor
for an array of non-aggregate type such as the one in the testcase.

PR c++/14179
* decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
non-aggregate elements.
(reshape_init_array): Add first_initializer_p parm.
(reshape_init_r): Change first_initializer_p from bool to tree.
(reshape_init): Pass init to it.
gcc/cp/ChangeLog
gcc/cp/decl.c